memory position of numpy arrays

Lars Friedrich lfriedri at imtek.de
Thu Oct 26 03:51:57 CDT 2006


Hello,

thanks for your comments.

Am Mittwoch, den 25.10.2006, 11:28 +0900 schrieb David Cournapeau:
> Andrew Straw wrote:
> > David Cournapeau wrote:
> >   
> >> I don't know anything about your device, but a driver directly accessing 
> >> a memory buffer from a userland program sounds like a bug to me. 
> >>     
> > David, DMA memory (yes, I know thats an example of RAS Syndrome,
> > apologies) allows hardware to fill a chunk of RAM and then hand it over
> > to a userspace program. In my experience, RAM used for this purpose must
> > be pre-allocated, usually in a ring-buffer type arrangement. So this is
> > normal operating procedure for something like a frame grabber and not a
> > bug at all.
> >   
> What I understood from former emails was that the user is allocating a 
> memory buffer, and that it gives this memory buffer to the hardware. In 
> this sense, I don't see how it is possible to avoid kernel panic or 
> equivalents. If on the contrary, the driver gives you the memory buffer, 
> then, ok, by eg a mmap-like call, you can access directly the device 
> memory, but within a range fixed by the driver, which is valid if the 
> driver is not buggy.

The API of the camera provides a function
pl_exp_start_cont(hCam, buffer, size)

The usage is to pass a Camera-Identifier "hCam", a pointer "buffer" and
a size "size" in bytes. The camera will then start to acquire frames and
put them to the buffer, which has to be size-bytes long. When the
function reaches the end of the buffer, it will start at the beginning
again (circular buffer mode). There is also a function available to ask
for the last buffer position that is written to. The buffer has to be
allocated by the caller of this API-function, so I guess it will be in
*userland*.

To have enough time to read a frame, the buffer has to be sufficiently
big. I don't know what is sufficient, but I made it 50 frames big. With
an acquisition time of lets say 10ms I have about 0.5seconds to get a
frame, that was recently written to the buffer.

I know, these things are not numpy and even not Python-questions, but
C-questions, and I think I should go and read something about it. Does
anyone have a recommendation where to find information on this
memory-locking things? How is this kind of programming called?
Driver-Programming? Hardware-Programming? System-Programming?

Thanks

Lars

-- 
Dipl.-Ing. Lars Friedrich
Optical Measurement Technology
Department of Microsystems Engineering -- IMTEK
University of Freiburg
Georges-Köhler-Allee 102
D-79110 Freiburg
Germany

phone: +49-761-203-7531
fax:   +49-761-203-7537
room:  01 088
email: lfriedri at imtek.de


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


More information about the Numpy-discussion mailing list