Hello,
I am having some difficulty accessing the configuration register on the PPC
8245. The code is straightforward as follows:
volatile unsigned int *Write;
volatile unsigned int *Read;
Write= mmap_device_memory(0, 0x100,
PROT_READ|PROT_WRITE|PROT_NOCACHE, 0, 0xFEC00000);
Read = mmap_device_memory(0, 0x100,
PROT_READ|PROT_WRITE|PROT_NOCACHE, 0, 0xFEE00000);
//did the map work?
if((Source == MAP_FAILED) || (Dest == MAP_FAILED))
printf(" The channel map failed: %s\n", strerror(errno));
else
{
printf(“The Map Worked\n”);
//write to address 0xFEC00000 with a configuration reg address
Write= (unsigned int*)0x80000000;
//read from 0xFEE00000 the actual value from the config reg
printf(“dma reg is %x\n”, (unsigned int)Read);
}
However I don’t get the correct response back. To test I have also tried to
mmap() the Write and Read registers as well as to declare and initialize a
pointer to the registers directly with no luck. Does anyone have any ideas?
Thanks in advance,
Mike
Try
*Write = 0x80000000
printf(“dma reg is %x\n”, *Read);
Fun with pointers.
\
“barn’s burnt down… now I can see the moon.” - Masahide
Chris McCann
cwmccann@syscor_noflipping_spam.com
Mike Toreno wrote:
Hello,
I am having some difficulty accessing the configuration register on the
PPC 8245. The code is straightforward as follows:
volatile unsigned int *Write;
volatile unsigned int *Read;
Write= mmap_device_memory(0, 0x100,
PROT_READ|PROT_WRITE|PROT_NOCACHE, 0, 0xFEC00000);
Read = mmap_device_memory(0, 0x100,
PROT_READ|PROT_WRITE|PROT_NOCACHE, 0, 0xFEE00000);
//did the map work?
if((Source == MAP_FAILED) || (Dest == MAP_FAILED))
printf(" The channel map failed: %s\n", strerror(errno));
else
{
printf(“The Map Worked\n”);
//write to address 0xFEC00000 with a configuration reg address
Write= (unsigned int*)0x80000000;
//read from 0xFEE00000 the actual value from the config reg
printf(“dma reg is %x\n”, (unsigned int)Read);
}
However I don’t get the correct response back. To test I have also tried
to
mmap() the Write and Read registers as well as to declare and initialize
a pointer to the registers directly with no luck. Does anyone have any
ideas?
Thanks in advance,
Mike