sif_lowmembuf_nw(3) CLIX sif_lowmembuf_nw(3)
NAME
sif_lowmembuf_nw - Provides buffer to transfer data from scanner to memory
LIBRARY
Intergraph XIO Library (libix.a)
SYNOPSIS
#include <sys/xio/xerr.h>
#include <sys/xio/xio.h>
int sif_lowmembuf_nw(
int channel ,
int efn ,
char *dbuf ,
struct xiosb *xiosb );
PARAMETERS
channel Specifies which Scanner Interface (SIF) board is to use the
buffer being passed. The channel numbers start with 0.
Therefore, the largest valid channel is one less than the number
of SIF boards in the system.
dbuf Points to the buffer data is being transferred to. The buffer
must begin on a 4 megabyte boundary. The transfer size for each
buffer is fixed at 4 megabytes except for the final buffer. For
example, if the original transfer size is set to 17 megabytes in
sif_scan_mem_nw(), sif_lowmem_buf() must be called 5 times. The
first 4 buffers must be 4 megabytes each. The final buffer must
be 1 megabyte.
xiosb Points to the xiosb structure updated when the request
completes. (See intro(3).)
efn Specifies the event flag number associated with the request.
DESCRIPTION
The sif_lowmembuf_nw() function is used in conjunction with
sif_scan_mem_nw() to provide a mechanism for transferring data directly
from the scanner to virtual memory. The low memory mode is intended for
machines with a limited amount of memory. In this mode a section of
memory may be used to receive part of the data. The data can be processed
while more data is being received to another section of memory. The
second section of memory can then be processed while the first section
receives new data. Large amounts of data can be received with a
relatively small amount of memory. The channel parameter must have been
2/94 - Intergraph Corporation 1
sif_lowmembuf_nw(3) CLIX sif_lowmembuf_nw(3)
opened with sif_open() and sif_setup() must have been called setting the
driver into low memory mode. Also, sif_scan_mem_nw() must have been
called to initiate the transfer.
EXAMPLES
The following example shows partial code for using multiple buffers:
char buf[0x90000]; /* enough space for two buffers */
char *bf[2];
int efn[2];
struct xiosb xiosb[2];
/*
Open sif device, do initialization code & put driver into
low memory mode using sif_setup()
*/
bf[0] = (buf + 0x3fffff) & ~0x3fffff; /* Align on 4 Meg boundary */
bf[1] = bf[0] + 0x400000;
/*
* Setup transfer for 17 Megabytes
*/
cnt = 0x1100000;
err = sif_scan_mem_nw(chan, cnt, 0, main_efn, 0, &main_xiosb);
/*
* start transfer to 1st buffer
*/
err = sif_low_mem_buf_nw(chan, efn[0], bf[0], &xiosb[0]);
indx = 0;
for(i = 0x400000; i < cnt; i += 0x400000) {
last_indx = indx;
indx = 1 - indx; /* toggle between buffers */
/*
* pass driver next buffer to user
*/
err = sif_lowmem_buf_nw(chan, efn[indx], bf[indx], &xiosb[indx]);
/*
wait for previous buffer to finish (efn[last_indx])
check for errors (xiosb[last_indx])
process buffer (bf[last_indx])
*/
}
2 Intergraph Corporation - 2/94
sif_lowmembuf_nw(3) CLIX sif_lowmembuf_nw(3)
/*
wait for last buffer to finish & wait for
sif_low_mem_buf_nw to finish (main_efn)
check for errors & process last buffer
*/
FILES
/usr/include/sys/xio/xerr.h
XIO error file
CAUTIONS
After the first sif_lowmembuf_nw() call is made the system will start
filling the buffer with data. It is the responsibility of the application
to ensure another buffer is available (if needed) when the current buffer
becomes full, since a second buffer will be required before notification
is made that the first buffer is full.
RETURN VALUES
If the XIO system accepts the asynchronous request, the request will
return a value of 0. Otherwise, XIO_FAILURE is returned. Upon completion
of an accepted request, the status member of the xiosb structure is set to
0 if successful, or to one of the failure codes listed in the ERRORS
section if unsuccessful.
ERRORS
The sif_lowmembuf_nw() function fails if one of the following is true:
[XIO_FAILURE]
The system does not contain the driver needed to support this
request or efn is invalid.
[SIF_CHANNEL_INVALID]
The specified channel is beyond the maximum allowed.
[SIF_CHANNEL_NOT_OPEN]
The specified channel is not open for this process.
[BAD_DATA_BUFFER_ADDRESS]
The data buffer is either not on a 4 megabyte boundary or points to
a nonwritable memory space.
[PAGE_LOCK_FAILED]
Not enough physical memory for this request is available at this
time.
[SIF_CANCELED]
2/94 - Intergraph Corporation 3
sif_lowmembuf_nw(3) CLIX sif_lowmembuf_nw(3)
The request was canceled with sif_cancel() or sif_close().
[SIF_NOLOWMEM_ERROR]
There are no sif_scan_mem_nw() requests either in progress or in
the queue that require a buffer.
RELATED INFORMATION
Functions: intro(3), sif_open(3), sif_close(3), sif_setup(3),
sif_cancel(3)
Files: xsif(7)
4 Intergraph Corporation - 2/94