fg_alloc(3) CLIX fg_alloc(3)
NAME
fg_alloc - Allocates a frame grabber
LIBRARY
Intergraph Device Library (libix.a)
SYNOPSIS
#include <sys/xio/xerr.h>
#include <sys/xio/xfg.h>
int fg_alloc(
int fgno ,
struct fg_info *info ,
int excl );
PARAMETERS
fgno The location of the frame grabber on the Shared Resource (SR) Bus.
info A pointer to an fg_info structure
excl Exclusive access flag
DESCRIPTION
The fg_alloc() function allocates a frame grabber for an application to
use. If excl is nonzero, the calling process has exclusive access to the
frame grabber until it deallocates the frame grabber or the process exits.
If excl is 0, another process may allocate the same frame grabber.
The fgno parameter specifies the location of the frame grabber on the
Shared Resource (SR) Bus. The frame grabber in the lowest SR Bus slot
will be addressed by 0. This number is used with all subsequent calls.
The info parameter points to an fg_info structure as defined in the header
file <sys/xio/xfg.h>:
struct fg_info {
int i_slot; /* frame grabber hardware slot number */
long *i_fb0_addr; /* frame buffer 0 address */
long *i_fb1_addr; /* frame buffer 1 address */
}
The info structure will be filled in upon return by fg_alloc(). The
i_fb0_addr and i_fb1_addr members point to the virtual addresses of frame
buffers 0 and 1 (respectively) of the frame grabber. Each buffer consists
of 256K longwords organized as an array of 512 x 512, 32-bit pixels. The
2/94 - Intergraph Corporation 1
fg_alloc(3) CLIX fg_alloc(3)
format for each 32-bit pixel is as follows:
Byte Description
0 red color component
1 green color component
2 blue color component
3 not used
CAUTIONS
Cooperation among processes must occur when sharing a frame grabber.
RETURN VALUES
Upon successful completion, a value of 0 is returned. Otherwise, one of
the failureollowing codes is returned.
ERRORS
The fg_alloc() function will fail if one of the following are true:
[XIO_FAILURE]
The system does not contain the driver needed to support this
request.
[FG_NOT_PRESENT]
A frame grabber is not available for allocation.
[BAD_DATA_BUFFER_ADDRESS]
The info or fgno parameter points to a nonwritable memory address.
[FG_BUSY]
Another user allocated the frame grabber for exclusive use. Or,
this call requested exclusive use and another process allocated the
frame grabber for nonexclusive use.
[FG_RESOURCE_ERROR]
Not enough virtual memory is available to map the frame buffer into
the user's memory space.
RELATED INFORMATION
Functions: fg_dealloc(3)
2 Intergraph Corporation - 2/94