pw(7) —
NAME
pw − Pixelworks Clipper Graphics Controller driver
DESCRIPTION
The Pixelworks Clipper Graphics Controller (PCGC) kernel driver is used to access the card in Graphics mode. It is the responsibility of the application to control the mode of the board (CGA or Graphics) so that CGA commands are not sent to the board when it is in Graphics mode, and Graphics commands are not sent to the board when it is in CGA emulation mode.
Write Calls
The write(2) routine is used to send a display list to the graphics card. The display list must end with a DLEND opcode. The driver will send a DLRUN command and the address of the display list to the card. The card will then be in master mode, and it will execute the display list. The entire display list must be contained in one 4096-byte page that is aligned on a page boundary. The argument to the write(2) call is the virtual address of the display list to be executed.
Ioctl Calls
The following commands are used with the ioctl(2) call:
P_CLIPOUT
This call is used to send one 16-bit word to the board. The argument to the ioctl call is the value of the word to be sent to the board.
P_CLIPIN
This call gets one 16-bit word from the board. The argument to the ioctl call is the address where the 16-bit word will be put.
P_GRAFOUT
This call causes the driver to transfer one or more words between a user-specified buffer and the graphics card. The argument to the ioctl call is the address of the pw_ioctl structure defined in pw.h:
struct pw_ioctl {
char *addr;/* address of graphics buffer */
int data;/* number of 16-bit words to transfer */
int mode;/*0 = output buffer to graphics card */
/*1 = get data from graphics card */
}
P_HRESET
This call forces the driver to flush the I/O queue and to do a hardware reset of the card.
P_RTN_VAL
This call retrieves the last interrupt reason code from the driver. The argument to the ioctl call is the address where the interrupt reason code will be located.
P_IO_INT
This call informs the driver that the next driver command (either P_GRAFOUT or P_CLIPOUT) will generate an I/O mode interrupt. I/O mode interrupts are caused by the WAIT and blt opcodes. If these opcodes are sent in I/O mode and the P_IO_INT call is not made, then the system is likely to hang because of subsequent accesses to the board while it is busy.
P_CGAON
This command turns on CGA emulation if it has been enabled with dip switches on the board. Otherwise, this command does nothing.
P_CGAOFF
This command turns off CGA emulation if it has been enabled with dip switches on the board and is currently enabled. Otherwise, this command does nothing.
P_RTN_SIG
This command instructs the driver to send a signal when an interrupt is received by the driver. This allows the application to be informed when the card completes execution of a display list. The argument to the ioctl call is the signal to send when the interrupt is received (signal(2)).
P_DLRUN
This command results in a display list being executed from the physical buffer previously allocated with P_MAPBUF. The argument to the ioctl call is the physical address of the display list to be executed. The call will return when the display list has completed execution.
P_DLRUN_NW
This command results in a display list being executed from the physical buffer previously allocated with P_MAPBUF. The argument to the ioctl call is the physical address of the display list to be executed. The call will return after the display list has been sent to the board.
P_MAPBUF
This command maps a chunk of the user’s virtual address space to the physical memory buffer allocated by the driver at boot-up time. The argument to the ioctl call is the address of the pw_ioctl structure defined in pw.h.
struct pw_ioctl {
char *addr;/* virtual address of graphics buffer */
int data;/* number of bytes to map */
int mode;/* not used */
}
It is important that the virtual address be on a page boundary, and that the byte count be an even number of pages. The size of a page in bytes is defined to be NBPP, which is defined in sys/immu.h. The physical address of the buffer is passed back in the pw_ioctl structure:
struct pw_ioctl {
char_t addr; /* physical address of graphics buffer */
int data;/* not used */
int mode;/* not used */
}
If the number of bytes to map is set to −1, then the driver will map the entire physical buffer (up to 131072 bytes) and pass back the size of the buffer in the data field in the pw_ioctl structure.
P_FREEBUF
This command unmaps the virtual address space mapped with the P_MAPBUF command.
FILES
/dev/pw0
/usr/include/pw.h
/usr/include/pw_opeds.h
SEE ALSO
Xpw(1),
close(2), ioctl(2), open(2), signal(2), write(2) in the INTERACTIVE SDS Guide and Programmer’s Reference Manual.
WARNINGS
Passing bad physical addresses or bad display lists to the controller can “hang” the system. Some commands sent to the board, such as large polygon fills and screen clears, take a long time to execute. Sending these commands with the P_GRAFOUT ioctl command can “hang” the system. It is advisable to send all display lists to the board with the P_DLRUN or P_DLRUN_NW ioctl commands.
\*U — Version 1.0