ts-7000
[Top] [All Lists]

[ts-7000] Shared Memory between User Space App and 2.4 Kernel Module

To:
Subject: [ts-7000] Shared Memory between User Space App and 2.4 Kernel Module
From: "marv.schwartz" <>
Date: Thu, 05 Mar 2009 17:47:22 -0000
Hi,

How can a tslinux 2.4 kernel module and an application both access shared 
memory? In the app, a shared memory block is created or opened in the the 
following code:

#define SHMKEY (ftok("KWHdata", 0x1e))

typedef struct shMem {
   int state;
   long elapsedSecs;
   int counter1;
   int counter2;
   int counter3;
   int counter4;
} sharedMem;

sharedMem *getSharedMem() {
   int shmid = shmget(SHMKEY, sizeof(sharedMem), IPC_CREAT | IPC_EXCL | 0x660); 
// try to create shared memory
   if (shmid == -1) shmid = shmget(SHMKEY, sizeof(sharedMem), 0); // create 
failed--try to use existing shared memory
   if (shmid == -1) {
       perror("Error assigning shared memory");
       exit(1);
   }
   return shmat(shmid, 0, 0);
}

How is the same shared memory accessed from a tslinux 2.4 kernel module (on a 
ts-7250)? Are there equivalent routines to ftok and shmget?

The kernel module increments the counters on interrupts. The app needs 
read-only access to the counters.

Thanks,

Marv




------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU