I’m rather new to QNX programming and i’m writing a resource manager for a framegrabber board. I have problems with returning a picture to the client.
In the endless while-loop of the main-function of my resource manager, i read from a buffer, which contains the actual picture :
bitmap=dmabuffer+(readyBuffer->start);
bitmap is declared in the header-file as unsigned char * bitmap;
In the io_read - function, i do the following :
[code]// write data to the client
if (nbytes) {
retVal.width = width;
retVal.height = height;
retVal.bpp = bpp;
retVal.bitmap=bitmap;
MsgReply(ctp->rcvid, nbytes, &retVal + off, nbytes);
// Settup POSIX start atime data
ocb->attr->flags |= IOFUNC_ATTR_ATIME | IOFUNC_ATTR_DIRTY_TIME;
// advance the lseek index vy the number of bytes read if not _IO_XTYPE_OFFSET
if (xtype == _IO_XTYPE_NONE) {
ocb->offset += nbytes;
}
// If we have returned all Data reset offset to 0
if ( nbytes >= sizeof(picCtrlStruct) ) {
ocb->offset = 0;
}
typedef struct {
unsigned char * bitmap; /*!< das Bild */
int height; /*!< Hoehe des Bildes */
int width; /*!< Breite des Bildes */
int bpp;
} picCtrlStruct;
My problem is, that the values of height, width and bpp are returned correctly, but bitmap doesn’t points to the picture. How can i return the picture ?
Ok, thanks, i understand. If i want to use solution 2, how can i setup a dma memory region ?
I think i must do something like
unsigned char *dmabuff;
and send the physical address of dmabuff to the server, but how can i get this physical address ?
And how can i map the physical address, into the virtual memory of the server. I read something about mmap_device_memory() and mmap(). Which one is the right way to do this ?