Skip navigation.
Home
The QNX Community Portal

View topic - Read/write memory-mapped resources through PC/104

Read/write memory-mapped resources through PC/104

For discussion of realtime and/or embedded programming.

Read/write memory-mapped resources through PC/104

Postby _KB_ » Fri Nov 09, 2012 10:58 am

Hi,

I can't post a reply on this topic because it is locked, so I open a new one.

I have a Geode lx800 processor with a ite8888 pci-isa (pc104) bridge. In the future I will have two PC/104 boards. One with I/O ports access and another one with I/O ports and memory-mapped access.

I am able to read/write I/O ports with the first one :
Code: Select all
ThreadCtl(_NTO_TCTL_IO, NULL);
out8(address, data);
// data = in8(address);

note : mmap_device_io() isn't necessary on x86 systems

I have not the second board yet but still I'm trying PC/104 memory access with an oscilloscope (MEMW signal monitoring for PC/104 16 bits access).
Here's my code:
unsigned short *MyAddress;
unsigned short dummy;
int var;

printf("Test mmap\n");
ThreadCtl(_NTO_TCTL_IO, 0);
#if 1
MyAddress = (unsigned short *)mmap_device_memory( 0, 64*1024,
PROT_READ | PROT_WRITE | PROT_NOCACHE,
0x0F0000, 0);
#endif
#if 0
MyAddress = (unsigned short *)mmap( 0, 64*1024,
PROT_READ|PROT_WRITE, MAP_PHYS | MAP_PRIVATE,
NOFD,
0xC0000);
#endif
printf("virtual address: 0x%X\n", (int)MyAddress);

if (MyAddress == MAP_FAILED)
{
perror("mmap");
//printf("Error: mmap_device_memory() failed \n");
exit(1);
}
else
{
MyAddress = 0xFFFF;


Of course, my bios is configured to decode PC/104 memory address 0x0F0000.
There is no fluctuation on MEMW line...

I tried a 16-bits read also but with no more success.Same results with 8-bits read/write access (SMEMW, SMEMR).

Any suggestion? :|

Thanks!
_KB_
Active Member
 
Posts: 24
Joined: Mon Oct 15, 2012 6:36 pm

Re: Read/write memory-mapped resources through PC/104

Postby maschoen » Fri Nov 09, 2012 4:52 pm

This is not the answer you want, however...
You have proved that there is a problem the hard way.
As with software, when doing something directly in hardware, there is always the possibility that you have a bug, or rather a procedural error.

I would wait until you get your new board and see if you can't access the memory on it.
maschoen
QNX Master
 
Posts: 2644
Joined: Wed Jun 25, 2003 5:18 pm

Re: Read/write memory-mapped resources through PC/104

Postby _KB_ » Thu Nov 15, 2012 5:56 pm

Hi,

A little update. I am now able to write memory.
There was a little bug in the code I posted earlier (2 mismatched parameters in mmap_device_memory and I didn't dereference MyAddress ) :

Code: Select all
MyAddress = (unsigned short *)mmap_device_memory( 0, 64*1024,
PROT_READ | PROT_WRITE | PROT_NOCACHE,
0, 0xF000);

*MyAddress =0xFFFF;


Shame on me :oops:

However I still can't read anything!

I don't think it is a low-level driver issue nor a problem with my code but here is my code for a 16-bits read :

Code: Select all
unsigned short *MyAddress;
unsigned short dummy;
MyAddress = (unsigned short *)mmap_device_memory( 0, 64*1024,
                                                 PROT_READ | PROT_WRITE | PROT_NOCACHE,
                                                 0, 0xF0000);
dummy = *MyAddress;


I can't figure out what I am missing ...

I get my board on Monday. Maybe I will see the light from here :mrgreen:

cheers.
_KB_
Active Member
 
Posts: 24
Joined: Mon Oct 15, 2012 6:36 pm

Re: Read/write memory-mapped resources through PC/104

Postby mario » Fri Nov 16, 2012 5:14 pm

If for *MyAddress = 0; you see the write for variable = *MyAddress you should see the read. If not then I'm pretty sure it's hardware related, and not some config in the program.
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

Re: Read/write memory-mapped resources through PC/104

Postby _KB_ » Fri Nov 30, 2012 9:40 am

Hello again!

I can eventually read the memory of my board. It seems that I just needed a response from a slave after all. Strange but functionnal.
Maybe the PCI/ISA bridge is designed like this.

Anyway thanks for the support! :P
_KB_
Active Member
 
Posts: 24
Joined: Mon Oct 15, 2012 6:36 pm


Return to Realtime and Embedded

Who is online

Users browsing this forum: No registered users and 1 guest