/* * ihcp_reg.h * public ioctl and default definition file for Solaris 7 and later driver * for Tahoma Technology 10115/10117 PCI hardcopy boards * * Tahoma Technology * (formerly Ikon Corporation) * 107 2nd Avenue North * Seattle, WA, USA 98109 * * 206.728.6465 * http://www.tahomatech.com * tahoma@tahomatech.com * * This driver (including source) is placed in the public domain in the * hope that it will prove useful in using and understanding Tahoma Technolgy's * 10115 and 10117 PCI hardcopy boards. * * This code is intended to be working and (relatively) bug free driver when * running on the host computers and operating systems available to Tahoma Technology. * Tahoma Technology will attempt to keep the code running on contemporary OSs * and hardware from SUN and others, but does not guarantee this. * * References to Ikon Corporation left in place for compatibility and historical reasons. * * 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 * * 9 July, 1998 modified for compatibility with 64 bit Solaris * * added ignore_minphys default parameter * * 27 May, 2004 changed name from IKON to Tahoma Technology */ /* * 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 a pointer that is used in some of the ihcp ioctl calls to provide values to * the driver ioctl routine, or return values to the calling program. It typically points * to 32 bit variables, or arrays of 32 bit variables (not 64 bit values!!). 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,int32_t) /* 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,int32_t) /* set dma timeout to arg secs */ #define IHCPIO_SET_FIFOTIME _IOW('H',3,int32_t) /* 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. * * THIS VERSION OF THE DRIVER REQUIRES THAT ARG POINTS TO AN ARRAY * OF 32 BIT VARIABLES (NOT 64 BIT VARIABLES!!!!) * * * (uint32_t uarg[19]) * * uarg[0] = device ID (high 16 bits) & vendor id (low 16 bits) * uarg[1] = revision ID * uarg[2] = PLX interrupt control/status * uarg[3] = PLX EEPROM control and user bits * uarg[4] = PLX DMA mode * uarg[5] = PLX DMA PCI address * uarg[6] = PLX DMA local address * uarg[7] = PLX DMA transfer count * uarg[8] = PLX DMA descriptor pointer * uarg[9] = PLX DMA command/status register * uarg[10]= interrupt mask * uarg[11]= mode * uarg[12]= device control * uarg[13]= interface control * uarg[14]= interface status * uarg[15]= device status * uarg[16]= reverse data * uarg[17]= auto ltr count low * uarg[18]= auto ltr count high * */ #define IHCPIO_GET_STATUS _IOR('H',5,int32_t) /* 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,int32_t) /* 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,int32_t) /* sets print/plot, spp as selected by arg */ #define IHCPIO_SET_VMODEX _IOW('H',8,int32_t) /* 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,int32_t) /* 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