Re: [CAD_CAM_EDM_DRO] EMC source code problem
Posted by
Art Fenerty
on 2001-09-03 04:51:30 UTC
Jon:
The structures are static so they only belong to the file in
question. The other modules are using shared memory to copy their own
structures into the shared memory region. Look for the shmem routine to see
how this is done. So, when Bridgetask uses EMCMOT_COMMAND it is using the
one declared in it's main header, then it passes it to the shmem routine to
be copy'ed to the shared memory where the real-time task picks it up and
uses it. Its been a few weeks since I looked at this, but thats how I
remember it going. It uses a key value of 100 to identify the region between
modules.
I managed to eliminate the shared memory and rewrote the shmem function
to copy all keys into the emcmot structure and it worked fine, but it was
only a test , so I put the shmem back into operation, I did find a bug in
the shmem but I think it was a misprint in the code I was playing with.
Hope this helps
Art
The structures are static so they only belong to the file in
question. The other modules are using shared memory to copy their own
structures into the shared memory region. Look for the shmem routine to see
how this is done. So, when Bridgetask uses EMCMOT_COMMAND it is using the
one declared in it's main header, then it passes it to the shmem routine to
be copy'ed to the shared memory where the real-time task picks it up and
uses it. Its been a few weeks since I looked at this, but thats how I
remember it going. It uses a key value of 100 to identify the region between
modules.
I managed to eliminate the shared memory and rewrote the shmem function
to copy all keys into the emcmot structure and it worked fine, but it was
only a test , so I put the shmem back into operation, I did find a bug in
the shmem but I think it was a misprint in the code I was playing with.
Hope this helps
Art
----- Original Message -----
From: "Jon Elson" <elson@...>
To: <CAD_CAM_EDM_DRO@yahoogroups.com>
Sent: Monday, September 03, 2001 12:38 AM
Subject: [CAD_CAM_EDM_DRO] EMC source code problem
> Hello, collected experts,
>
> Only Linux/Unix C gurus who are also well up to speed on EMC internals
> need to read this one!
>
> I have been trying to make some changes to EMC to make my parallel
> port motion control stuff send all digital I/O through the real-time
section
>
> to serialize access to the parallel port hardware. This involved adding
> a new struct to the structure of structs defined in emcmot/emcmot.h
> and instantiated for the Linux side in emcmot/usrmotintf.c
>
> I have gotten this compiling, but the problem I'm having is exporting the
> pointer to the structure. The 'meta-structure' is defined as
EMCMOT_STRUCT
> and it has structures defined in it like EMCMOT_COMMAND.
> usrmotintf.c instantiates these with lines like
>
> static EMCMOT_COMMAND *emcmotCommand = 0;
>
> and later sets the pointer with this line
>
> emcmotCommand = &(emcmotStruct->command);
>
> Now, it seems that these pointers are then exported to various parts of
> EMC for other programs to use. Maybe that is the problem, that I'm
> trying to use information in the wrong program module. but, i can see
> that modules like emctask/bridgeporttaskintf.c use these structures
> without any specific includes or definitions, other than just the
>
> static EMCMOT_COMMAND emcmotCommand;
>
> So, is this is a different pointer that is getting the correct address
> somehow,
> or is this the SAME pointer as was instantiated in usrmotintf.c, and is
> being
> connected by the linker?
>
> Anyway, I think I added my structure and pointers in the same way as
> these others have been done, but it doesn't seem to be working.
> My other routines that want to access the structure find the pointer nil.
>
> Thanks for any advice,
>
> Jon
>
>
> Addresses:
> FAQ: http://www.ktmarketing.com/faq.html
> FILES: http://groups.yahoo.com/group/CAD_CAM_EDM_DRO/files/
>
> Post messages: CAD_CAM_EDM_DRO@yahoogroups.com
> Subscribe: CAD_CAM_EDM_DRO-subscribe@yahoogroups.com
> Unsubscribe: CAD_CAM_EDM_DRO-unsubscribe@yahoogroups.com
> List owner: CAD_CAM_EDM_DRO-owner@yahoogroups.com, wanliker@...
> Moderator: jmelson@... timg@... [Moderator]
> URL to this page: http://groups.yahoo.com/group/CAD_CAM_EDM_DRO
> bill,
> List Manager
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
Discussion Thread
Jon Elson
2001-09-03 00:37:38 UTC
EMC source code problem
Art Fenerty
2001-09-03 04:51:30 UTC
Re: [CAD_CAM_EDM_DRO] EMC source code problem