Sunil Kittur(deleted)
|
Re: shm_ctl() fails with SHMCTL_PHYS|SHMCTL_GLOBAL on ARM target
|
Sunil Kittur(deleted)
09/23/2008 9:11 AM
post13839
|
Re: shm_ctl() fails with SHMCTL_PHYS|SHMCTL_GLOBAL on ARM target
What procnto version are using (eg. uname -a output)?
Sunil.
Ken Schumm wrote:
> The problem can easily be replicated by using the sharephyscreator.c example in the shm_ctl() documentation by ORing
the SHMCTL_GLOBAL to the shm_ctl() flags.
>
> In our case we are using a 16k block at address 0x5c000000, which is the base address of physical PXA270 onboard SRAM.
>
>
> _______________________________________________
> OSTech
> http://community.qnx.com/sf/go/post13834
>
|
|
|
Sunil Kittur(deleted)
|
Re: shm_ctl() fails with SHMCTL_PHYS|SHMCTL_GLOBAL on ARM target
|
Sunil Kittur(deleted)
09/23/2008 10:25 AM
post13858
|
Re: shm_ctl() fails with SHMCTL_PHYS|SHMCTL_GLOBAL on ARM target
The following code seems to work for me on an ARM926 based board using either
a 632 or a 640 procnto. Can you verify if this fails for you?
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/neutrino.h>
#include <sys/stat.h>
main(int argc, char *argv[])
{
int fd;
char *name = "/foo";
void *vaddr;
uint64_t paddr = 0x5c000000;
int size = 16384;
fd = shm_open(name, O_RDWR | O_CREAT, 0);
if (fd == -1) {
perror("shm_open");
exit(1);
}
if (shm_ctl(fd, SHMCTL_GLOBAL|SHMCTL_PHYS, paddr, size) == -1) {
perror("shm_ctl");
shm_unlink(name);
exit(1);
}
vaddr = mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if (vaddr == MAP_FAILED) {
perror("mmap");
shm_unlink(name);
exit(1);
}
close(fd);
printf("mmap successful: vaddr=%x\n", vaddr);
munmap(vaddr, size);
shm_unlink(name);
exit(0);
}
Ken Schumm wrote:
> The problem can easily be replicated by using the sharephyscreator.c example in the shm_ctl() documentation by ORing
the SHMCTL_GLOBAL to the shm_ctl() flags.
>
> In our case we are using a 16k block at address 0x5c000000, which is the base address of physical PXA270 onboard SRAM.
>
>
> _______________________________________________
> OSTech
> http://community.qnx.com/sf/go/post13834
>
|
|
|