/* IKON Corporation 2617 Western Ave Seattle, WA 98121 (206) 728-6465 public ioctl and default definition file for Solaris 2.x driver for PCI hardcopy boards 31 July, 1996 start of development initial version for SPARC 17 June, 1997 added v_burst mode to set config ioctl added PLX DMA PCI ADD to GET_REGS ioctl 15 Sept, 1997 added SG_LIST_LENGTH for x86 scatter/gather dma */ /************************************************************************ * * * This driver is provided at no charge to IKON's customers * * in the hope that it will assist them in understanding and * * using IKON's PCI hardcopy interface products. This code * * is intended to be a working and (relatively!) bug free driver * * when running on the machine and OS rev available to IKON. * * IKON will attempt to keep this code running on current OS and * * hardware from SUN - and others - but does not guarantee this. * * The user is encouraged to contact IKON with comments, * * suggestions, and BUG REPORTS. * ************************************************************************/ /* the defines in this file are the "public" definitions used by the driver and the calling program included are the ioctl command codes used by the code that calls the driver, and some defaults that may be changed by editing this file and re compiling the driver this file is also used inside driver code !!! don't mess with this unless you mean it! */ #ifndef _SYS_IOCCOM_H #include #endif /* the ioctl() function call looks like: ioctl(filedescriptor,command,argument) argument is used in some of the ihcp ioctl calls to provide values to the driver ioctl routine, or return values to the calling program. In one case - data out - it contains an array of charater data to be sent to the attached device. the argument is restricted to a maximum of 255 bytes - by unix, and by the driver. the following ioctl commands are available to programs using the ihcp driver: *** legacy ioctl commands - originally for Sbus hardcopy cards *** IHCPIO_DEV_RESET reset attached device IHCPIO_SET_CONFIG select device timing,burst, and busy mode w/ value in arg IHCPIO_SET_DMATIME set dma timeout to arg seconds IHCPIO_SET_RDYTIME set fifo <1/2 full and fifo empty+device ready timeout to arg seconds IHCPIO_GET_REGS return board's registers in arg IHCPIO_GET_STATUS return device status in arg IHCPIO_GET_BOARD return board type in arg IHCPIO_SET_VMODE set versatec print/plot/spp mode using value in arg IHCPIO_SET_VMODEX same as VMODE, but clear ready sync ff - most plotters will use VMODE - both for versatec only IHCPIO_V_CMD send pulse command to plotter using value in arg (versatec only) IHCPIO_DATA_OUT send data bytes from arg array to device. byte count in IHCPIO_COUNT_MASK portion of cmd IHCPIO_RDY_WAIT wait for fifo empty and device ready IHCPIO_HALF_WAIT wait for fifo less than 1/2 full IHCPIO_STREAM_ON select data streaming mode (centronics only) IHCPIO_STREAM_OFF clear data streaming mode IHCPIO_GET_FLAGS returns unit_flags in arg IHCPIO_GET_FIFO returns fifo status in arg IHCPIO_MASTER_CLEAR resets board and clears fifo FACTORY USE ONLY! IHCPIO_SOFT_ACK simulates ack sequence from device *** new ioctl commands for PCI hardcopy cards ** IHCPIO_AUTO_LTR_COUNT set automatic line terminate byte count (line length) to arg bytes IHCPIO_AUTO_LTR_ON enable automatic line terminate IHCPIO_AUTO_LTR_OFF disable auto line terminate IHCPIO_DEV_AND_VEND_ID return board device and vendor ids in arg IHCPIO_REVISION_ID return board revision level in arg IHCPIO_LITTLE_ENDIAN set little endian mode - plotter data will go low byte first IHCPIO_BIG_ENDIAN set big endian mode - plotter data will go high byte first ioctls to allow direct fiddling of mode and device control IHCPIO_DIRECT_MODE direct write arg to mode register IHCPIO_DEVICE_CONTROL direct write arg to device control IHCPIO_INTERFACE_STATUS direct read of interface status register returned in arg IHCPIO_DEVICE_STATUS direct read of device status register returned in arg IHCPIO_REVERSE_DATA read of reverse data register returned in arg */ /* the ioctl command codes conform to the unix pattern: the top 3 bits of the 32 bit value indicate whether arguments are to be copied in, copied out, both, or neither. 0x80000000 = copy in 0x40000000 = copy out 0x20000000 = no argument transfer 0xC0000000 = copy in and out the number of bytes in the argument is encoded in the lower 8 bits of the upper half of the u_int, and the actual command is encoded in the lower half. a rather arbitrary character, which is intended to identify the driver, is also encoded in the lower half of the command. it becomes part of the command value. for all commands except DATA_OUT, the arg length is part of the command value. WHEN USINT THE IHCP_DATA_OUT IOCTL, THE CALLING PROGRAM IS REQUIRED TO COMBINE THE ARGUMENT LENGTH WITH THE IOCTL COMMAND AS FOLLOWS: cmd = IHCP_DATA_OUT | ( ( arg_length & 0xFF ) << 16 ) ; commands which require arguments - in or out - will pass those values as 32 bit unsigned integers. the only exception is the DATA_OUT ioctl, which uses an array of up to 255 bytes as its argument. the magic character that identifies this driver is hereby (arbitrarily) chosen to be 'H'. the following ioctl commands are defined using pre-existing ioctl command macros. the CMD_MASK and COUNT_MASK values defined MUST match the usage in ioccom.h. refer to that include file for further information. ADDITIONAL IOCTL COMMANDS AND ARGUMENTS ARE FOUND AT THE END OF THIS FILE. THEY ARE INCLUDED FOR COMPATIBILITY WITH SUN AND VERSATEC DRIVERS FOR THE 10088 VME BOARD, AND WILL HOPEFULLY BE COMPATIBLE WITH OTHER MANUFACTURERS BOARDS AND DRIVERS (SHOULD THERE BE ANY!) the "magic character" for these commands is "v" */ #define IHCPIO_CMD_MASK 0x0000FFFF /* cmd in top 3 and bottom 16 bits */ /* only the bottom 16 bits are */ /* used in this version to try to */ /* maintain compatibility with */ /* versatec's latest drivers */ #define IHCPIO_COUNT_MASK 0x00FF0000 /* arg byte count here */ /* THE SOLARIS 2.0 MACROS IN ioccom.h WANT THE 'MAGIC LETTER' QUOTED. THE SOLARIS 1.X MACROS WANTED IT WITHOUT QUOTES. SOME VERSIONS OF ioccom.h DIDN'T INCLUDE _IORN AND _IOWN. SOL2 SEEMS TO HAVE THEM */ #define IHCPIO_DEV_RESET _IO('H',0) /* reset attached device */ /* sets & resets latched reset */ #define IHCPIO_SET_CONFIG _IOW('H',1,int) /* arg bits set configuration */ /* the config bit patterns use those defined for the Sbus card - even though they don't match the PCI card's bit posistions. this is done to try to preserve compatibility between applications the first version of this driver doesn't try to support all the possible modes available in the PCI card. */ /* *** legacy bits **** */ #define IHCPIO_SPEED0 0x00 /* slowest device speed */ #define IHCPIO_SPEED1 0x04 #define IHCPIO_SPEED2 0x08 #define IHCPIO_SPEED3 0x0C /*fastest device timing */ #define IHCPIO_IGNORE_BUSY 0x80 /* ignore centr busy */ /* *** new for PCI *** */ #define IHCPIO_BUSY_HANDSHAKE 0x100 /* use BUSY instead of ACK */ #define IHCPIO_4_EDGE 0x200 /* use four edge handshake */ #define IHCPIO_V_BURST 0x400 /* select synch burst mode only */ /* available on some new v-tech */ /* and requires pld218B or later*/ #define IHCPIO_SET_DMATIME _IOW('H',2,int) /* set dma timeout to arg secs */ #define IHCPIO_SET_FIFOTIME _IOW('H',3,int) /* set wait for <1/2 full or */ /* empty and dev rdy timeout */ /* to arg seconds */ #define IHCPIO_GET_REGS _IORN('H',4,76) /* puts all regs in arg array */ /* returns all "IHCP" registers and some of the "PLX" registers. also returns the device IDs and revision level. PLX registers are all 32 bits wide. IHCP registers are 8 bits wide. each is returned in a 32 bit longword as shown below. the DMA registers returned are either channel 0 or 1, depending on which is used in the particular revision of the board. (u_long larg[19]) larg[0] = device ID (high 16 bits) & vendor id (low 16 bits) larg[1] = revision ID larg[2] = PLX interrupt control/status larg[3] = PLX EEPROM control and user bits larg[4] = PLX DMA mode larg[5] = PLX DMA PCI address larg[6] = PLX DMA local address larg[7] = PLX DMA transfer count larg[8] = PLX DMA descriptor pointer larg[9] = PLX DMA command/status register larg[10]= interrupt mask larg[11]= mode larg[12]= device control larg[13]= interface control larg[14]= interface status larg[15]= device status larg[16]= reverse data larg[17]= auto ltr count low larg[18]= auto ltr count high */ #define IHCPIO_GET_STATUS _IOR('H',5,int) /* returns FORMATTED device */ /* status in arg */ #define IHCPIO_DEV_RDY 0x00000010 /* v-rdy or centr ack asserted*/ #define IHCPIO_DEV_BUSY 0x00000008 /* centronics asserting busy */ #define IHCPIO_DEV_FAULT 0x00000004 /* centronics asserting fault */ #define IHCPIO_DEV_POUT 0x00000002 /* v or c no paper */ #define IHCPIO_DEV_SEL 0x00000001 /* v online or c selected */ #define IHCPIO_GET_BOARD _IOR('H',6,int) /* gets board strapping - sbus compatibility */ /* strapping bits returned in arg */ #define IHCPIO_VERS_DIFF 0x000000A0 /* versatec differential */ #define IHCPIO_VERS_TTL 0x00000060 /* versatec ttl */ #define IHCPIO_CENT 0x000000C0 /* centronics */ #define IHCPIO_SET_VMODE _IOW('H',7,int) /* sets print/plot, spp as selected by arg */ #define IHCPIO_SET_VMODEX _IOW('H',8,int) /* same as above for PCI boards */ #define IHCPIO_V_SPP 0x00000002 /* sets spp w/MODE(X) */ #define IHCPIO_V_PLOT 0x00000001 /* sets plot mode w/MODE(X)*/ #define IHCPIO_V_NPRINT 0x00000000 /* 0 = normal print mode */ #define IHCPIO_V_CMD _IOW('H',9,int) /* pulse commands to versatec selected by arg */ #define IHCPIO_VLTR 0x00000000 /* remote line terminate*/ #define IHCPIO_VEOT 0x00000001 /* remote eot */ #define IHCPIO_VFED 0x00000002 /* remote form feed */ #define IHCPIO_VCLR 0x00000003 /* remote buffer clear */ #define IHCPIO_DATA_OUT _IOWN('H',10,0) /* CALLING PGM WILL AND IN THE */ /* ACTUAL CHARACTER COUNT - DONE*/ /* THIS WAY SO COUNT CAN BE A */ /* VARAIBLE, NOT CONSTANT !!! */ /* see ioctl description above */ /* sends char array in arg to */ /* fifo if room. if not - return*/ /* EINVAL. will flag error if */ /* caller tries to send more */ /* 255 bytes, or if fifo becomes*/ /* full during transfers. */ #define IHCPIO_RDY_WAIT _IO('H',11) /* waits for fifo empty and */ /* device ready */ #define IHCPIO_HALF_WAIT _IO('H',12) /* wait for fifo