> I am trying to get shared memory to work but as soon as I access it from the
> real-time side, I get a major crash. I have followed the procedure in the
> HOWTO with my own structures. The line that offends is
>
> rtl_mptr->apdData[0].rawData[0] = 1;
You need to add:
append mem=31m
to your lilo boot file. For a my 64mb system I use mem=61m and get 4mb of
"rt-shared" space at the top of linux. Since you'll certainly have at
least one linux program communicating via the rt-shared, it's nice to have
a "shared" header file describing where the rt-shared ram is physically.
Mine contains:
#define SRA_RAM (61 * 0x100000)
and from the rt code I then can access that memory with:
srp = ( struct SHARED_RAM *) SRA_RAM; // assign rt-linux pointer
srp->hwidth = HWIDTH; // intlz. some rt vars
srp->range_bias = RANGE_BIAS;
srp->roll_bias = ROLL_BIAS;
srp->pitch_bias = PITCH_BIAS;
srp->yaw_bias = YAW_BIAS;
Now from each linux program that needs access to that ram you need:
if ( ( mfd=open( "/dev/mem", O_RDWR )) == -1 ) { // open mem file
perror("/dev/mem failed ");
exit(1);
}
sra = (struct SHARED_RAM *)mmap(
0,
0x300000, // size of mapping
PROT_READ | PROT_WRITE , // access mode
MAP_SHARED, // access rights
mfd, // /dev/mem
(61 * 0x100000) ); // abs-physical offset of ram
After executing the above your regular linux program can read/write the
rt-shared ram.
If you need to access any PCI memory space, you'll need to use vremap() to
get a valid pointer to them and vfree() to release it when you're done.
Here's my code:
void * vremap();
static char *dig_ram; // digitizer PCI ram address
static char *vdig_ram; // vremapped digitizer PCI ram address
static int dig_ram_sz; // size of dig ram
static int dig_cpic; // base digitizer address
//*******************************************************
// call vremap to enable access to PCI card ram buffer
// It crashes the system hard if you don't call vremap
// Can't talk to the pci ram until after this is done
//*******************************************************
vdig_ram = vremap( dig_ram, dig_ram_sz );
and in the code to cleanup before removing the rt-module I execute:
vfree( vdig_ram);
It's also nice to "register" the module so it will report I/O addresses
being used. I use:
// request io region
request_region( 0x300, 0x10, "*SRA* RADAR Control Board");
request_region( dig_cpic, 0x100,"*SRA* BA3 Gage-8500 Waveform Digitizer");
in the module intlz code and:
release_region( 0x300, 0x10);
release_region( dig_cpic, 0x100);
printk("\nsra module removed. digwf=%x\n", digwf);
in the module which cleans up after we're done.
Kind regards,
C. W. Wright
http://sra.remote.sensing.org
--- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
----
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/