Re: Direct Memory Access [message #9532] |
Tue, 08 July 1997 00:00 |
rivers
Messages: 228 Registered: March 1991
|
Senior Member |
|
|
In article <33C15E1E.497BC3D@astrosun.tn.cornell.edu>, "J.D. Smith" <jdsmith@astrosun.tn.cornell.edu> writes:
> I have a hypothetical question. Consider a large block of memory which
> contains a series of images (say 8-bit deep pixels) put there by, for
> instance, a digital camera. Does there exist the possibility of
> accessing that memory directly in IDL, given that you know the fixed
> memory address at which the image will be stored (or, if not a fixed
> address, can at least be given it)? A pointer in C accomplishes this
> nicely, but I don't know of an equivalent, low-level, hook in IDL. No
> doubt some of you have implemented real-time data acquisition into IDL
> and have dealt with this problem. Thanks for your help.
There are 2 ways to do this, CALL_EXTERNAL and LINKIMAGE
1) With CALL_EXTERNAL you must allocate the memory for the IDL array first,
from inside IDL, and then call an external C routine. The C routine
would then copy the data from the fixed memory address to the IDL array.
This may suit your needs, but is clearly rather restrictive.
2) Using LINKIMAGE you write C routines which create IDL variables. As I
remember you call IDL provided functions to create variables. However, you
do have access to the pointers, and so if you like to live dangerously you
could change these pointers to point to the address of your frame buffer.
The danger comes if and when IDL decides to destroy the variable you have
created. It will probably crash, since the pointer will not be to memory
which it has allocated.
____________________________________________________________
Mark Rivers (773) 702-2279 (office)
CARS (773) 702-9951 (secretary)
Univ. of Chicago (773) 702-5454 (FAX)
5640 S. Ellis Ave. (708) 922-0499 (home)
Chicago, IL 60637 rivers@cars.uchicago.edu (e-mail)
or:
Argonne National Laboratory (630) 252-0422 (office)
Building 434A (630) 252-0405 (lab)
9700 South Cass Avenue (630) 252-1713 (beamline)
Argonne, IL 60439 (630) 252-0443 (FAX)
|
|
|