Home
Linux Device Driver User Manual
Contents
1. ypedef struct SIO4InitChan S104 MODE eMode UINT32 u32BaudRate ENABLE TYPE eRxEnable DATA FORMAT eRxDataFormat CHAR LENGTH eRxDataLength UINT8 u8RxParityEnable PARITY TYPE eRxParityType ENABLE TYPE eTxEnable DATA FORMAT eTxDataFormat CHAR LENGTH eTxDataLength UINT8 u8TxParityEnable PARITY TYPE eTxParityType IDLE LINE COND eTxIdleLineCond UINT8 u8TxWaitOnUnderrun UINT8 u8EnableRxUpper UINT8 u8EnableRxLower UINT8 u8EnableTxUpper UINT8 u8EnableTxLower UINT16 ul6TxAlmostEmpty UINT16 ul6TxAlmostFull UINT16 ul6RxAlmostEmpty UINT16 ul6RxAlmostFull UINT8 u8EnableTxCableUpper UINT8 u8EnableTxCableLower UINT8 u8EnableRxCableUpper UINT8 u8EnableRxCableLower SIO4 INIT CHAN Fields Description eMode This specifies the communications protocol u32BaudRate This specifies the baud rate eRxEnable This specifies the receiver enable state eRxDataFormat This specifies the receive data encoding format eRxDataLength This specifies the receive data length in bits 41 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual u8RxParityEnable This enables or disable receiver parity Zero 0 disables parity and one 1 enables it eRxParityType This specifies the re
2. Values Description ALL ONES IDLE Send out all ones ALL ZEROS IDLE Send out all zeroes ALTERNATE 1 AND 0 IDLE Send out alternating ones and zeroes ALTERNATE MARK AND SPACE IDLE Send out alternating marks and spaces MARK IDLE Send out all marks RESERVED IDLE Reserved Do not use SPACE IDLE Send out all spaces SYNC_FLAG NORMAL IDL Gl Send out the default for the selected protocol 3 2 13 PARITY_TYPE This enumeration defines the possible receiver and transmitter data parity options NOTE Another component is used to enable or disable the use or parity Definition typedef enum ParityType PARITY TYPI El Values Description EVEN PARITY Utilize Even parity ODD PARITY Utilize Odd parity MARK PARITY Utilize Mark parity SPACE PARITY Utilize Space parity 3 2 14 RCV ASYNC PROTOCOL This structure defines the available receiver parameters for the Asynchronous protocol Definition typedef struct RcvASYNCProtocol T CLOCK RATE eRxClockRate 38 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual RCV ASYNC PROTOCOL Fields Description eRxClockRate This configures the receiver s clock source divisor 3 2 15 RCV HDLC PROTOCOL This structure defines the available receiver parameters for the HDLC protocol Defi
3. Usage ioctl Argument Description request SIO4 RX IO MODE CONFIG arg 832 Example include lt errno h gt 82 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual lt stdio h gt lt unistd h gt lt sys ioctl h gt include include include include SIO4DocSrcLib h int sio4 int status status ioctl fd SIO4 RX IO MODE if get get 0 set if verbose amp amp status 1 printf ioctl failure errno return status 3 4 45 SIO4_RXC_USC_CONFIG rx io mode config int fd s32 set _ s32 get CONFIG Sd n int verbose amp set errno This service configures the channel s use of the USC RxC signal and retrieves its current configuration If one of the predefined configurations is requested it is applied If the corresponding XXX READ macro is supplied then the current configuration is not changed Before returning the current configuration is obtained and reported to the caller If the feature is unsupported then the corresponding XXX UNKNOWN macro is returned If the feature is supported but the configuration is invalid then the corresponding XXX INVALID macro is returned Usage ioctl Argument Description request SIO4 RXC USC CONFIG arg s32 Example lt errno h gt lt stdio h gt lt unistd h gt lt sys ioctl h gt include include include inc
4. SIO4 USC TSR Transmit Sync Register TSR 3 1 6 SIO4_ BOARD_JUMPERS Options This set of macros gives the predefined options available for the STO4 BOARD JUMPERS IOCTL service Macros Description SIO4 BOARD JUMPERS UNSUPPORTED The board jumpers are unsupported on the reference board 3 1 7 SIOA CABLE CONFIG Options This set of macros defines the options available for the S104 CABLI E CONFIG IOCTL service see page 53 The signals referred to in the table are the data and clock signals for the transmitter and the receiver Also lower refers to the cable pins designated as lower pins and upper refers to th to the header sio4 h for additional utility macros 28 General Standards Corporation Phone e cable pins designated as upper pins Refer 256 880 8787 SIO4 Linux Device Driver User Manual Macros set and get options Description SIO4 CABLE CONFIG TXDIS RXDIS The Tx and Rx signals are disabled SIO4 CABLE CONFIG TXDIS RXLWR The Tx signals are disabled and the Rx lower signals are enabled SIO4 CABLE CONFIG TXDIS RXUPR The Tx signals are disabled and the Rx upper signals are enabled S104 CABLE CONFIG TXLWR RXDIS The Tx lower signals are enabled and the Rx signals are disabled SIO4 CABLE CONFIG TXLWR RXUPR The Tx lower signals are enabled and the Rx upper signals are enabled S104 CABLE CONFIG TXUPR RXDIS The Tx upper signals
5. Usage ioctl Argument Description request SIO4 DCD CABLE CONFIG arg __832 see page 29 for valid values Example include lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 dcd cable config int fd _ s32 set 55 __s32 get int verbose General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual int status SIO4 DCD CABL status ioctl fd if get get 0 set if verbose amp amp status failure printf ioctl return status 3 4 6 SIO4_ ENABLE BRGO This service enables or disables the USC channel s Baud Rate Generator 0 BRGO is enabled by a value of TRUE and disabled by a value of FALSE Usage ioctl Argument Description request SIO4 ENABLE BRGO arg UINT8 Example include lt errno h gt tinclude lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include int sio4 int status SIOADocSrcLib h _brg0 enable int fd dej errno int enable status ioctl fd SIO4 ENABLE BRGO if verbose amp amp status 1 printf ioctl failure errno return status 3 4 7 SIO4_ENABLE_BRG1 This service enables or disables the USC channels Baud Rate Generator 1 BRGI is enabled by a value of TRUE and disabled by a value of
6. status ioctl fd SIO4 SET TX CLOCK SOURCE source if verbose amp amp status 1 printf ioctl failure errno d n errno 95 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual return status 3 4 65 SIO4_SET_WRITE_TIMEOUT This service sets the timeout limit for write requests and is the maximum amount of time the driver will wait for a blocking write request to complete The timeout period is specified in seconds Timeout values of zero 0 or less mean do not wait Usage ioctl Argument Description request S104 SET WRITE TIMEOUT arg SINT32 Example include lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 timeout set write int fd UINT32 timeout int verbose int status status ioctl fd SIO4 SET WRITE TIMEOUT timeout if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 66 SIO4_ SET XMT ASYNC PROT This service configures the transmitter specific Asynchronous parameters Usage ioctl Argument Description request SIO4 SET XMT ASYNC PROT arg XMT ASYNC PROTOCOL Example tinclude lt errno h gt tinclude lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLi
7. sio4app4 c C lt 1xxx gt lt m gt lt n gt index The application will report board identification information then perform a series of automated tests Each test cycle should complete in less than five minutes 2 9 5 asyncc2c This sample application performs asynchronous data transfer between two SIO4 channels specified on the command line It can be used as the starting point for any application development on top of the SIO4 Linux device driver The files are installed into the directory usr src linux drivers sio4 asyncc2c This application includes the below listed files File Description EUG These are the sources which implement the functionality specific to this application async h This is the configuration header defining all of the relevant parameter options asyncc2c This is a pre built version of the application main h This is the application s common header file makefile This is the driver make file makefile dep This is a make dependency file This is updated automatically 21 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual 2 9 5 1 Build Follow the below steps to build rebuild the sample application 1 Change to the directory where the sample application was installed This should be usr src linux drivers sio4 asyncc2c 2 Build the sample application by issuing the below command make clean all 2 9 5
8. 3 4 16 SIO4_MP_INFO This service returns information about the current Multi Protocol transceiver configuration All field contents are ignored and are set by the driver according to the current configuration Refer to the Multi Protocol transceiver programming information later in this document for more information Usage ioctl Argument request arg Description SIO4 MP INFO sio4 mp t Example lt errno h gt lt stdio h gt lt unistd h gt lt sys ioctl h gt include include include include include SIO4DocSrcLib h int sio4 mp info int fd _u32 chip int verbose 32 got mp status sio4 mp t int status ioctl fd SIO4 MP INFO amp mp if chip chip 0 mp chip if got got 0 mp prot got if verbose amp amp status 1 printf ioctl failure errno Sd n errno 63 General Standards Corporation Phone 256 880 8787 return status 3 4 17 SIO4_MP_INIT SIO4 Linux Device Driver User Manual This service initializes the board s Multi Protocol transceiver feature This returns the Multi Protocol transceivers to their initial power up state The results are recorded in the data structure s prot_got field Refer to the Multi Protocol transceiver programming information later in this document for more information Usage ioctl Argument Description request SIO4 MP INIT arg
9. AM aEIxMIxE SIO4 PCI ML PCI Max Lat Register PCIMLR SIO4 PCI REV PCI Revision ID Register PCIREV SIO4 PCI SID PCI Subsystem ID Register PCISID SIO4 PCI SR PCI Status Register PCISR SIO4 PCI SVID PCI Subsystem Vendor ID Register PCISVID SIO4 PCI VID PCI Vendor ID Register PCIVIDR NOTE A PCIVIDR value of 0x10B5 and a PCIDIDR value of 0x9080 identify the PCI interface chip as a PLX PCI9080 A PCISVID value of 0x10B5 identifies that the PCISID was assigned by PLX A PCISID value of 0x2401 identifies the SIO4 3 1 5 3 PLX Feature Set Registers The following table gives the complete set of PLX Feature Set Registers which are the feature specific registers implemented by the PLX PCI9080 The PLX PCI9080 is the PCI bridge chip used on the SIO4 For detailed definitions of these registers refer to the PCI9080 Data Book All PLX registers are accessed by their native data size Since the interface permits retrieval only of 32 bit values the insignificant upper bits can be ignored and should be zero Local Configuration Registers Macros Description SIO4 PLX BIGEN D Big Little Endian Descriptor Register BIGEND SIO4 PLX EROMBA Expansion ROM Local Base Address Register EROMBA SIO4 PLX EROMR R Expansion ROM Range Register EROMRR PCI Configuration Address Register for Direct Master to PCI IO CFG DMCFGA Loca
10. FIFO Full USC CTS Cable DCD Figure 5 Cable CTS signal routing options 110 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual 4 1 5 DCD The SIO4 includes a DCD cable signal DCD though it is not always used The signal may be configured for multiple operating modes as either an input or an output The table below identifies the driver services used to configure routing of the DCD signal Signal Description Driver Service DCD This can be configured to function in any of the listed modes SIO4 DCD CABLE CONFIG IOCTL page 55 options page 29 Disable Hi m ol Low m Cable DCD Rx Almost RTS FIFO Full e DCD bene as ale CTS Figure 6 Cable DCD signal routing options 4 2 I O Modes The following describes the three supported I O modes used for data transfer between the host and the SIO4 All three modes are available using the C library routines read and write Applications select the desired mode using IOCTL services Use the SIO4 TX IO MODE CONFIG IOCTL service to configure the write data transfer mode and use the SIO4 RX IO MODE CONFIG IOCTL service to configure the read data transfer mode 4 2 1 DMDMA This refers to Demand Mo
11. Lr MSB FIRST CMD Transmit and receive the Most Significant Bit first Lr STRAIGHT CM D Do not use on the SIO4 Lr SWAPPED CMD Do not use on the SIO4 LOAD DMA CMD Do not use on the SIO4 RIG RX DMA CMD Initiate a USC to FIFO DMA transfer RIG RX TX DMA CMD Perform both of the two above actions Si Si Si Si TRIG CHAN T T T RIG TX DMA CMD Initiate a FIFO to USC DMA transfer TX FIFO PURGE 3 2 20 SIO4 DRIVER INFO CMD Purge the USC channel s internal transmit data FIFO This structure defines the data fields for the information returned by the SIO4 GET DRIVER INFO IOCTL service 40 General Standards Corporation Phone 256 880 8787 Definition SIO4 Linux Device Driver User Manual typedef struct SIO4DriverIlnfo UINT8 UINT8 u8VersionNumber 8 u8Built 32 SIO4 DRIVER INFO Fields Description u8VersionNumber This field gives the driver version number as a string in the form of X XX u8Built This field gives the driver build date and time as a string It is given in the C formofprintf s s DATE TIME 3 2 21 SIO4_INIT_CHAN This structure defines the data fields applicable to USC protocol independent initialization of a serial channel Definition t
12. This set of macros defines the options available for the SIO4 TX IO MODE CONFIG and SIO4 RX IO MODE CONFIG IOCTL services Macros Description SIO4 TO MODE DEFAULT This refers to the default I O mode which is PIO SIO4 IO MODE DMA This refers to DMA which is generally performed without regard to the FIFO s content SIO4 IO MODE DMDMA This refers to Demand Mode DMA which transfers data according to the FIFO s content SIO4 IO MODE PIO This refers to PIO which uses repetitive register accesses SIO4 IO MODE READ When provided to the services this requests the current setting 3 1 14 SIO4 RX CABLE CONFIG Options This set of macros defines the options available for the SIO4 RX CABLE CONFIG IOCTL service Macros set and get options Description SIO4 RX CAB E CONFIG DISABL E The receiver is disconnected from the cable SIO4 RX CABLE CONFIG LOWER The receiver is connected to the lower cable portion E E SIO4 RX CABLE CONFIG UPPER The receiver is connected to the upper cable portion Macros set only options Description SIO4 RX CAB E CONFIG READ Retrieve the current configuration Macros get only options Description SIO4 RX CAB E CONFIG INVALID The current configuration is invalid 31 General Standards Corpora
13. if verbose amp amp status printf ioctl failure return status 3 4 53 SIO4_SET_CTR1_SOURCE errno E src int verbose d n errno This service sets the USC channel s Counter 1 clock source The only CLOCK_ SOURCE enumeration values that are valid options for this IOCTL are those listed below e Disable the counter e The RxC pin e The TxC pin Usage ioctl Argument Description request SIO4 SET CTR1 SOURCE arg CLOCK SOURCE Example include lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 ctrl set clock source int fd 88 CLOCK SOURC E src int verbose T General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual int status status ioctl fd SIO4 SET CTR1_SOURCE src if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 54 SIO4_SET_USC_DMA_OPTIONS This service configures the USC channel s DMA feature for data transfer between the USC and the external FIFOs In addition to configuring the parameters referenced by the structure this service configures the necessary USC I O pins to permit proper USC FIFO DMA data transfer Usage ioctl Argument Description request SIO4 SET USC D
14. Argument Description request SIO4 TX CABLE DATA CONFIG arg s32 see page 33 for valid values Example include lt errno h gt include lt stdio h gt 100 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual include lt unistd h gt include lt sys ioctl h gt include STO4DocSrcLib h int sio4 tx cable data config int fd 32 set s32 get int verbose int status status ioctl fd SIO4 TX CABLE DATA CONFIG amp set if get get 0 set if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 73 SIO4 TX FIFO AE CONFIG This service configures the Tx FIFO Almost Empty level and reports the current level When applying a setting the Tx FIFO is reset and the current content is lost If the corresponding XXX READ macro is supplied then no change is applied Before returning the current programmed level is obtained and supplied to the caller Usage ioctl Argument Description request SIO4 TX FIFO AE CONFIG arg s32 Example tinclude lt errno h gt tinclude lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 tx fifo ae config int fd s32 set _ s32 get int verbose int status status ioctl fd SIO4 TX FIFO AE CONFIG amp set if get get 0 set if verbose
15. RCV HDLC PROTOCOL in de de de de de o4 lt errno h gt lt stdio h gt lt unistd h gt lt sys ioctl h gt STO4DocSrcLib h hdlc setup rx int t fd parm status parm eAddrSearchMode parm u816BitControll parm u8LogicalControll status ioctl fd Enable Enable SIO4 Sl ON 1 0 E BYT 92 Sd n int verbose ET RCV HDLC PROT int verbose amp parm errno E NO CTRL amp parm General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 60 SIO4_SET_RCV_ISOCHR_PROT This service configures the receiver specific Isochronous parameters Usage ioctl Argument Description request SIO4 SET RCV ISOCHR PROT arg Not used Example tinclude lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 isochr setup rx int fd int verbose int status status ioctl fd SIO4 SET RCV ISOCHR PROT if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 61 SIO4_SET_READ_TIMEOUT This service sets the timeout limit for read requests and is the maximum amount of time the driver will wait for a blocking read requ
16. amp amp status 1 printf ioctl failure errno d n errno 101 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual return status 3 4 74 SIO4_TX_FIFO_AF_CONFIG This service configures the Tx FIFO Almost Full level and reports the current level When applying a setting the Tx FIFO is reset and the current content is lost If the corresponding XXX_READ macro is supplied then no change is applied Before returning the current programmed level is obtained and supplied to the caller Usage ioctl Argument Description request SIO4 TX FIFO AF CONFIG arg s32 Example tinclude lt errno h gt tinclude lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 tx fifo af config int fd _s32 set _ s32 get int verbose int status status ioctl fd SIO4 TX FIFO AF CONFIG amp set if get get 0 set if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 75 SIO4 TX FIFO COUNT This service retrieves the current Tx FIFO fill level The value obtained is either the number of bytes of data in the Tx FIFO or the corresponding XXX UNKNOWN macro if the Tx FIFO Count Register is unsupported Usage ioctl Argument Description request SIO4 TX FIFO COUNT arg s32 Example inc
17. usr src linux drivers sio4 app3 Start the test application by issuing the command given below The c argument lower case requests continuous testing until a test error occurs The C argument upper case requests continuous testing without regard to test error The m argument requests that continuous testing run for at most minutes where is a decimal number The n argument requests that continuous testing run for at most tests where is a decimal number The index argument is the zero based index of the board to be accessed All arguments are optional sio4app3 c C lt m gt lt n gt index The application will report board identification information then perform a series of automated tests Each test cycle should complete in less than one minute 2 9 4 sio4app4 This sample starting point application performs an automated test of a small number of IOCTL service It can be used as the for any application development on top of the SIO4 Linux device driver The files are installed into the directory usr src linux drivers sio4 app4 This application includes the below listed files Xu These are the sources which implement the IOCTL test code Most contain functionality based on the file s base name 20 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual main h This is a header used by application makefile This is t
18. 3 1 1 FIFO Count Options This set of macros gives the predefined options returned by the SIO4 TX FIFO COUNT and SIO4 RX FIFO COUNT IOCTL services Other values returned reflect the FIFO s current fill level Macros Description SIO4 FIFO COUNT UNKNOWN The FIFO fill level is unknown 3 1 2 FIFO Size Options This set of macros gives the predefined options returned by the SIO4 TX FIFO SIZE and SIO4_ RX FIFO SIZE IOCTL services Other values returned reflect the actual size of the respective FIFO s Macros Description SIO4 FIFO SIZE UNKNOWN The FIFO size is unknown 3 1 3 FIFO Type Options This set of macros defines the options returned by the SIO4 TX FIFO TYPE and SI04 RX FIFO TYPE IOCTL services 24 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual Macros Description SIO4 FIFO TYPE HARD The FIFO consists of hardware chips located on the board SIO4 FIFO TYPE SOFT The FIFO consists of firmware logic inside the FPGA SIO4 FIFO TYP E UNKNOWN The FIFO type is unknown 3 1 4 IOCTL The IOCTL macros are documented following the function call descriptions 3 1 5 Registers The following table gives the complete set of SIO4 registers The tables are divided by register categories 3 1 5 1 GSC Registers The following table gives the complete set of GSC specific SIO4 registers
19. BITS1 Data values consist of one bit each 34 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual BITS2 Data values consist of two bits each BITS3 Data values consist of three bits each BITS4 Data values consist of four bits each BITS Data values consist of five bits each BITS6 Data values consist of six bits each BITS7 Data values consist of seven bits each BITS8 Data values consist of eight bits each 3 2 4 CLOCK_RATE This enumeration defines the receiver s and transmitter s possible clock rate divisor options for use with the Asynchronous protocol This effectively defines the length of each data bit Definition typedef enum ClockRate CLOCK RATE Values Description RATE Reserved Do not use Divide the source clock by 16 Divide the source clock by 32 Divide the source clock by 64 3 2 5 CLOCK_SOURCE This enumeration defines all possible clock source options within each USC channel s clocking logic circuit While the enumerated values are all encompassing some clock source options are applicable only to certain clock source recipients Definition typedef enum ClockSource CLOCK SOURC E Values Description BRGO CLOCK Select the BRGO output as the clock source BRG1 CLOCK Select the BRG1 output as the clock sourc
20. int_stat int verbose 72 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual int status status ioctl fd SIO4 READ INT STATUS int stat if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 29 SIO4_READ_REGISTER This service reads the value of an SIO4 register This includes all PCI registers all PLX feature set registers all GSC firmware registers and all USC registers for the referenced channel Refer to the SIO4 User Manual and to sio4 h for a complete list of the available registers Usage ioctl Argument Description request SIO4 READ REGISTER REGISTER PARAMS Example include lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 reg read int fd _u32 reg _ u32 value int verbose REGISTER PARAMS parm int status parm u32RegisterNumber reg parm u32Value OxDEADBEEFL status ioctl fd SIO4 READ REGISTER amp parm value 0 parm u32Value if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 30 SIO4_READ_REGISTER_RAW This service reads the value of an SIO4 firmware register without respect to the channel being accessed This applies to
21. 256 880 8787 SIO4 Linux Device Driver User Manual status ioctl fd SIO4 CABLE CONFIG amp set if get get 0 set if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 3 SIOA CLEAR DPLL STATUS This service clears status bits specific to the USC channel s Digital Phase are given by macro definitions rather than an enumeration These definitio Usage ioctl Argument request arg Description SIO4 CLEAR DPLL STATUS UINT32 Example lt errno h gt lt stdio h gt lt unistd h gt lt sys ioctl h gt include include include include include SIO4DocSrcLib h int sio4 dp11 clear status int fd int status Lock Loop The specific values supported ns are described earlier in this document int verbose status ioctl fd SIO4 CLEAR DPLL STATUS CLEAR DPLL ALL STATUS if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 4 SIO4_CTS_CABLE_CONFIG This service configures the cable s CTS signal and retrieves its current configuration If one of the predefined configurations is requested it is applied If the corresponding XXX RI EAD macro is supplied then the current configuration is not changed Before returning the current configuration is obtained and reported to the caller If the feature is u
22. 4 2 3 PIO This mode uses repetitive register accesses While it is the least efficient method it accommodates simultaneous transfers on any number of channels and in both directions Applications can make PIO mode I O requests without having to monitor FIFO fill levels 4 3 Onboard DMA The SIO4 is designed to automatically transfer data between the USC and the channel s FIFOs This is done using DMA which is a feature built in to the USC and supported by SIO4 circuitry This feature can be configured by invoking the SIO4 SET USC DMA OPTIONS IOCTL service Doing this manually requires that register fields be set as follows Register Setting USC IOCR TxRMode 1 USC IOCR RxRMode 1 USC HCR TxAMode T USC HCR RxAMode i 4 4 Oscillator Programming The ability to program the SIO4 s onboard oscillators depends on the board s hardware capabilities and on support included in the driver The driver can identify the oscillator chip for all SIO4 implementations up to and including those using the Cypress CY22393 Programmable Oscillator At present however the driver includes built in programming support only for those SIO4s using the CY22393 The driver will return an error status when exercising the programmable oscillator features for all other programmable oscillator types The general procedure to follow when using the programmable oscillator features are as follows NOTE The driver measures the SIO4 s
23. FALSE Usage ioctl Argument Description request SIO4 ENABLE BRG1 arg UINT8 56 E CONFIG Sd n Sd n amp set errno int verbose enable errno General Standards Corporation Phone 256 880 8787 Example include include include include include int sio4 int stat TE o retu SIO4 Linux Device Driver User Manual lt errno h gt lt stdio h gt lt unistd h gt lt sys ioctl h gt STO4DocSrcLib h brgl enable int fd int enable int verbose status us ioctl fd SIO4 ENABLE BRG1 enable verbose amp amp status 1 printf ioctl failure errno d n errno rn status 3 4 8 SIOA FEATURE TEST This service provides information on an SIO4 s feature set To gain support information on a specific feature the corresponding macro 1s supplied The value returned will be the corresponding support information which is the XXX YES orXXX NO macro in most cases If the XXX COUNT macro is supplied the value returned is the number of feature options supported by the service and should be one more that the service s XXX LAST INDEX macro Usage ioctl Argument Description request SIO4 FEATURE T EST arg s32 Example include include include include include int sio4_ AS int stat if iE lt errn
24. For detailed definitions of these registers refer to the SIO4 User Manual Macros Description SIO4 GSC BCR Board Control Register SIO4 GSC BSR Board Status Register SIO4 GSC CCR Clock Control Register SIO4 GSC CSR Control Status Register SIO4 GSC FCR FIFO Count Register SIO4 GSC FDR FIFO Data Register SIO4 GSC FR Features Register SIO4 GSC FRR Firmware Revision Register SIO4 GSC FSR FIFO Size Register SIO4 GSC ICR Interrupt Control Register SIO4 GSC ISR Interrupt Status Register SIO4 GSC IELR Interrupt Edge Level Register SIO4 GSC IHLR Interrupt Hi low Register SIO4 GSC POCSR Programmable Oscillator Control Status Register SIO4 GSC PORAR Programmable Oscillator RAM Address Register SIO4 GSC PORDR Programmable Oscillator RAM Data Register SIO4 GSC PSRCR Pin Source Register SIO4 GSC RAR Receiver Almost Empty Full Register SIO4 GSC SBR Sync Byte Register SIO4 GSC TAR Transmitter Almost Empty Full Register 3 1 5 2 PCI Configuration Registers The following table gives the complete set of PCI Configuration Registers For detailed definitions of these registers refer to the PCI9080 Data Book Al PCI registers are accessed by their native data size The exception is SIO4 PCI CCR which is 24 bits wide but accessed as if it were 32 bits Since the interface permits retrieval only of 32 bit values
25. MP TEST The chip and resulting protocol will each be given as their respective unknown options 4 6 Interrupt Notification Applications can make indirect use of SIO4 interrupts by using the Interrupt Notification IOCTL services This requires the following basic steps These steps are illustrated in the source code sample that follows 1 Use the cnt1 interface to register the application s signal handler 115 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual 2 If USC interrupts are to be used then configure the USC for the interrupts desired Consult the Zilog data book for the required register settings 3 Issue the SIO4 INT NOTIFY IOCTL service to request notification 4 When the SIGIO signal is received issue the SIO4 READ INT STATUS IOCTL service to determine which interrupt occurred If a USC interrupt was received then examine the USC to determine which interrupt occurred and clear it WARNING If a USC interrupt occurs then that interrupt must be serviced within the USC by the application If this is not done then that interrupt source within the USC will continue to function as an active USC interrupt source In this case the SIO4 will continue to assert an interrupt while USC interrupts are enabled 5 Perform any application required actions 6 If additional notification is required for an interrupt that was reported then repeat steps two through five as
26. Queue Registers Macros Description SIO4 PLX IFHPR Inbound Free Head Pointer Register IFHPR SIO4 PLX_IFTPR Inbound Free Tail Pointer Register IFTPR SIO4 PLX IPHPR Inbound Post Head Pointer Register IPHPR SIO4 PLX IPTPR Inbound Post Tail Pointer Register IPTPR SIO4 PLX IQP Inbound Queue Port Register IQP SIO4 PLX MQCR Messaging Queue Configuration Register MQCR SIO4 PLX OFHPR Outbound Free Head Pointer Register OFHPR SIO4 PLX OFTPR Outbound Free Tail Pointer Register OFTPR SIO4 PLX OPHPR Outbound Post Head Pointer Register OPHPR SIO4 PLX OPLFIM Outbound Post List FIFO Interrupt Mask Register OPLFIM SIO4 PLX OPLFIS Outbound Post List FIFO Interrupt Status Register OPLFIS SIO4 PLX OPTPR Outbound Post Tail Pointer Register OPTPR SIO4 PLX OQP Outbound Queue Port Register OQP 27 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual SIO4 PLX OBAR Queue Base Address Register QBAR SIO4 PLX QSR Queue Status Control Register QSR 3 1 5 4 Zilog USC Registers The following table gives the complete set of Zilog USC registers Macros Description SIO4 USC CCAR Channel Command Address Register CCAR SIO4 USC CCR Channel Control Register CCR SIO4 USC CCSR Channel Command Status Register CCSR SIO4 USC CMCR Clock Mode Control Regi
27. Updated to release 1 18 2 September 26 2005 Updated to release 1 18 1 July 15 2005 Updated to release 1 18 0 Removed feature definitions that are no longer supported May 24 2005 Updated to release 1 17 1 May 19 2005 Updated to release 1 17 0 May 10 2005 Updated to release 1 16 0 Corrected timeout information Added new feature options April 5 2005 Updated to release 1 15 1 March 23 2005 Updated to release 1 15 0 January 25 2005 Updated to release 1 14 0 Updated the driver to support the 2 6 kernel November 3 2004 Updated to release version 1 12 1 November 2 2004 Updated to release version 1 12 0 Added operation information on signal routing options Added the IOCTL service SIO4 TX CABLE DATA CONFIG Expanded the set of valid values for the JOCTL service SIO4 CTS CABLE CONFIG Added the SIO4 DCD CABLE CONFIG IOCTL service Added the S IO4 CABLE CONFIG IOCTL service October 18 2004 Updated to release version 1 11 0 Updated interrupt notification sample code Added a sample application asyncc2c which performs asynchronous channel to channel data transfers Removed the SIO4 RX CABLE CLOCK CONFIG IOCTL service as it isn t in firmware August 30 2004 Updated to release version 1 10 0 August 18 2004 Updated to release version 1 09 0 Updated documentation on some init and reset services August 17 2004 Updated to release version 1 08 0 Fixed driver SIO4 I
28. are enabled and the Rx signals are disabled SIO4 CABLE CONFIG TXUPR RXLWR The Tx upper signals are enabled and the Rx lower signals are enabled Macros set only options Description SIO4 CABLE CONFIG READ Retrieve the current configuration Macros get only options Description SIO4 CABLE CONFIG INVALID The current configuration is invalid SIO4 CABLE CONFIG UNKNOWN The current configuration is unknown 3 1 8 SIO4_ CLEAR DPLL STATUS Options This set of macros defines the bits that may be combined to form the value passed to the SIO4 CLEAR DPLL STATUS IOCTL service and refers to DPLL status bits in the USC CCSR Macros Description CLEAR DPLL ALL STATUS Clear all three of the DPLL status bits CLEAR DPLL IN SYNC Clear the DPLL Sync bit CLEAR DPLL MISSING 1 CLOCK Clear the DPLL1Miss bit CLEAR DPLL MISSING 2 CLOCKS Clear the DPLL2Miss bit 3 1 9 SIO4_CTS_CABLE_CONFIG Options This set of macros defines the options available for the SIO4 CTS CABLE CONFIG IOCTL service see page 54 Macros set and get options Description SIO4 CTS CABLE CONFIG CTS IN The cable CTS signal is the CTS input to the USC SIO4 CTS CABLE CONFIG DCD IN The cable DCD signal is the CTS input to the USC SIO4 CTS CABLE
29. are installed under a single directory All previous releases of the driver utilized a different directory structure based on where the user installed the separate archives All previous files archives and directories should be removed before proceeding with installation of this driver Directory Structure Content sio4 This is the driver s root directory sio4 app3 This directory contains the sio4app3 sample application sio4 app4 This directory contains the sio4app4 sample application sio4 asyncc2c This directory contains the asyncc2c sample application sio4 docsre This directory contains the C sources from this user manual sio4 driver This directory contains the driver executable and its sources sio4 test This directory contains the test sample application sio4 testloop This directory contains the test loop sample application sio4 utils This directory contains utility sources used by the sample applications 2 6 Installation Install the driver and its related files following the below listed steps 1 Change the current directory to usr src linux drivers NOTE Depending on the version of the kernel being used and the distribution the linux portion of the directory may exist as a soft link or it may not If it doesn t exist then it should be present with a suffix including the base version number of the kernel The directory should then appear as
30. basis sio4 start This is a shell script to install the driver module and device nodes 2 7 1 Build Follow the below steps to build the driver 1 Change to the directory where the driver and its sources were installed This should be usr src linux drivers sio4 driver 2 Remove all existing build targets by issuing the below command make clean 3 Build the driver by issuing the below command make all NOTE Building the SIO4 driver requires installation of the kernel header sources If they are not present the build will fail NOTE Due to the differences between the many Linux distributions some build errors may occur These errors may include system header location differences and should be easily correctable Other errors may also appear as some distributors port newer kernel changes into older kernel distributions NOTE Debug messages already present in the driver sources are enabled only when the macro SIO4 DEBUG is enabled This macro is undefined by default and can be found in sio4 h 2 7 2 Startup NOTE The driver may have to be rebuilt before being used due to kernel version differences between the GSC build host and the customer target host The startup script used in this procedure is designed to insure that the driver module in the install directory is the module that is loaded This is accomplished by making sure that an already loaded module is first unloaded before attempting to load
31. channel s post initialization configuration The reference frequency is unaltered the desired frequency is set to the reference frequency and the frequency obtained is reported Refer to the oscillator programming information later in this document for more information Usage ioctl Argument Description request SIO4 OSC INIT arg sio4 osc t Example include lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include STO4DocSrcLib h int sio4 osc init int fd _ s32 freq got int verbose Sio4 osc t osc int status status ioctl fd SIO4 OSC INIT amp osc if freq got freq got 0 osc freq got if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 22 SIO4_OSC_MEASURE This service is used to measure the frequency produced by the current oscillator hardware configuration The driver ignores all structure field values and fills them in according to the test results and the channel s current configuration The test results are recorded in the data structure s freq_got field A value of 1 is reported when the frequency can t be measured Refer to the oscillator programming information later in this document for more information NOTE The driver will perform a measurement test based on the SIO4 s capabilities When a measurement can be made the test duration and the accuracy of the
32. char name 80 assert board gt 0 assert channel gt 0 amp amp channel lt 3 index board 4 channel 1 sprintf name dev sio4 d index fd open name O_RDWR if verbose amp amp fd 1 printf open failure on s errno d n name errno return fd 50 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual 3 3 4 read This function is the entry point to reading received data from an open SIO4 serial channel This function should only be called after a successful open of the respective device The function reads up to count bytes from the receive FIFO If the number of bytes requested is not available within the configured time limit the read operation times out NOTE Refer to the SIO4 RX IO MODE CONFIG IOCTL services to configure this call for use of PIO DMA or Demand Mode DMA data transfer Prototype int read int fd void buf size t count Argument Description fd This is the file descriptor of the device to access buf The data read will be put here count This is the desired number of bytes to read Return Value Description a An error occurred Consult errno 0 to count The operation succeeded If the return value is less than count then the request timed out Example include lt errno h gt include lt stddef h gt include lt stdio h gt in
33. errno d n errno return status 3 4 63 SIO4_SET_SYNC_BYTE int verbose This service sets the value of the SYNC_CHARACTER register which can be used to trigger an interrupt when a byte of that value is moved into the channel s Rx FIFO 94 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual Usage ioctl Argument Description request SIO4 SET SYNC BYTE arg UINT8 Example tinclude lt errno h gt tinclude lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include STO4DocSrcLib h int sio4 sync byte set int fd UINT8 byte int verbose int status status ioctl fd SIO4 SET SYNC_BYTE byte if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 64 SIO4_SET_TX_CLOCK_SOURCE This service sets the transmit clock source within the channel s USC This applies to signal routing inside the USC only All of the CLOCK_SOURCE enumeration values are valid options for this IOCTL Usage ioctl Argument Description request SIO4 SET TX CLOCK SOURCE arg CLOCK SOURCE Example include lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h T int sio4 tx set clock source int fd CLOCK SOURCE source int verbose int status
34. firmware registers only Permissible values are from zero to 63 All other values result in failure Refer to the SIO4 User Manual and to sio4 h for a complete list of the predefined register identifiers 73 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual Usage ioctl Argument Description request SIO4 READ REGISTER RAW arg REGISTER PARAMS Example tinclude lt errno h gt tinclude lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 reg read raw int fd _u32 index _ u32 value int verbose REGISTER PARAMS parm int status parm u32RegisterNumber index parm u32Value OxDEADBEEFL status ioctl fd SIO4 READ REGISTER RAW amp parm value 0 parm u32Value if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 31 SIO4_RESET_CHANNEL This service performs a reset of the entire channel This includes the USC the FIFOs the cable configuration the transceivers and the programmable oscillator The programmable transceivers and programmable oscillator are disabled if supported in hardware The programmable oscillator is reset only if the SIO4 supports a different programmable source for each channel Usage ioctl Arg
35. jumpers All listed driver services apply all register modifications needed to configure the respective routing option This includes configuration of pertinent USC and GSC firmware registers This section does not otherwise pertain to signal routing inside the USC The figure below gives an overall picture of the board s signal routing features Each block in the figure represents one or more configurable features which are further described in subsequent paragraphs except for the cable connector block Clock Tx i2 Data 2 2 Hd O E 5 PECUNIAS Clock 8 8 8 Rx AA Is Data ra D 5 CTS 4 r DCD 4 Figure 1 An overview of the SIO4 signal routing features 4 1 1 Data and Clock Cable Pin Locations The SIO4 permits the location of the data and clock signals to be interchanged The default is that the signals are disabled The cable locations where these signals may appear are referred to as upper and lower in the hardware manual When the enabled the two Tx signals are always outputs and the two Rx signals are always inputs The table below identifies the driver services used to configure routing of the data signals Signal Description Driver Service Tx Rx These can be configured in most any combination of disabled SIO4 CABLE CONFIG lower and upper IOCTL page 53 options page 28 108 Ge
36. the module from the disk drive In addition the script also deletes and recreates the device nodes This is done to insure that the device nodes in use have the same major number as assigned dynamically to the driver by the kernel and so that the number of device nodes correspond to the number of boards identified by the driver 14 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual 2 7 2 1 Manual Driver Startup Procedures Start the driver manually by following the below listed steps 1 Login as root user as some of the steps require root privileges 2 Change to the directory where the driver was installed This should be usr src linux drivers sio4 driver 3 Install the driver module and create the device nodes by executing the below command If any errors are encountered then an appropriate error message will be displayed sio4 start NOTE The script s default specifies that the driver is installed in the same directory as the script The script will fail if this is not so NOTE The above step must be repeated each time the host is rebooted NOTE The SIO4 device node major number is assigned dynamically by the kernel The minor numbers and the device node suffix numbers are index numbers beginning with one and increase by one for each additional serial channel 4 Verify that the device module has been loaded by issuing the below command and examining the output The module name s
37. 104 INT NOTIFY BiSa Re Re nen A ubehencugndncubvabenebta A 31 3 1 13 SIO4 1O MODE XXX Val es creo SR gne e tee D ERROR Peers Ue ico deagos 31 3 1 14 SIO4 RX CABLE CONFIG Options eene nente nr tne netten nete E 31 3 1 15 SIO4 RX FIFO FULL CONFIG Options inei eiside pnan sraa ai ia nono nre 32 3 1 16 SIO4 RXC USC CONFIG Options sorsra uiris in EN ener nennen E E 32 3 1 17 SIO4 TX CABLE CLOCK CONFIG Options eessesseeeeeeenenerer nennen nennen ener 32 3 1 18 SIO4 TX CABLE CONFIG Options ener ener entrer trennen nre nennen 33 3 1 19 SIO4 TX CABLE DATA CONFIG Options eese eene ener nre 33 3 1 20 SIO4 TXC USC CONFIG Options eene eene aiii ii 33 RM MAT c Q 34 3 2 ADDR SEARCH MODE eit tenue HERE READER ERAI GE ATRI ER aga 34 3 2 2 BRO MODE itr dei ter RHET RETENIR EUN ERE E HERE DOR EU E EXER da 34 3 229 CHAR FENG THs etr HP xD PHREHEERIN E CAEHERE tate REN ERARIO O EEEE 34 3 24 CLOCK RATE cocino EHE EDO RETENIR cheno ED RR ETE ERE EU e HERREN TOES 35 3 25 CLOCK SOURCE netter Irt ERES ED E EET ole Cr PETI ei nia 35 IO DATA BORMUAT i o REDDUNT RARE De Bf irre PURUS 35 3237 DPEE DIVISO R anser reU EO EARUM EU 36 3 29 DP LES MODE it tree RE DURUM re ERE Res 36 23 2 9 DPBEE RESYNGS 2 heic e veta Eee be ERE s 36 DAVET NABET PY PE Sere ree b obe UR BER UA REED e UR EU 37 3 2 E EIEOSSTADUS rhetor vea onto id 37 3 24 2 IDEE LINE COND 55 erre b coe BRE e e UR E eet 38 3 2 3 JPARIDYSDPYPE etin re
38. 2 Execute Follow the below steps to execute and exercise the test application 1 Change to the directory where the sample application was installed This should be usr src linux drivers sio4 asyncc2c 2 Start the test application by issuing the command given below The c argument lower case requests continuous testing until a test error occurs The C argument upper case requests continuous testing without regard to test error The m argument requests that continuous testing run for at most minutes where is a decimal number The n argument requests that continuous testing run for at most tests where is a decimal number The index1 and index2 arguments are the zero based indexes of the two channels to be tested If the index numbers are identical then an internal loop back mode is used Otherwise a cable is required for data transfer between the two specified channels The index arguments are required All others are optional asyncc2c lt c gt C lt m gt lt n gt lt index1 gt lt index2 gt 3 The application will report board identification information then perform appropriate channel to channel data transfers Each individual data transfer test will require a minimum of about 10 seconds The maximum amount of time required is generally the amount of time required to transfer two FIFOs worth of data in both directions at the specified baud rate Overall test iterations should take less than five minut
39. 3 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual Macros get only options Description SIO4 TXC USC CONFIG INVALID The current configuration is invalid SIO4 TXC USC CONFIG UNKNOWN The current configuration is unknown 3 2 Data Types This driver interface includes the following data types which are defined in 104 h 3 2 1 ADDR SEARCH MODE This enumeration defines the receiver s possible address search mode options for use with the HDLC protocol Definition typedef enum AddrSearchMode ADDR SEARCH MODE Values Description DISABLED Disable address search mode EXT PLUS CTRL Search for an external address and one control byte ONE BYTE NO CTRL Search only for an address byte ONE BYTE PLUS CTRL Search for an address byte and a control byte 3 2 2 BRG_MODE This enumeration defines the Baud Rate Generator s possible operating modes Definition typedef enum BRGMode BRG MODI Values Description BRG CONTINUOUS Count down continuously reloading the starting value each time the count reaches zero BRG SINGLE CYCLE Count down to zero one time only 3 2 3 CHAR LENGTH This enumeration defines the receiver s and transmitter s possible data value sizes Definition typedef enum CharLength CHAR LENGTH Values Description
40. 4 Removed the tainting remarks as the driver is now covered by GPL April 29 2003 Added more registers and did additional porting November 19 2002 More porting bug fixing and minor corrections August 5 2002 Ported the driver to the 2 4 kernel June 25 2002 Minor correction January 29 2002 Initial release 118 General Standards Corporation Phone 256 880 8787
41. 4 test 2 Start the test application by issuing the command given below sio4Test o 3 The application presents a menu of options which should generally be self explanatory To exercise the application and consequentially the driver and the installed board select from the menu items presented When finished select the exit option 2 9 2 siodLoopTest o This sample application performs loop back tests The purpose of these tests is to verify the operation of different portions of the SIO4 board s circuitry The menu also has an option to perform all the tests on all channels without user intervention except for the cable loop mode which has to be run separately The menu provided with the application is generally self explanatory and the application logs the test results in a log file named sio4log which is created in the current directory The files are installed into the directory usr src linux drivers sio4 testloop The source files included and the specific tests performed are described below NOTE This application was designed for driver version 1 05 and earlier It has not been ported to the current driver and may be removed from future driver releases File Description async h A header for this test application makeapp sh This 1s the build script for this sample application sio4LoopTest c This is the source file sio4LoopTest o This is the pre built test application sio4test h A header file for this test appli
42. 56 880 8787 SIO4 Linux Device Driver User Manual 3 2 31 TX_RX This enumeration defines the possible external FIFO reset selection options Definition typedef enum TxRx TX RX Fields Description RX FIFO Reset the receive FIFO TX FIFO Reset the transmit FIFO TX AND RX FIFO Reset both FIFOs 3 2 32 TX UNDERRUN This enumeration defines the overall set of possible transmitter under run responses for all supported protocols The available options and their meanings vary with the protocol Definition typedef enum TxUnderrun TX UNDERRUN Fields Description ABORT COND Send an abort CRC FLAG COND Senda CRC then a flag EXT ABORT COND Senda 16 bit abort FLAG COND Send a flag 3 2 33 UINT16 This data type is defined to be an unsigned 16 bit integer 3 2 34 UINT32 This data type is defined to be an unsigned 32 bit integer 3 2 35 UINT8 This data type is defined to be an unsigned 8 bit integer 3 2 36 USC DMA OPTIONS This data structure defines the configurable parameters for DMA data transfer between the USC and the external FIFOs The receiver and transmitter sides are independently configurable Definition typedef struct 46 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual STATUS BLOCK OPTIONS eTxStatusBlockOptions UINTS8 u8TxDMAWaitForTrigger STATUS BLOCK OPTIONS eRxStatu
43. 6 SIO4_SET_DPLL_MODE This service sets the encoding format used by the data input signal to the USC channel s Digital Phase Lock Loop Usage ioctl Argument Description request SIO4 SET DPLL MODE arg DPLL MODE Example tinclude lt errno h gt tinclude lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 dpll set mode int fd DPLL MODE mode int verbose int status T status ioctl fd SIO4 SET DPLL MODE mode 90 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 57 SIO4 SET DPLL SOURCE This service sets the USC channel s Digital Phase Lock Loop clock source The only CLOCK SOURCI values that are valid options for this IOCTL are those listed below e Baud Rate Generator 0 e Baud Rate Generator 1 e The RxC pin e The TxC pin Usage ioctl Argument Description request SIO4 SET DPLL SOURCE arg CLOCK SOURCE Example tinclude lt errno h gt tinclude lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 dpll set clock source int fd CLOCK SOURCE src int status status ioctl fd SIO4 SET DPLL SOURCE src i
44. 78 3 438 5104 RX FIFO AF CONFIG ces NR TRIER ER a TU RS ERNEUT UL AE ens 79 3 4 39 5104 RX ElFOEOUN Tea 79 3 4 40 SIO4 RX FIFO FULE CONE ta talas 80 3 A ASIO4 RX FIFO SIZE 5e e ie ote ae ated NR ee meg ER SIE TRU ees 81 3 442 SIOA4 RX FIFO TYPE tette rer eee Sees te RHET E Ue esee 81 3 443 SIO4 RX IO LABOR Di 82 3 4 44 SIO4 RX IO MODE CONFIG o 00 c ccccccccsccccecesececoecccsecesceesessececescesecescceceussececesceecvcesececesvsnccesecersecesees 82 3 445 SIOA4 RXC USE CONFIG irte CEDERE c 83 3 446 SIO4 SELECT DPEL RES YNG ecce ia ia 84 3 4 47 SIO4 SEND CHANNEL COMMAND sese enne non ran E ENESE eren enne 84 3 448 SIO4 SET BRGO MODE teet EU RR WI E es reed 85 3449 SIO4 SET BRGO SOURCE n eee NO e E REGE np I eMe e a ev 85 3 450 SIO4 SETBRGI MODE risen e e n i ep e o it bee e set ae ers 86 34 512 SIO4 SET BROT SOURCE inlet p e t e eee ie ted ties 87 343258104 SET CTRA SOUR OE teen ehe lb ide uentus perito tede pee eae es 87 34 33 SIO4 SET CTRT SOURGE 5 iei ether tuse e ett t eet ed am s 88 6 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual 3 4 54 SIO4 SET USC DMASOPTIONS ea aida 89 3 4 55 SIO4 SET IPL Ec DIV ISOR A E LO 90 3 4 56 SIO4 SET DPLL A E 90 3 4 57 SIO4 SET DPLL SOURCE 3 606 nccicuetrustcsumeee t iac ute CD ae uit a re eR Me 91 3 4 58 SIO4 SET NA A A Sinteu atacand tar 91 3 4 59 SIO4 SET RCV HDLC PROT ds e cu
45. CONFIG DISABLE Disable use of the CTS signal SIO4 CTS CABLE CONFIG DRV LOW An output driven low SIO4 CTS CABLE CONFIG DRV HI An output driven high SIO4 CTS CABLE CONFIG RTS OUT The cable CTS signal is an RTS output which is the FIFO Full status from the Rx FIFO Macros set only options Description SIO4 CTS CABLE CONFIG READ Retrieve the current configuration Macros get only options Description SIO4 CTS CABLE CONFIG INVALID The current configuration is invalid SIO4 CTS CABLE CONFIG UNKNOWN The current configuration is unknown 3 1 10 SIO4 DCD CABLE CONFIG Options This set of macros defines the options available for the SIO4 DCD CABLE CONFIG IOCTL service see page 55 29 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual Macros set and get options Description SIO4 DCD CABLE CONFIG CTS IN The cable CTS signal is the DCD input to the USC The USC uses the signal for Data Carrier Detect operation SIO4 DCD CABLE CONFIG CTS IN SYNC The cable CTS signal is the DCD input to the USC The USC uses the signal for Data Sync Detect operation SIO4 DCD CABLE CONFIG DCD IN The cable DCD signal is the DCD input to the USC The USC uses the signal for Data Carrier Detect op
46. MA OPTIONS arg DMA OPTIONS Example include lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 dma_set_options int fd STATUS BLOCK OPTIONS tx_opts UINT8 tx wait STATUS BLOCK OPTIONS rx_opts UINT8 rx wait int verbose USC DMA OPTIONS parm int status parm eTxStatusBlockOptions tx opts parm u8TxDMAWaitForTrigger tx wait parm eRxStatusBlockOptions rx opts parm u8RxDMAWaitForTrigger rx wait status ioctl fd SIO4 SET USC DMA OPTIONS amp parm if verbose amp amp status 1 printf ioctl failure errno d n errno return status 89 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual 3 4 55 SIO4 SET DPLL DIVISOR This service sets the clock source divisor used by the USC channel s Digital Phase Lock Loop Usage ioctl Argument Description request SIO4 SET DPLL DIVISOR arg DPLL DIVISOR Example tinclude lt errno h gt tinclude lt stdio h gt include lt unistd h gt include sys ioctl h include SIO4DocSrcLib h int sio4 dpll set divisor int fd DPLL DIVISOR divisor int verbose int status status ioctl fd SIO4 SET DPLL DIVISOR divisor if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 5
47. NFIG trato at bee ubt oit ea ie teen echt 62 FAMOSO MP SINE QO nd meo hd lesen ol iat Blow Ote istis 63 3 44 LOA ZIP SIN Eo ete tii hile a Ue tno e e tio btc 64 S401 8 SIO4 IMPRESS Bik tenute Unc to tdt E MIR SV uitis eter ld dl 64 341935104 MPTEST 5 then tenen tini isa tiu eot anter 65 3 42058104 OSG INFO Md ol inte Blow Oti estt itd idiis 66 3 421 SO OSC HINT st ntn Ine un tm A eed tence 4 67 3 4 225SIO4 OSC MBASURE eee ete Dn bie otii estatus 67 3423 SIO4 OSC PROGRAM itte anio 68 3 424 SIO4 OSC REFERENCE ud 69 4 25 5104 OSC RESET de proie n 70 3 4 26 8104 086 TEST itio et tt and too e nd e dd eor ivt Unc la tence UE 70 3 427 SIO4 READ FIFO STATUS aiii leitete e e RR RU YR dee Eee 71 3 4 28 S104 READ INT STATUS esee esee de aiii 72 3 4 29 SIO4 READ REGISTER enenenseensece testes acd iee dede t e a idee dedere 73 3 4 30 SIO4 READ REGISTER RAW c cccsscsssssssessesssessscsseessescecscesnsesonsconsconscnssonsesnsestsssnesssssrsssessoesaess 73 3 4 31 SIO4 RESET CHANNEL ied eese eee E E ie Ee ER UE svedese 74 3 4 32 S104 RESET DEVICE inaen ni n AR E iie ee Ee ER edes 75 3 4 33 SIO4 RESET FIFO an niie AR RE de E Ee ER ER E ra iri eed 75 3 4 34 SIOA RESET USC ieu eei de EI e e dide TIS on ek a 76 3 4 35 SIOA4 RESET ZIEOG GHID eere at tica ES TT 3 4 36 SIO4 RX CABLE CONFIG eei endete tete esie e eiae ede e dodenus TT 3 437 SIO4 RX FIFO AE CONEIG erect ettet te DRE a
48. NIT CHANNEL bug August 11 2004 Updated to release version 1 07 2 Changed UART references to USC August 10 2004 Updated to release version 1 07 1 Removed PMC SIO4AR from front page as some device features are not properly supported on this board August 9 2004 Updated to release version 1 07 0 Added PMC SIO4AR to front page July 28 2004 Updated the list of SIO4 models covered by this user manual Added the IOCTL service SIO4 MOD REGISTER and the data structure REGISTER MOD PARAMS Added the SIO4 READ REGISTER RAW IOCTL service Updated numerous register names Added new feature test options Added programmable oscillator IOCTL services and a support data structure Added Multi Protocol Transceiver IOCTL services and support data structures Updated the archive directory structure and reorganized the relevant document sections Reversed the history list to show newest changes first Removed the DMA IOCTL services Expanded read and write to use DMA and DMDMA Added the I O Mode Configuration IOCTL services Added the I O Abort services Corrected bugs in the SIO4 RESET FIFO and SIO4 SEND CHANNEL COMMAND code samples March 23 2004 Added services and updated example code Updated numerous register macros Only firmware and USC registers are writable The PCI and PLX registers are now read only The document source code samples are now provided as a library March 1 200
49. NKNOWN Either the feature is unknown or support for the feature is unknown 30 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual SIO4 FEATURE YES The feature is supported Macros other Description SIO4 FEATURE LAST INDEX This gives the highest defined feature index 3 1 12 SIO4_INT_NOTIFY Bits This set of macros defines the bits that may be combined to form the value passed to the S104 INT NOTIFY IOCTL service WARNING If a USC interrupt occurs then that interrupt must be serviced within the USC by the application If this is not done then that interrupt source within the USC will continue to function as an active USC interrupt source In this case the SIO4 will continue to assert an interrupt while interrupts are appropriately enabled Macros Description SIO4 INT NOTIFY RX FIFO AF The Rx FIFO Almost Full interrupt SIO4 INT NOTIFY RX FIFO E The Rx FIFO Empty interrupt SIO4 INT NOTIFY RX FIFO F The Rx FIFO Full interrupt SIO4 INT NOTIFY SYNC DETECTED The SYNC Detected interrupt SIO4 INT NOTIFY TX FIFO AE The Tx FIFO Almost Empty interrupt SIO4 INT NOTIFY TX FIFO E The Tx FIFO Empty interrupt SIO4 INT NOTIFY TX FIFO F The Tx FIFO Full interrupt SIO4 INT NOTIFY USC INTERRUPTS The USC interrupts 3 1 13 SIO4 IO MODE XXX Values
50. O4 RX FIFO TYP El arg s32 Example include include include include include int sio4_ int s lt errno h gt lt stdio h gt lt unistd h gt lt sys ioctl h gt STO4DocSrcLib h int verbose rx fifo type int fd _ s32 get tatus 81 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual status ioctl fd SIO4 RX FIFO TYPE get if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 43 SIO4_RX_IO_ABORT This service aborts an active data read operation an active active and it has no affect on future requests Usage read request This has no affect if no such request is ioctl Argument Description request SIO4 RX IO ABORT arg Unused Example lt errno h gt lt stdio h gt lt unistd h gt lt sys ioctl h gt include include include include include SIO4DocSrcLib h int sio4_ rx io abort int fd int status int verbose status ioctl fd SIO4 RX IO ABORT if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 44 SIO4 RX IO MODE CONFIG This service updates and reports the mode used by the driver for data read operations This refers to how data is moved from the SIO4 to host memory when the read function is called
51. R SCD Does the Board Control Register support the Single Cycle Disable bit SIO4 FEATURE BSR Is the Board Status Register supported SIO4 FEATURE BSR FIFO PRESENT Does the Board Status Register support the FIFO Present bits S104 FEATURE COUNT This reports the number of features supported by the service SIO4 FEATURE FIFO COUNT Are the FIFO Count registers supported SIO4 FEATURE FIFO SIZE Are the FIFO Size registers supported S104 FEATURE FR Is the Features Register supported SIO4 FEATURE IRQ 32 Are all 32 bits of the interrupt configuration registers significant SIO4 FEATURE MP Is the Multi Protocol transceiver feature in firmware SIO4 FEATURE MP CHIP Which Multi Protocol transceiver chip is present SIO4 FEATURE MP PROGRAM Can a transceiver selection be reprogrammed SIO4 FEATURE OSC CHIP Which programmable oscillator chip is present SIO4 FEATURE OSC MEASURE Is the driver able to measure the oscillator s frequency SIO4 FEATURE OSC PER CHAN Is each channel separately and individually programmable SIO4 FEATURE OSC PROGRAM Is the driver able to program the oscillator SIO4 FEATURE PSRCR Are the Pin Source Registers supported SIO4 FEATURE PSTSR Are the Pin Status Registers supported SIO4 FEATURE SYNC MODEL Is this a SYNC model version of the SIO4 SIO4 FEATURE Z16C30 MODEL Is this a model that uses Zilog Z16C30 dual USC chips Macros get only options Description SIO4 FEATURE NO The feature is not supported SIO4 FEATURE U
52. SIO4 Four Channel High Speed Serial I O CPCI SIO4 A B PCI SIO4 A B BX PMC SI04 A B BX PC104P SIO4B Linux Device Driver User Manual Manual Revision September 30 2005 General Standards Corporation 8302A Whitesburg Drive Huntsville AL 35802 Phone 256 880 8787 Fax 256 880 8788 URL http www generalstandards com E mail sales generalstandards com E mail support generalstandards com SIO4 Linux Device Driver User Manual 2 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual Preface Copyright 2005 General Standards Corporation Additional copies of this manual or other literature may be obtained from General Standards Corporation 8302A Whitesburg Dr Huntsville Alabama 35802 Phone 256 880 8787 FAX 256 880 8788 URL http www generalstandards com E mail sales generalstandards com General Standards Corporation makes no warranty of any kind with regard to this material including but not limited to the implied warranties of merchantability and fitness for a particular purpose Although extensive editing and reviews are performed before release to ECO control General Standards Corporation assumes no responsibility for any errors that may exist in this document No commitment is made to update or keep current the information contained in this document General Standards Corporation does not assume any liability arising out of the application or use of any
53. SIO4DocSrcLib h int sio4 write int fd const void buf size t count int verbose int status status write fd buf count if verbose amp amp status 1 printf write failure errno d n errno return status 3 4 IOCTL Services The SIO4 driver implements the following IOCTL services Each service is described along with the applicable ioctl function arguments In the definitions given the optional argument is identified as arg and is an unsigned 32 bit data type Unless otherwise stated the return value definitions are those defined for the ioct1 function call NOTE Many of the IOCTL services alter the state of the channel s operation and can adversely affect the channel s proper operation if data transfer is in progress Exercise care when using these services to insure that data integrity is maintained 3 4 1 SIO4_ BOARD JUMPERS This service reads the jumper information for the user jumpers If the jumpers are not supported on the board in use then the returned value is the corresponding XXX UNKNOWN macro If the jumpers are supported then the value returned will be from 0x0 to 0x3 52 General Standards Corporation Phone 256 880 8787 SIO4 Linux Dev Usage ice Driver User Manual ioctl Argument Description request SIO4 BOARD JUMP py T arg s32 Example lt errno h gt lt stdio h gt lt unistd h gt lt sys ioc
54. Service Response SIO4 MP CONFIG The chip will be given as the SP508 option The resulting protocol will equal the requested protocol if it is supported The resulting protocol will otherwise be the invalid option SIO4 MP INFO The chip will be given as the SP508 option The desired protocol will be the read option The resulting protocol will reflect the board s current configuration SIO4 MP INIT The chip will be given as the SP508 option The desired and resulting protocol will both be the RS 422 485 option SIO4A MP RESET The chip will be given as the SP508 option The desired and resulting protocol will both be the disable option SIO4 MP TEST The chip will be given as the SP508 option The resulting protocol will be the requested protocol if it is supported The resulting protocol will otherwise be the invalid option 4 5 2 Fixed Protocol Support Some SIO4s include Multi Protocol support in firmware but not in hardware This applies when the SIO4 has fixed transceivers whose type is reported by firmware Under these circumstances the driver responds to the IOCTL services according to the following table Service Response SIO4 MP CONFIG The chip will be given as the fixed option The resulting protocol will reflect the board s hardwired protocol SIO4 MP INFO The chip will be given as the fixed option The desired protocol will be the read option and th
55. This enumeration defines various possible values that may be received when reading a FIFO s status NOTE Other values are possible but are not seen in normal use NOTE The Almost Empty status becomes active when the FIFO contains ALMOST EMPTY or fewer bytes Here ALMOST EMPTY refers to the value programmed into the lower 16 bits of the Tx and Rx Almost Registers NOTE The Almost Full status becomes active when the FIFO can receive ALMOST FULL or fewer additional bytes before being full Here ALMOST FULL refers to the value programmed into the upper 16 bits of the Tx and Rx Almost Registers Definition typedef enum FIFOStatus FIFO STATUS Values Description ALMOST EMPTY STATUS The FIFO is almost full ALMOST FULL STATUS The FIFO is almost full EMPTY STATUS The FIFO is empty 37 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual FULL STATUS The FIFO is full INVALID STATUS The FIFO s current status is invalid NOT ALMOST EMPTY NOR The FIFO level is between the almost full and the almost empty states ALMOST FULL STATUS 3 2 12 IDLE_LINE_COND This enumeration defines the possible transmitter pattern output options for what will be sent when the transmitter has no data to send Definition typedef enum IdleLineCond IDLE LINE COND
56. _CABLE_CLOCK_CONFI This service configures the channel s use of the of the predefined configurations is requested it G Tx Cable Clock signal and retrieves its current configuration If one is applied If the corresponding XXX_READ macro is supplied then the current configuration is not changed Before returning the current configuration is obtained and reported to the caller If the feature is unsupported then the corresponding XXX_UNKNOWN macro is returned If the feature is supported but the configuration is invalid then the corresponding XXX INVALID macro is returned Usage ioctl Argument Description request SIO4 TX CABLE T CLOCK CONFIG arg 8327 Example lt errno h gt lt stdio h gt lt unistd h gt lt sys ioctl h gt include include include include include SIO4DocSrcLib h int sio4 int fd 32 set 832 get int verbose int status tx cable clock config status ioctl fd SIO4 TX CABLE CLOCK CONFIG amp set if get get 0 set if verbose amp amp status 1 printf ioctl failure errno d n errno return status 99 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual 3 4 71 SIO4_TX_CABLE_CONFIG This service configures the transmitter s connection to the cable interface and retrieves its current configuration If one of the predefined configurati
57. _CHIP This service resets the entire Zilog Z16C30 dual USC The reset is implemented using the chips hardware reset feature which resets the referenced serial channel and the chip s other channel If the other channel is in use the reset may interfere with its operation The FIFOs programmable oscillators and the cable configurations are unaffected WARNING This IOCTL resets both Z16C30 serial channels Requesting this service may adversely affect the application or thread using the chip s alternate channel A safe alternative is to use the SIO4 RESET USC IOCTL service Usage ioctl Argument Description request SIO4 RESET ZILOG CHIP arg Not used Example include lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 zilog reset int fd int verbose int status status ioctl fd SIO4 RESET ZILOG CHIP if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 36 SIO4_RX_CABLE_CONFIG This service configures the receiver s connection to the cable interface and retrieves its current configuration If one of the predefined configurations is requested it is applied If the corresponding XXX_READ macro is supplied then the current configuration is not changed Before returning the current configuration is obtained and r
58. a o Ee et MER IER 38 32 14 REV AS YING PROTOCOL 33 stays eire Re oido event E e UREE EAS 38 3 2 19 RG V eHDECZPROTOGQ ODL S 41er ete e De EUR s 39 3 2 16 REGISTER MOD PARAMS oire i ERRA A thea roo thea te ineat rason ra estt A 39 3 217 REGISTER PARAMS entree RR eed o e bte tet MR eie 39 2 2 IS SIN cs it tattoo terc ord Nel TT AD oboe tod anton cadens dos Mods a Lanta A 40 3 2 19 SIO4 CHAN CMD erede e ene titer ite e e ere te eere Pct ere e a Ee E REOR EG RE re e t Rer ea 40 3 2 20 SIO4 DRIVER INFO reete eerte tete tete tet ie ed ted I ne ee E e ede E edo re eee RR Eee ed 40 EA SIOL INIT CHAN A sette tene RE ERR HE GER Ee ER RE HR ERE ER He RE YR Re e ER Een 41 3 2 22 SIO4 INTERRUPT STATUS 5 rettet erre tere ee Pede a Ere tet e ode teta Heer re ede RR Eel 42 38 2 23 SIOL MODE cete ici ii rede i o Pt te ie b EGO ERE E ER I e E E Pedo cag Qr ee e E abated 42 3 224 s104 imp Chip t usse O 43 EAS mp ptot 4 REEE AR aerei te DE E e EE EAE HS aedies teeta eens 43 3 2 26 8104 MP t sedan ted He ORTI RE ERR TN RR ee ees 44 3 2 27 S104 Ose E TISSUE O 44 3 2 28 8104 OSC di adi 44 32 200 STATUS BLOCK OPTIONS sudare en rte eer Coen ird Eri d ree LEER Ce Uso ee eere 45 3 2 30 STOPS BELTS O O ERU RE REDE d er mU ON 45 SPAINID ONIS C E 46 3 2 32 3T X UNDER BRUN oerte Oe RE DRE EEG E PERRO XE DRE CERTE ias 46 BSD BS IN a aos 46 3 2 34 UIN aa 46 BED BD IN p aia 46 3 2 36 USC DM A OPTIONS iras 46 3 2 37 X MT ASYNC PROTO D
59. ake another notification request The referenced interrupts are enabled Unreferenced interrupts are disabled WARNING If a USC interrupt occurs then that interrupt must be serviced within the USC by the application If this is not done then that interrupt source within the USC will continue to function as an active USC interrupt source In this case the SIO4 will continue to assert an interrupt while USC interrupts are enabled NOTE The application will not receive notification of any interrupt that the driver itself is waiting on NOTE This service automatically clears the current accumulated interrupt status NOTE Interrupt options referenced but unsupported by the current hardware are quietly ignored Usage ioctl Argument Description request SIO4 INT NOTIFY arg unsigned char Example include lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 int notify int fd unsigned char notify int verbose 60 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual int status status ioctl fd SIO4 INT NOTIFY notify if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 13 SIO4_MOD_REGISTER This service performs a read modify write operation on an SIO4 register This includes only the GSC firmware regi
60. ase Lock Loop Definition typedef enum DPLLMode DPLL MODE Values Description DPLL BIPHASE LEVEL A Differential Bi Phase Level format DPLL BIPHASE MARK SPACE The Bi Phase Mark Bi Phase Space format DPLL DISABLED Disable the DPLL DPLL NRZ NRZI A Non Return to Zero format 3 2 9 DPLL RESYNC This enumeration defines the possible Digital Phase Lock Loop resynchronization options 36 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual Definition typedef enum DPLLResync DPLL RESYNC Values Description BOTH EDGES Resynchronize on rising and falling edges FALLING EDGE Resynchronize on falling edges RISING EDGE Resynchronize on rising edges SYNC INHIBIT Run the DPLL continuously without synchronizing 3 2 10 ENABLE TYPE This enumeration defines the possible receiver and transmitter enable disable options Definition typedef enum EnableType ENABLE TYPE Values Description DISABLE AFTER TX RX Disable as the end of the current message frame or character DISABLE IMMED Disable immediately and unconditionally ENABLE WITH AUTO Enable per DCD and CTS flow control pins ENABLE WO AUTO Enable immediately 3 2 11 FIFO STATUS
61. b h 96 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual int sio4 async setup tx int fd CLOCK RATE rate STOP_BITS bits int verbose XMT ASYNC PROTOCOL parm int status parm eTxClockRate rate parm eTxStopBits bits Status ioctl fd SIO4 SET XMT ASYNC PROT amp parm if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 67 SIO4_SET_XMT_HDLC_PROT This service configures the transmitter specific HDLC SDLC parameters Usage ioctl Argument Description request SIO4 SET XMT HDLC PROT arg XMT HDLC PROTOCOL Example tinclude lt errno h gt tinclude lt stdio h gt tinclude lt unistd h gt include lt sys ioctl h gt tinclude SIO4DocSrcLib h int sio4 hdlc setup tx int fd int verbose XMT HDLC PROTOCOL parm int status parm u8SharedZeroFlags 0 parm u8TxPreambleEnable 0 parm eTxUnderrun ABORT COND Status ioctl fd SIO4 SET XMT HDLC PROT amp parm if verbose amp amp status 1 printf ioctl failure errno d n errno return status 97 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual 3 4 68 SIO4_SET_XMT_HDLC_SDLC_LOOP_PROT This service configures the transmitter specific HDLC SDLC Loop parameters Usage ioctl Argu
62. ber This identifies the register to access u32Value This is either set to the value to write to the register or it records the value read 3 2 18 SINT32 This data type is defined to be a signed 32 bit integer 3 2 19 SIO4_ CHAN_CMD This enumeration defines the possible commands which may be submitted via the SIO4 SEND CHANNEL COMMAND IOCTL service Definition typedef enum ChannelCmd SIO4 CHAN CMD Values Description LOAD RX CHAR CNT CMD Load the Receive Character Count from the Receive Count Limit Register LOAD RX TX CHAR CNT CMD Perform both of the two above actions LOAD TX CHAR CNT CMD Load the Transmit Character Count from the Transmit Count Limit Register LOAD TCO CMD Load the Baud Rate Generator 0 counter from the Time Constant 0 Register LOA D TCO TC1 CMD Perform both of the two above actions LOAD TC1 CMD Load the Baud Rate Generator 1 counter from the Time Constant 1 Register NULL CMD Perform no action at all This equals a value of zero 0 RESET HIGHEST IUS Reset the highest Interrupt Under Service bit RX FIFO PURGE CMD Purge the USC channel s internal receive data FIFO RX PURGE CMD Purge the USC channel s internal receive data and RCC FIFOs RX TX FIFO PURGE CMD Perform both of the two above actions Lr LSB FI RST CMD Transmit and receive the Least Significant Bit first
63. cation 2 9 2 1 Build Follow the below steps to build rebuild the sample application 1 Change to the directory where the sample application was installed This should be usr src linux drivers sio4 testloop 2 Build the sample application by issuing the below command 18 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual makeapp sh 2 9 2 2 Execute Follow the below steps to execute and exercise the test application 1 Change to the directory where the sample application was installed This should be usr src linux drivers sio4 testloop 2 Start the test application by issuing the command given below sio4LoopTest o 3 The application presents a menu of options which should generally be self explanatory To exercise the application and consequentially the driver and the installed board select from the menu items presented When finished select the exit option 2 9 2 3 Internal Local Loop In this test the Z16C30 is put into its INTERNAL LOCAL LOOP mode and the cable signals are all disabled In this test data is routed via the Z16C30 s INTERNAL LOCAL LOOP test mode circuitry Since the SIO4 cable signals are disabled for this test the cable type in use if any is ignored 2 9 2 4 Local Loop In this test the Z16C30 is put into its LOCAL LOOP mode and the cable signals are all disabled In this test data is routed via the Z16C30 s LOCAL LOOP test mod
64. ceiver parity type to use when receiver parity is enabled eTxEnable This specifies the transmitter enable state eTxDataFormat This specifies the transmit data encoding format eTxDataLength This specifies the transmit data encoding format u8TxParityEnable This enables or disable transmitter parity Zero 0 disables parity and one 1 enables it eTxParityType This specifies the transmitter parity type to use when receiver parity is enabled eTxIdleLineCond This specifies the transmitter data patterm to be generated on an underun condition u8TxWaitOnUnderrun A one 1 specifes that the transmitter is to wait for software to respond to an underrun condition If zero 0 it does not wait u8EnableRxUpper Unused u8EnableRxLower Unused u8EnableTxUpper Unused u8EnableTxLower Unused ul6TxAlmostEmpty This specifies the level at which the external transmit FIFO reports the Almost Empty status ul6TxAlmostFull This specifies the level at which the external transmit FIFO reports the Almost Full status ul6RxAlmostEmpty This specifies the level at which the external receive FIFO reports the Almost Empty status ul6RxAlmostFull This specifies the level at which the external receive FIFO reports the Almost Full status u8EnableTxCableUpper A value of one 1 enables the transmitter clock and data signals on the upper cable pins A zero 0 disables them u8EnableTxCableLower A value of one 1 enables the transmitter clock and data s
65. clude lt unistd h gt include SIO4DocSrcLib h int sio4 read int fd void buf size t count int verbose int status status read fd buf count if verbose amp amp status 1 printf read failure errno d n errno return status 3 3 5 write This function is the entry point to writing data for transmission to an open SIO4 serial channel This function should only be called after a successful open of the respective device The function writes up to count bytes to the transmit FIFO If the number of bytes requested cannot be sent within the configured time limit the write operation times out NOTE Refer to the SIO4 TX IO MODE CONFIG IOCTL services to configure this call for use of PIO DMA or Demand Mode DMA data transfer 51 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual Prototype int write int fd const void buf size t count Argument Description fd This is the file descriptor of the device to access buf The data written comes from here count This is the desired number of bytes to write Return Value Description 1 An error occurred Consult errno 0 to count The operation succeeded If the return value is less than count then the request timed out Example include lt errno h gt include lt stddef h gt include lt stdio h gt include lt unistd h gt include
66. clude lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 txc usc config int fd s32 set _ s32 get int verbose int status status ioctl fd SIO4 TXC_USC_CONFIG amp set if get get 0 set if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 81 SIO4_WRITE_REGISTER This service writes a value to an SIO4 register This includes GSC firmware and USC registers only All PCI and PLX feature set registers are read only Refer to the SIO4 User Manual and to sio4 h for a complete list of available registers Applications should exercise care in writing to some of these registers This is because some are used by the driver for interrupt and DMA purposes Writing to these registers may interfere with proper SIO4 and driver operation and may disrupt the stability of the operating system The registers of concern are those listed below e The GSC Board Control Register e The GSC Interrupt Control Register and the interrupt configuration registers e The GSC Interrupt Status Register e The USC Bus Configuration Register e The USC Daisy Chain Control Register e The USC Interrupt Control Register WARNING Writing to some registers may interfere with proper driver operation and may potentially disrupt the stability of the operating system Usage ioctl Argument Description
67. co eco gt 2 O rM gt vyvy vvYvvY TxC RxC USC Figure 3 Cable clock signal routing options 109 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual 4 1 3 Tx and Rx Data The SIO4 includes a Tx Data cable signal TxD and an Rx Data cable signal RxD though both are not always used TxD is always an output and RxD is always an input The table below identifies the driver services used to configure routing of the data signals Signal Description Driver Service RxD This is not configurable None TxD This can be configured to output any of the listed sources SIO4 TX CABLE DATA CONFIG IOCTL page 100 options page 33 Low Cable TxD TxD gt USC RxD Cable RxD Figure 4 Cable data signal routing options 4 1 4 CTS The SIO4 includes a CTS cable signal CTS though it is not always used The signal may be configured for multiple operating modes as either an input or an output The table below identifies the driver services used to configure routing of the CTS signal Description Driver Service This can be configured to function in any of the listed modes SI04_ CTS CABLE CONFIG IOCTL page 54 options page 29 Signal CTS Disable El Hi gt Low Cable CTS Rx Almost RTS
68. d here Some definitions from previous versions of the interface are available as needed by also including the header file sio4_legacy h NOTE Contact General Standards Corporation if additional driver functionality is required WARNING Driver versions 1 06 and 1 18 and later are not run time compatible with previous versions of the driver Applications written to versions 1 05 and 1 17 and earlier must be rebuilt before using a later version Additionally various components of the 1 05 and earlier interface have been updated and a few are no longer available Application may need a porting effort or they may optionally include the header sio4 legacy h to continue using some of the available but deprecated components Some deprecated components are not available via this legacy header NOTE The driver included with this release is designed to work with the SIO4 models listed on the cover page of this user manual as well as other models not listed The driver interface may therefore include IOCTL services and support components intended for use with other models Services and support components not documented in this manual should therefore not be used with the models listed on the cover For other SIO4 models refer to the applicable driver user manual 3 1 Macros The driver interface includes the following macros which are defined in sio4 h This header contains numerous additional utility type macros in addition to those described here
69. de DMA This mode transfers data with the least amount of CPU overhead It accommodates transfers that exceed the size of the installed FIFOs and uses the FIFO fill level to throttle data movement over the PCI bus This permits efficient data movement over the PCI bus and also permits the transfer to remain active while data is being transferred over the cable interface Since the SIO4 can have up to eight data streams 4 Rx and 4 Rx and only two DMA engines are available applications must make selective use of DMA and non DMA I O requests Applications can make DMDMA mode I O requests without having to monitor FIFO fill levels 4 2 2 DMA This refers to Non Demand Mode DMA This mode transfers data with little CPU overhead but is suitable only for requests that do not exceed the size of the installed FIFOs Using this mode applications much monitor a FIFO s fill level to insure that it can accommodate desired requests Calling read when the Rx FIFO contains insufficient data will result in indeterminate data at the point where the FIFO runs empty Calling write when the Tx FIFO contains insufficient free space will result in data loss at the point the FIFO becomes full Since the SIO4 can have 111 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual up to eight data streams 4 Rx and 4 Rx and only two DMA engines are available applications must make selective use of DMA and non DMA I O requests
70. des no programmable oscillator support and when the SIO4 uses a programmable oscillator unrecognized by the driver The driver responds to the IOCTL services according to the following table Service Response SIO4 OSC INFO The current recorded settings are reported SIO4 OSC INIT The recorded freq want and freq got values are set to the reference frequency SIO4 OSC MEASURE The freq got value is reported as zero SIO4 OSC PROGRAM The recorded freq want and freq got values are set to the requested value if it is non zero and 20MHz or lower SIO4 OSC REFERENCE The requested value is recorded if it is IMHz or higher and 20MHz or lower SIO4 OSC RESET The recorded freq want and freq got values are set to zero 4 5 Multi Protocol Transceiver Programming This feature includes boards with varying capabilities Some boards are able to change the transceiver protocol under software control Some have fixed transceiver protocols and can report the protocol via firmware Others have fixed transceiver protocols but are not able to report the protocol The general procedure to follow when using this feature is as follows 1 Determine if the SIO4 supports this feature This can be done using the SIO4 FEATURE F T EST IOCTL service on the SIO4 FEATURE MP feature If this feature in unsupported then do not attempt to
71. e lines NOTE This test requires an external cable connector that connects each channel s transmitter signals to its own receiver signals 19 General Standards Corporation Phone 256 880 8787 2 9 3 sio4a This sample SIO4 Linux Device Driver User Manual pp3 application performs an automated test of numerous more recently added IOCTL service It can be used as the starting point for any application development on top of the SIO4 Linux device driver The files are installed into listed files the directory usr src linux drivers sio4 app3 This application includes the below File Description o These are the sources which implement the IOCTL test code Most contain functionality based on the file s base name app3 h This is a header used by application makefile This is the driver make file makefile dep This is a make dependency file This is updated automatically sio4app3 This is a pre built version of the application 2 9 3 1 Build Follow the below steps to build rebuild the sample application 1 2 Change to the directory where the sample application was installed This should be usr src linux drivers sio4 app3 Build the sample application by issuing the below command make clean all 2 9 3 2 Execute Follow the below steps to execute and exercise the test application 1 Change to the directory where the sample application was installed This should be
72. e CLOCK DISABLED Disable the clock recipient CTRO CLOCK Select the CTRO output as the clock source CTR1 CLOCK Select the CTR1 output as the clock source DPLL CLOCK Select the DPLL output as the clock source RXC PIN CLOCK Select the RxC pin as the clock source TXC PIN CLOCK Select the TxC pin as the clock source 3 2 6 DATA_FORMAT This enumeration defines the receiver s and transmitter s possible data encoding formats 35 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual Definition typedef enum DataFormat DATA FORMAT Values Description BIPHASE LEVEL Bi Phase Level BIPHASE MARK Bi Phase Mark BIPHASE SPACE Bi Phase Space DIFF BIPHASE LEVEL Differential Bi Phase Level NRZ Non Return to Zero NRZB Inverted Non Return to Zero NRZI MARK Non Return to Zero Invert Mark NRZI SPACE Non Return to Zero Invert Space 3 2 7 DPLL_DIVISOR This enumeration defines the possible Digital Phase Lock Loop clock divisor options Definition typedef enum DPLLDivisor DPLL DIVISOR Values Description DPLL 16X Divide the source clock by 16 DPLL 32X Divide the source clock by 32 DPLL 8X Divide the source clock by eight 3 2 8 DPLL MODE This enumeration defines the possible source data encoding category options for the Digital Ph
73. e EVEN PARITY init eTxEnable ENABLE WO AUTO init eTxDataFormat NRZ init eTxDataLength BITS8 init u8TxParityEnable 0 init eTxParityType EVEN PARITY init eTxIdleLineCond SYNC FLAG NORMAL IDLE init u8TxWaitOnUnderrun 0 init u8EnableRxUpper 1 init u8EnableRxLower 0 init u8EnableTxUpper 0 init u8EnableTxLower T 59 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual init ul6TxAlmostEmpty 1 init ul6TxAlmostFull 1 init ul6RxAlmostEmpty 1 init ul6RxAlmostFull 1 init u8EnableTxCableUpper 0 init u8EnableTxCableLower 1 init u8EnableRxCableUpper 1 init u8EnableRxCableLower 0 status ioctl fd SIO4 INIT CHANNEL amp init if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 12 SIO4_INT_NOTIFY This service requests that the application be notified of one or more interrupts on the given serial channel The parameter value is the bit wise or ing of the possible notification bits The bits are defined in a previous section of this document Notification is given only for those bits which are set Passing in a value of zero 0 cancels all notification requests Once a specified interrupt occurs the driver clears and disables the interrupt then notifies the application via a SIGIO from signal h signal To receive any subsequent notifications the application must m
74. e able to open and close a channel and while open perform read write and I O control operations 10 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual 1 5 Hardware Overview The SIO4 is a four channel high speed serial interface I O board This board provides for bi directional serial data transfers between two computers or one computer and an external peripheral This board also can transfer data indefinitely without host intervention Once the data link between the two computers is established the desired transfers can be performed and will become transparent to the user The SIO4 board includes a DMA controller and comes with a maximum of 256K Bytes of FIFO storage which is 32K per channel side 32K 2 4 The FIFO configuration can vary greatly from one SIO4 version to another i e 32K 2 4 to 1K 2 1 to none at all The SIO4 comes in an RS232 version and an RS485 422 version Both versions include two Universal Serial Controllers Zilog Z16C30 USC The DMA controller is capable of transferring data to and from host memory whereas the FIFO memory provides a means for continuous transfer of data without interrupting the DMA transfers or requiring intervention from the host CPU The board also provides for interrupt generation for various states of the board like Sync Character detection FIFO empty FIFO full and DMA complete 1 6 Reference Material The following reference mat
75. e circuitry Since the SIO4 cable signals are disabled for this test the cable type in use if any is ignored 2 9 2 5 External Loop High In this test the Z16C30 is put into its NORMAL mode and the cable signals are configured so the transmit and receive channels are both connected to the cable s HIGH side In this test data is routed via the SIO4 board s HIGH side transceivers Since some SIO4 cable signals are enabled the cable type in use if any must be of a known type i e either no cable at all or each channel s transmitter and receiver must be tied together 2 9 2 6 External Loop Low In this test the Z16C30 is put into its NORMAL mode and the cable signals are configured so the transmit and receive channels are both connected to the cable s LOW side In this test data is routed via the SIO4 board s LOW side transceivers Since some SIO4 cable signals are enabled the cable type in use if any must be of a known type 1 e either no cable at all or each channel s transmitter and receiver must be tied together NOTE This test is applicable only to RS485 422 version SIO4 boards 2 9 2 7 Cable Loop In this test the Z16C30 is put into its NORMAL mode and the cable signals are configured so that the transmitter is connected to the HIGH side and the receiver is connected to the LOW side In this test data is routed via an externally attached cable For this test the cable used must route each channel s transmit lines to its own receiv
76. e file descriptor of the device to be closed Return Value Description 1 An error occurred Consult errno 0 The operation succeeded Example include errno h include lt stdio h gt include lt unistd h gt include SIO4DocSrcLib h 48 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual int sio4 close int fd int verbose int status status close fd if verbose amp amp status 1 printf close failure errno d n errno return status 3 3 2 ioctl This function is the entry point to performing setup and control operations on an open SIO4 serial channel This function should only be called after a successful open of the respective device The specific operation performed varies according to the request argument The request argument also governs the use and interpretation of any additional arguments The set of supported IOCTL services is defined in a following section Prototype int ioctl int fd int request Description This is any additional arguments If request does not call for any additional arguments then any additional arguments provided are ignored The SIO4 IOCTL services use at most one argument which is represented by a 32 bit value Return Value Description 1 An error occurred Consult errno 0 The operation succeeded Example tinclude lt
77. e resulting protocol will reflect the board s hardwired protocol SIO4 MP INIT The chip will be given as the fixed option The desired and resulting protocols will reflect the board s hardwired protocol option SIO4 MP RESET The chip will be given as the fixed option The desired and resulting protocols will reflect the board s hardwired protocol SIO4 MP TEST The chip will be given as the fixed option The resulting protocol will be the test protocol if it is the board s hardwired protocol The resulting protocol will otherwise be the invalid option 4 5 3 All Other Cases This applies when the firmware includes no Multi Transceiver protocol support and when support is present but the protocol is fixed In these cases the driver responds to the IOCTL services according to the following table Service Response SIO4 MP CONFIG The chip and resulting protocol will each be given as their respective unknown options SIO4 MP INFO The desired protocol will be the read option The chip and resulting protocol will each be given as their respective unknown options SIO4 MP INIT The chip the desired protocol and resulting protocol will all be given as their respective unknown options SIO4 MP RESET The desired protocol will be the disable option The chip and resulting protocol will each be given as their respective unknown options SIO4
78. e values are used in the chip field of the sio4 osoc t data structure which is used with the programmable oscillator based IOCTL services Refers to the specific service for information on how this structure is used Definition typedef enum sio4 osc chip t Values Description SIO4 OSC CHIP CY22393 This refers to the Cypress CY22393 which provides each SIO4 channel with its own programmable oscillator SIO4 OSC CHIP FIXED This refers to a fixed frequency non programmable oscillator that is shared by all SIO4 channels SIO4 OSC CHIP IDC2053B This refers to a single Cypress IDC2053B which provides all SIO4 channel with the same programmable oscillator output SIO4 OSC CHIP IDC2053B 4 This refers to four Cypress IDC2053B programmable oscillators which provides each SIO4 channel with its own output SIO4 OSC CHIP UNKNOWN The oscillator is unknown 3 2 28 sio4 osc t This data structure is used to exchange information and requests about the board s programmable oscillator between applications and the driver This structure is used with the programmable oscillator based IOCTL services Refers to the specific service for information on how this structure is used 44 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual Definition typedef struct u32 chip 832 freq ref _ 32 freq want _ S32 freq got sio4 osc t Field Descri
79. ent 7 If desired the current configuration may be determined at any time using the SIO4 OSC INFO IOCTL service The information returned will be based on the driver s recorded state information 4 4 1 Cypress CY22393 Programmable Oscillator Support The SIO4 s support for this device includes a fixed reference oscillator a Cypress CY22393 with four programmable oscillators and four firmware based post dividers The driver defaults the reference frequency to the measured frequency at startup and initializes the programmable oscillators to their off state The driver manages the firmware post dividers and the CY22393 with its oscillators and Digital Phase Lock Loop Generators as best as possible to fulfill application requests The driver responds to the services according to the following table Service Response SIO4 OSC INFO The current settings are reported SIO4 OSC INIT The desired frequency is set to the reference frequency and the channel is reconfigured accordingly SIO4 OSC MEASURE The output frequency is measured using SIO4 firmware resources The measured value is reported in the req got field SIO4 OSC PROGRAM If the requested frequency is non negative and 20MHz or less then the driver programs in that configuration that will most closely match the request This is done based on the CY22393 s resources available at that moment SIO4 OSC REFERENCE The requested value i
80. eported to the caller If the configuration is invalid then the corresponding XXX INVALID macro is returned Usage ioctl Argument Description request SIO4 RX CABLE CONFIG arg 832 Example include lt errno h gt include lt stdio h gt 77 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual lt unistd h gt lt sys ioctl h gt include include include SIO4DocSrcLib h int sio4_ rx cable config int fd int status status ioctl fd SIO4 RX if get get 0 set if verbose amp amp status printf ioctl failure return status 3 4 37 SIO4_RX_FIFO_AE_CONFIG S32 set _ s32 get int verbose CABLE CONFIG amp set zy errno din errno This service configures the Rx FIFO Almost Empty level and reports the current level When applying a setting the Rx FIFO is reset and the current content is lost If the corresponding XXX RI EAD macro is supplied then no change is applied Before returning the current programmed level is obtained and supplied to the caller Usage ioctl Argument Description SIO4 RX FIFO A request 3 CONFIG P s32 arg Example lt errno h gt lt stdio h gt lt unistd h gt lt sys ioctl h gt include include include include include SIO4DocSrcLib h int sio4 int status r
81. eration SIO4 DCD CABLE CONFIG DCD IN SYNC The cable DCD signal is the DCD input to the USC The USC uses the signal for Data Sync Detect operation SIO4 DCD CABLE CONFIG DISABLE Disable use of the DCD signal SIO4 DCD CABLE CONFIG DRV HI An output driven high SIO4 DCD CABLE CONFIG DRV LOW An output driven low SIO4 DCD CABLE CONFIG RTS OUT The cable DCD signal is an RTS output which is the FIFO Full status from the Rx FIFO Macros set only options Description SIO4 DCD CABLE CONFIG READ Retrieve the current configuration Macros get only options Description SIO4 DCD CAB E CONFIG INVALID The current configuration is invalid SIO4 DCD CAB E CONFIG UNKNOWN The current configuration is unknown 3 1 11 SIO4 FEATURE TEST Options This set of macros defines the options available for the SIO4 FEATURE TEST IOCTL service Macros features set only options Description SIO4 FEATURE BCR BOARD RESET Does the Board Control Register support the Board Reset bit SIO4 FEATURE BCR RX FFC Does the Board Control Register support the Rx FIFO Full Configuration bit SIO4 FEATURE BC
82. erial may be of particular benefit in using the SIO4 and this driver The specifications provide the information necessary for an in depth understanding of the specialized features implemented on this board e The applicable SIO4 User Manual from General Standards Corporation e The PCI9080 PCI Bus Master Interface Chip data handbook from PLX Technology Inc PLX Technology Inc 870 Maude Avenue Sunnyvale California 94085 USA Phone 1 800 759 3735 WEB http www plxtech com e TheZ16C30 USC User s Manual from Zilog e TheZ16C30 Electronic Programmer s Manual from Zilog Zilog part number ZEPMDC00001 The Zilog material is available from Zilog Inc 910 E Hamilton Ave CAMPBELL CA 95008 USA Phone 1 408 558 8500 WEB http www zilog com 11 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual 2 Installation 2 1 CPU and Kernel Support The driver is designed to operate with Linux kernel versions 2 2 2 4 and 2 6 running on a PC system with one or more Intel x86 processors Testing was performed under kernel versions 2 2 14 Red Hat Linux 6 2 2 4 21 Red Hat Enterprise Linux Workstation Release 3 and 2 6 9 Red Hat Enterprise Linux Workstation Release 4 NOTE The driver may have to be rebuilt before being used due to kernel version differences between the GSC build host and the customer s target host NOTE The driver has not been tested with a non versioned kerne
83. errno h gt tinclude lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 ioctl int fd int request int arg int verbose int status status ioctl fd request arg if verbose amp amp status 1 printf ioctl failure errno d n errno return status 49 General Standards Corporation Phone 256 880 8787 3 3 3 open SIO4 Linux Device Driver User Manual This function is the entry point to open a connection to an SIO4 serial channel Upon opening the channel all settings and configurations are put in an initialized state The programmable oscillator reference frequency is unaffected Prototype int open const char pathname int flags Argument Description pathname This is the name of the device to open flags This is the desired read write access Use O RDWR NOTE Another form of the open function has a mode argument This form is not displayed here as the mode argument is ignored when opening an existing file device Return Value Description 1 An error occurred Consult errno else A valid file descriptor Example include lt assert h gt include lt errno h gt include lt fcntl h gt include lt stdio h gt include lt unistd h gt include SIO4DocSrcLib h int sio4_open int board int channel int verbose int fd int index
84. es 2 10 Removal Follow the below steps to remove the driver and all associated files 1 Shutdown the driver as described in previous paragraphs 2 Change to the directory where the driver archive was installed This should be usr src linux drivers 3 Issue the below command to remove the driver archive and all of the installed driver files rm rf sio4 tar gz sio4 4 Issue the below command to remove all of the installed device nodes rm f dev sio4 22 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual 5 If the automated startup procedure was adopted then edit the system startup script rc local and remove the line that invokes the sio4 start script The file rc local should be located in the etc rc d directory 23 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual 3 Driver Interface The SIO4 driver conforms to the device driver standards required by the Linux Operating System and contains the standard driver entry points The device driver provides a standard driver interface to the GSC SIO4 board for Linux applications The interface includes various macros data types and functions all of which are described in the following paragraphs The SIO4 specific portion of the driver interface is defined in the header file sio4 h portions of which are described in this section The header defines numerous items in addition to those describe
85. es 111 IA ONO 111 421 DMDMA 6 111 422 DMA A A A ss 111 DI ass 112 43 Onboard A O ONO 112 ER MOTollrtodugu acr 112 4 4 1 Cypress CY22393 Programmable Oscillator Support essere 113 4 4 2 Cypress IDC2053B Programmable Oscillator Support sssssseeeeeeeeenennnnns 113 4 43 Fixed Oscillator SUppott 5p onn ERR BOE ERROR E a E ESA 113 AA AYA Other Cases o ibt eo t er eet e 114 4 5 Multi Protocol Transceiver Programming ee eeees scene eren eene eren netus etta seta ases setas senes etus setas stone sna 114 4 5 1 Cipex SP508 Multi Protocol Transceiver Support sesssssssssesseeeeeeer eene 114 4 5 2 Fixed Protocol SUppott a ettet ee e ee e ec eri e eds 115 4 5 3 AlbOthet Cases one nni oe pb ede ent ob de t t es 115 4 6 Interrupt Notifications e oo Stos 115 7 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual Document alti Vasca id ALLS 8 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual Table of Figures Figure 1 An overview of the SIO4 signal routing features ooooconoonocononononcnonconncon nono nono ronn nn n no nennen ener enne 108 Figure 2 Cable pin location options for the data and clock signals eee 109 Figure 3 Cable clock signal routing optio
86. est to complete The timeout period is specified in seconds Timeout values of zero 0 or less mean do not wait Usage ioctl Argument Description request SIO4 SET READ TIMEOUT arg SINT32 Example include lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt 93 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual tinclude SIO4DocSrcLib h int sio4 timeout set read int fd UINT32 timeout int status status ioctl fd SIO4 SET READ TIMEOUT timeout if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 62 SIO4_SET_RX_CLOCK_SOURCE int verbose This service sets the receive clock source within the channel s USC This applies to signal routing inside the USC only All of the CLOCK_SOURCE enumeration values are valid options for this IOCTL Usage ioctl Argument Description request SIO4 SET RX CLOCK SOURCE arg CLOCK SOURCE Example include lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 rx set clock source int fd CLOCK SOURCE source int status status ioctl fd SIO4 SET RX CLOCK SOURCE source if verbose amp amp status 1 printf ioctl failure
87. ette setenta seta nas tn conoce nooo svooo sso besoe nn stesse tone sea es 16 2 5 1 SIO4DOGSrC Lib ue gue oe Ce p DEREN PI EE IH Lee Pe Rr epe ete UE de a Pee pn 16 2 9 Sample Applications 17 2 0 STO 68 0 ste deett dedi dust Pd idum Gute Hoel seed oe elei e e Ouest dd eee Ue YS 17 2 02 SIO4 O0pT6StO s deest eed n E D RERO te ette I e E ROS QUERIT 18 p EN LI PEN 20 pu BEI 20 pA SE uv E 21 2 10 Removal R AA tert Edere veter Yo een vao EE e eve N e T VPE Qv ge soot Tbe DE ep Ve eque nel EEE 22 3 Driver Interface ie eie itte ee eai vas Food et eei ees av pase oo vest eue oe Fus cia 24 REUS PIN 24 312 FIFO Count OptiOns dee ee etie testate tee tele de ii e I PEE ena 24 Spo AI L R HM 24 SEM FIFO Type Options messe 24 EMG SINE M 25 Boll S RN 25 3 16 SIO4 BOARD JUMPERS Options iii tii 28 3 17 SIO4 CABLE CONEIG Options iia ii iaa PH rre E Qro Er erben 28 3 18 SIOA CEEAR DPEL STATUS OPDptLotis erre etri ertt ere coi 29 3 1 95SIO4 CTS CABLE CONFIG Options oct eerte tr rette HE Eee e HERE E tree o 29 3 110 SIO4 DCD CABLE CONFIG Opt ninia 29 91 1 SIO4 FEAXTURE TEST Options chica eor EHE EROS 30 4 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual 3 1 12 S
88. exercise the board s Multi Protocol transceiver feature Attempting to do so will be unsuccessful when this feature is unsupported If the feature is supported then continue with the following steps 2 Determine if the SIO4 s transceiver protocol can be changed This can be done using the SIO4 FEATURE T EST IOCTL service on the SIO4 FEATURE MP CHANGE feature If this feature is unsupported then do not attempt to exercise the board s Multi Protocol transceiver feature Attempting to do so will be unsuccessful when this feature is unsupported If the feature is supported then continue with the following steps 3 Determine if the transceiver protocol desired is supported This can be done using the S104 MP TEST IOCTL If a suitable protocol cannot be selected then do not attempt to further exercise the board s Multi Protocol transceiver feature If a suitable protocol is available then continue with the following steps 4 Select a suitable transceiver protocol This can be done using the STO4 MP CONFIG IOCTL 5 If desired the current configuration can be determined at any time using the SIO4 OSC INFO IOCTL service 4 5 1 Cipex SP508 Multi Protocol Transceiver Support When the SIO4 includes these transceiver chips the driver responds to the services according to the following table 114 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual
89. f verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 58 SIO4_ SET RCV ASYNC PROT This service configures the receiver specific Asynchronous parameters Usage ioctl Argument Description request SIO4 SET RCV ASYNC PROT 91 General Standards Corporation Phone 256 880 8787 E enumeration int verbose SIO4 Linux Device Driver User Manual arg RCV_ASYNC_PROTOCOL Example This software is covered by the GNU G incl incl incl incl incl incl int si RCV_ASYNC_PROTOCOL in parm eRxClockRate status if de de de de de de o4 t verbose printf ioctl lt errno h gt lt errno h gt lt stdio h gt lt unistd h gt lt sys ioctl h gt STO4DocSrcLib h async setup rx in pa EN ERAL PUBLIC LIC ENSE GPL T t fd CLOCK_RATE rm status ioctl fd amp amp stat fa rate SIO4 SET RCV ASYNC rate PROT us 1 ilure errno return status 3 4 59 SIO4_SET_RCV_HDLC_PROT This service configures the receiver specific HDLC parameters Usage ioctl Argument Description reque st SIO4 SET RCV HDLC PROT arg RCV HDLC PROTOCOL Example tinclu tinclu tinclu tinclu inclu int si
90. for any application development on top of the SIO4 Linux device driver The menu provided with the application is generally self explanatory The files are installed into the usr src linux drivers sio4 test directory This application includes the below listed files NOTE This application was designed for driver version 1 05 and earlier It has not been ported to the current driver and may be removed from future driver releases Since it has not been ported some of the options may not function properly NOTE Before doing any operation on a channel the channel must be selected and opened using the menu selections A and B File Description makeapp sh This is the build script for this sample application sio4Test c This is the source file sio4Test o This is the pre built test application sio4test h A header for this test application 17 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual 2 9 1 1 Build Follow the below steps to build rebuild the sample application 1 Change to the directory where the sample application was installed This should be usr src linux drivers sio4 test 2 Build the sample application by issuing the below command makeapp sh 2 9 1 2 Execute Follow the below steps to execute and exercise the test application 1 Change to the directory where the sample application was installed This should be usr src linux drivers sio
91. for use Usage ioctl Argument Description request SIO4 INIT BOARD arg Not used Example include include include include include include lt errno h gt lt stdio h gt lt unistd h gt lt sys ioctl h gt STO4DocSrcLib h STO4DocSrcLib h 58 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual int sio4 board init int fd int verbose int status status ioctl fd SIO4 INIT BOARD if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 11 SIO4_INIT_CHANNEL This service initializes a channel by applying the settings given in the supplied structure This service does not affect the transceivers or the programmable oscillator Usage ioctl Argument Description request SIO4 INIT CHANNEL arg SIO4 INIT CHAN Example include lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 channel init int fd int verbose S104 INIT CHAN init int status init eMode INT LOCAL LOOPBACK init u32BaudRate 12288001 init eRxEnable ENABLE WO AUTO init eRxDataFormat NRZ init eRxDataLength BITS8 init u8RxParityEnable 0 init eRxParityTyp
92. he SIOA this effort may affect all channels 112 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual 5 Request that the oscillator be reprogrammed for the desired frequency This is done using the SIO4 OSC PROGRAM IOCTL service The resulting frequency will be as close as possible to the requested frequency How close this actually is depends on the oscillator s capabilities its current resource usage and the reference frequency Check the sio4 osc t structure s freq got field after programming to verify that the resulting frequency is sufficient Depending on the SIO4 the programming effort may affect all channels NOTE On occasion the oscillator programming effort may not take full affect even though the operation completes successfully Applications should therefore measure the oscillator frequency following programming requests If the measured results differ significantly from what the programming request indicated would be produced then repeat the programming and measurement steps until the results are satisfactory 6 If desired the channel s current frequency can be measured at any time using the SIO4 OSC MEASURE IOCTL service However this should only be done if the frequency can be measured This capability depends on the SIO4 s feature set Support for this feature can be determined by using the SIO4 FEATURE TEST IOCTL service with the STO4 FEATURE OSC MEASURE feature argum
93. he driver make file makefile dep This is a make dependency file This is updated automatically sio4app4 This is a pre built version of the application 2 9 4 1 Build Follow the below steps to build rebuild the sample application 1 2 Change to the directory where the sample application was installed This should be usr src linux drivers sio4 app4 Build the sample application by issuing the below command make clean all 2 9 4 2 Execute Follow the below steps to execute and exercise the test application 1 Change to the directory where the sample application was installed This should be usr src linux drivers sio4 app4 Start the test application by issuing the command given below The c argument lower case requests continuous testing until a test error occurs The C argument upper case requests continuous testing without regard to test error The 1xxx argument specifies the type of loop back cable that is attached Use 1232 if an RS232 loop back cable is attached 1485 if an RS485 loop back cable is attached lnone if a loop back cable is not attached and 1other if some other cable type is attached The m argument requests that continuous testing run for at most minutes where is a decimal number The n argument requests that continuous testing run for at most tests where is a decimal number The index argument is the zero based index of the board to be accessed All arguments are optional
94. he sample files by issuing the below command make all 2 8 1 2 Use Use of the library has requirements applicable at the time the application 1s being built C sources using the library must include the header file which is named SIO4DocSrcLib h Applications using the library must link the file SIO4DocSrcLib a Both the include search path and the library search path must be expanded to include the directory usr src linux drivers sio4 docsrc 2 9 Sample Applications The driver archive contains three sample applications These are Linux user mode application programs They are delivered undocumented and unsupported but may be used to exercise the SIO4 and its device driver They can also be used as starting points for developing applications on top of the Linux driver and to help ease the learning curve The applications are described in the following paragraphs NOTE These sample applications are designed to function with the SIO4 models listed on the cover of this user manual The sample applications may work with other models but may not function as expected since they are not necessarily intended for those models Refer to the driver user manual and sample applications supplied with the SIO4 model in question as applicable 2 9 1 sio4Test o This sample application provides a menu driven Linux application that can be used to test the different features that are supported by the SIO4 device driver It can be used as the starting point
95. his identifies the total number of SIO4 boards the driver detected z16c30 This identifies which installed boards are Z16C30 models which use the Zilog Z16C30 A 1 indicates yes A 0 indicates no The order corresponds to the device node indexes in the dev directory Sync This identifies which installed boards are SYNC models A 1 indicates yes A 0 indicates no The order corresponds to the device node indexes in the dev directory 2 4 File List This release consists of the below listed files The archive is described in detail in following subsections 12 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual File Description sio4 tar gz This archive contains the entire driver with all associated files including sources and make files sio4 linux driver user manual pdf This isa PDF version of this user manual NOTE Driver versions 1 05 and earlier were shipped as multiple archive files that were decompressed separately As of version 1 06 all driver files except the user manual are supplied as a single archive All previous files archives and directories should be removed before proceeding with installation of this driver 2 5 Directory Structure The following table describes the directory structure observed by the source archive NOTE As of version 1 06 the driver and all associated support files
96. i ere ARD a tana 47 3 22 38 X MT HDEC PROTOCOL eerte eret E er ere UE RE IEEE Ere Te oen 47 3 239 XMT HDEC SDEGC LEOOP PROTOCOL titi nitet ti ree ien eden OE 47 3 22 40 XMT ISOCHRE PROTOCOL oreet tete E T EUR E ve RH Ea 48 KxoMIUII UID 48 A UR RR 48 EAM MIU E sda eae eer ak aunts ete S 49 O O E eee 50 EA CLAU M M 51 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual II e E RR IN AA RR eee 51 ES NO 52 3 4 T SIOA4 BOARDJUMPERS etre id EAS 52 3 42 SIO4 CABLE CONFIG ies ta RIED 53 3 4 3 SIO4 CLEAR DPLEL STATUS iniret aiii 54 3 44 SIOA CTS CABEE CONLEIG ree Rate RR E A EE SET a tee Ud 54 3 4 5 8IO4 DED CABLE CONETG n cetera ee ORE Re EEG e A UE Tue RT RUE E Eee d 55 3 4 6 5104 ENABLE BRGO i iie see metae laa 56 3 47 SIOAZENABLE BRQGLH iter in EUER US 56 3 48 SIO4 FEATURE TES I iit tete Ra A o 57 3 49 SIO4 GET DRIVER INEO cette a ER vies IEEE E OE E e GNO RE E i ete 58 3 4 T0 SIOA4 INIT BOARD associe e Wa eant te i e t eoa e PR D ee 58 3 4 LT2SIOA INIT CHANNEL teret ti o Oe e PE BERE Ue e o UU e NP EEUU ER 59 3 4 12 SIOL INT NOTIFY 5 satio c e ete atte E be eg eR et e CU e e ttt pc eei 60 3 4 132 SIO4 MOD REGISTER teet t eet a ENTRE TE D YR RUE ah ees 61 JA lA SIO4 INO FUNCTION iml eben o ntiis 62 IAS ZSIO4 UMP CO
97. ice resets either or both of the channel FIFOs Usage ioctl Argument Description request SIO4 RESET FIFO arg TX RX 75 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual Example tinclude lt errno h gt tinclude lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 fifo reset int fd TX RX which int verbose int status status ioctl fd SIO4 RESET FIFO which if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 34 SIO4_RESET_USC This service performs a reset of the channel s USC The FIFOs the cable configuration and the programmable oscillators are unaffected This service has no affect on any other channels Usage ioctl Argument Description request SIO4 RESET USC arg Not used Example include lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 usc reset int fd int verbose int status status ioctl fd SIO4 RESET USC if verbose amp amp status 1 printf ioctl failure errno d n errno return status 76 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual 3 4 35 SIO4_RESET_ZILOG
98. ignals on the lower cable pins A zero 0 disables them u8EnableRxCableUpper A value of one 1 enables the receiver clock and data signals on the upper cable pins A zero 0 disables them u8EnableRxCableLower A value of one 1 enables the receiver clock and data signals on the lower cable pins A zero 0 disables them 3 2 22 SIO4 INTERRUPT STATUS This structure records the interrupt status bits from the SIO4 Interrupt Status Register for the current channel The bits reflect the accumulated status since the last interrupt notification or status request Definition typedef struct IntStatus UINT8 u8SIO4Status S 104 INT RRU PT_STATUS El Fields Description u8SIO4Status The channels interrupt status from the Interrupt Status Register This may consist of either four or eight bits depending on the board s capabilities 3 2 23 SIO4_ MODE This enumeration defines the possible USC data routing and test mode options 42 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual Definition typedef enum SIO4Mode SIO4 MODE Fields Description AUTO ECHO Echo all receive data out the transmitter EXT LOCAL LOOPBACK Route data through the USC s Local Loopback circuitry INT LOCAL LOOPBACK Route data through the USC s Internal Local Loopback circuitry NORMAL Route transmit data out the transmitter and receive data into the
99. int sio4 rx fifo full config int fd 832 set s32 get int verbose int status status ioctl fd SIO4 RX FIFO FULL CONFIG amp set if get get 0 set if verbose amp amp status 1 printf ioctl failure errno d n errno return status 80 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual 3 4 41 SIO4_RX_FIFO_SIZE This service retrieves the size of the Rx FIFO The value obtained is either the capacity of the Rx FIFO in bytes or the corresponding XXX_ UNKNOWN macro if the Rx FIFO Size Register is unsupported Usage ioctl Argument Description request SIO4 RX FIFO SIZI E arg 332 Example include include include include include int sio4_ int s statu at p retur 3 4 42 SIO4_RX_FI This service reports the Rx FIFO s firmware hardware type implementation The value obtained is either the FIFO s verbose lt errno h gt lt stdio h gt lt unistd h gt lt sys ioctl h gt SIO4DocSrcLib h rx fifo size int fd s32 get int verbose tatus ioctl fd Ss SIO4 RX FIFO SIZE get amp amp statu rintf ioctl failure 1 errno Sd n errno n status FO TYPE type or the corresponding XXX UNKNOWN macro if the type cannot be determined Usage ioctl Argument Description request SI
100. io4 should be included in the output lsmod 5 Verify that the device nodes have been created by issuing the below command and examining the output The output should include four nodes for each installed board ls 1 dev sio4 2 7 2 2 Automatic Driver Startup Procedures Start the driver automatically with each system reboot by following the below listed steps 1 Locate and edit the system startup script rc local which should be in the etc rc d directory Modify the file by adding the below line so that it is executed with every reboot usr src linux drivers sio4 driver sio4 start NOTE The script s default specifies that the driver is installed in the same directory as the script The startup script will fail 1f this is not so 2 Load the driver and create the required device nodes by rebooting the system 3 Verify that the driver is loaded and that the device nodes have been created by following the verification steps given in the manual startup procedures 2 7 3 Verification Follow the below steps to verify that the driver has been properly installed and started 1 Issue the below command to view the content of the driver s proc file system text file 15 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual cat proc sio4 2 If the file exists then the driver is installed and running 2 7 4 Version The driver version number can be obtained in a variety of ways It i
101. ion later in this document for more information Usage ioctl Argument Description request SIO4 OSC PROGRAM arg sio4 osc t Example include lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 osc program int fd s32 want _ s32 got int verbose 68 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual sio4 osc t osc int status osc freq want want status ioctl fd SIO4 OSC PROGRAM amp osc if got got 0 osc freq got if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 24 SIO4_OSC_REFERENCE This service is used to update and report on the recorded frequency for the channel s reference source Changing this setting does not alter any existing programming results New settings apply to subsequent calculations only The only argument field used by the driver is the freq_ref field If its value is 1 then the driver will report the current recorded reference frequency The value supplied will otherwise be qualified per the requirements of the channel s oscillator and recorded for subsequent use An error will be reported if it is invalid The driver ignores all other fields and fills them in according to the channel s current configuration This service does not alter any other oscillator related parame
102. l NOTE The driver has not been tested on an SMP host 2 2 Compiler Support The build for this driver relies on the use of the GCC compiler This dependence is due only to the driver s use of the file divdi3 c which is copied from GCC 2 95 1 The driver build process has been verified according to the above CPU and kernel support paragraph The build process may fail under other build environments NOTE The dependence on the GCC compiler is due to the driver s use of 64 bit integer division This division is performed during configuration of the programmable oscillator present on some versions of the SIO4 Under the 2 2 and 2 4 kernels the needed library services are linked implicitly during the build process Under the 2 6 kernel build process the needed services must be linked explicitly 2 3 The proc File System While the driver is installed the proc sio4 file can be read to obtain information about the driver Each file entry includes an entry name followed immediately by a colon a space character and then the entry value Below is an example of what appears in the file followed by descriptions of each entry version 1 18 built Sep 30 2005 12 46 43 boards 1 z16c30 1 sync 0 Entry Description version This gives the driver version number in the form x xx built This gives the driver build date and time as a string It is given in the C form of printf s ss DATE TIME boards T
103. l Base Address Register for Direct Master to PCI IO CFG DMLBAI Local Base Address Register for Direct Master to PCI Memory DMLBAM PCI Base Address Register for Direct Master to PCI Memory DMPBAM Local Range Register for Direct Master to PCI DMRR Local Address Space 0 Local Base Address Register LASOBA Local Address Space 0 Range Register for PCI to Local Bus LASORR Local Address Space 1 Local Base Address Register LASIBA Local Address Space 1 Range Register for PCI to Local Bus LASIRR Local Address Space 0 Expansion ROM Bus Region Descriptor Register LBRDO SIO4 PLX DMCFGA SIO4 PLX DMLBAI SIO4 PLX DMLBAM SIO4 PLX DMPBAM SIO4 PLX DMRR SIO4 PLX LASOBA SIO4 PLX LASORR SIO4 PLX LAS1BA SIO4 PLX LASIRR SIO4 PLX LBRDO SIO4 PLX LBRD1 Local Address Space 1 Bus Region Descriptor Register LBRD1 SIO4 PLX MARBR Mode Arbitration Register MARBR 26 General Standards Corporation Phone 256 880 8787 Runtime Registers SIO4 Linux Device Driver User Manual Macros Description SIO4 PLX CNTRL Serial EEPROM Control CPI Command Codes User I O Init Control Register CNTRL SIO4 PLX INTCSR Interrupt Control Status Register INTCSR SIO4 PLX L2PDBELL Local to PCI Doorbell Register L2PDBELL SIO4 PLX MBOXO Mailbo
104. lock source The only CLOCK_SOURCE enumeration values that are valid options for this IOCTL are those listed below e Counter 0 e Counter 1 e The RxC pin e The TxC pin Usage ioctl Argument Description request SIO4 SET BRG1 SOURCE arg CLOCK SOURCE Example include lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h T int sio4 brgl set clock source int fd CLOCK SOURCE src int verbose int status status ioctl fd SIO4 SET BRG1 SOURCE src if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 52 SIO4_SET_CTRO_SOURCE This service sets the USC channel s Counter 0 clock source The only CLOCK_ SOURCE enumeration values that are valid options for this IOCTL are those listed below e Disable the counter e The RxC pin e The TxC pin 87 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual Usage ioctl Argument Description request SIO4 SET CTRO SOURCE arg CLOCK SOURCE Example tinclude lt errno h gt tinclude lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 ctr0 set clock source int fd CLOCK SOURCI int status status ioctl fd SIO4 SET CTRO0 SOURCE src
105. lude include SIO4DocSrcLib h int sio4_ int status rxc usc config int fd s32 set _ s32 get int verbose status ioctl fd SIO4 RXC USC CONFIG amp set if get get 0 set if verbose amp amp status 1 printf ioctl failure errno d n errno 83 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual return status 3 4 46 SIO4_SELECT_DPLL_RESYNC This service sets the resynchronization option for the USC channel s Digital Phase Lock Loop Usage ioctl Argument Description request SIO4 SELECT DPLL RESYNC arg DPLL RESYNC Example include lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 dpll set resync int fd DPLL R int status status ioctl fd SIO4 SELECT DPLL R if verbose amp amp status 1 printf ioctl failure errno ESYNC resync int verbose ESYNC resync return status 3 4 47 SIO4_SEND_CHANNEL_COMMAND This service sends a command to the channel s command register Usage Sd n errno ioctl Argument Description request SIO4 SEND CHANNEL COMMAND arg SIO4 CHAN CMD Example include include include include include int sio4_ int lt errno h gt lt
106. lude lt errno h gt include lt stdio h gt 102 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 tx fifo count int fd _ s32 get int status int verbose status ioctl fd SIO4 TX FIFO COUNT get if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 76 SIO4_TX_FIFO_SIZE This service retrieves the size of the Tx FIFO The value obtained is either the capacity of the Tx FIFO in bytes or the corresponding XXX_UNKNOWN macro if the Tx FIFO Size Register is unsupported Usage ioctl Argument request arg Description SIO4 TX FIFO SIZI BAN El Example lt errno h gt lt stdio h gt lt unistd h gt lt sys ioctl h gt include include include include include SIO4DocSrcLib h int sio4 tx fifo size int fd _ s32 get int status int verbose status ioctl fd SIO4_TX_FIFO_SIZE get if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 77 SIO4 TX FIFO TYPE This service reports the Tx FIFO s firmware hardware type implementation The value obtained is either the FIFO s type or the corresponding XXX UNKNOWN macro if the type cannot be determined 103 General Standards Corporation Ph
107. ment Description request SIO4 SET XMT HDLC SDLC LOOP PROT arg XMT HDLC SDLC LOOP PROTOCOL Example tinclude lt errno h gt tinclude lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 hdlc sdlc loop setup rx int fd int verbose XMT HDLC SDLC LOOP PROTOCOL parm int status parm u8SharedZeroFlags 1 parm u8TxActiveOnPoll 0 parm eTxUnderrun ABORT COND status ioctl fd SIO4 SET XMT HDLC SDLC LOOP PROT amp parm if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 69 SIO4_SET_XMT_ISOCHR_PROT This service configures the transmitter specific Isochronous parameters Usage ioctl Argument Description request SIO4 SET XMT ISOCHR PROT arg XMT ISOCHR PROTOCOL Example include lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 isochr setup tx int fd UINT8 two stop bits int verbose 98 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual pa XMT ISOCHR PROTOCOL j st int parm u8TwoStopBits cm atus two stop bits status ioctl fd SIO4 SET XMT ISOCHR PROT amp parm if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 70 SIO4_TX
108. meters for the HDLC SDLC Loop protocol Definition typedef struct XmtHDLCSDLCLoopProtocol 47 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual UINT8 u8SharedZeroFlags UINT8 u8TxActiveOnPoll TX UNDERRUN eTxUnderrun XMT HDLC SDLC LOOP PROTOCOL Fields Description u8SharedZeroFlags This specifies that consecutive Flags do shared 1 or do not share 0 the Zero u8TxActiveOnPoll This specifies the disable repeat 0 and inserts send 1 options eTxUnderrun This specifies the transmitter response to an under run condition 3 2 40 XMT ISOCHR PROTOCOL This structure defines the available transmitter parameters for the Isochronous protocol Definition typedef struct XmtISOCHRProt UINT8 u8TwoStopBits XMT ISOCHR PROTOCOL Fields Description u8TwoStopBits A value of zero 0 specifies to use one stop bit and a value of one specified two stop bits 3 3 Functions This driver interface includes the following functions 3 3 1 close This function is the entry point to close a connection to an open SIO4 serial channel This function should only be called after a successful open of the respective device Upon closing the channel all settings and configurations are put in a reset state The programmable oscillator reference frequency is unaffected Prototype int close int fd Argument Description fd This is th
109. ndards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual 3 1 18 SIO4_TX_CABLE_CONFIG Options This set of macros defines the options available for the STO4 TX CABLE CONFIG IOCTL service Macros set and get options Description SIO4 TX CABLE CONFIG BOTH The transmitter is connected to both the upper and the lower cable portions so that both are driven in parallel SIO4 TX CABLE CONFIG DISABLE Disconnect the transmitter from the cable SIO4 TX CABLE CONFIG LOWER The transmitter is connected to the lower cable portion SIO4 TX CABLE CONFIG UPPER The transmitter is connected to the upper cable portion Macros set only options Description SIO4 TX CABLE CONFIG READ Retrieve the current configuration Macros get only options Description SIO4 TX CAB E CONFIG INVALID The current configuration is invalid 3 1 19 SIO4 TX CABLE DATA CONFIG Options This set of macros defines the options available for the SIO4 TX CABLE page 100 DATA CONFIG IOCTL service see Macros set and get options Description SIO4 TX CAB E DATA CONFIG DRV LOW An output driven low SIO4 TX CAB T F DATA CONFIG DRV HI An output driven high SIO4 TX CAB Ta F DATA CONFIG _USC_TXD Output the USC s TxD output signal Macr
110. neral Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual Disable E Clock Cable amp Data Upper Pins Disable p g Clock a Cable amp Data ee 3 Lower Pins Figure 2 Cable pin location options for the data and clock signals 4 1 2 Tx and Rx Clocks The SIO4 includes a Tx Clock cable signal TxClk and an Rx Clock cable signal RxCIk though they are not always used TxClk is always an output and RxClk is always an input The table below identifies the driver services used to configure routing of the clock signals Signal Description Driver Service RxClk This is not configurable None TxC This can be configured to input any of the listed sources It SIO4 TXC USC CONFIG can also be configured to output an internal USC clock IOCTL page 105 options page 33 source RxC This can be configured to input any of the listed sources It SIO4_RXC_USC_ CONFIG can also be configured to output an internal USC clock IOCTL page 83 options page 32 source TxClk This can be configured to output any of the listed sources SIO4 TX CABLE CLOCK CONFIG IOCTL page 99 options page 33 Prog Osc e e gt Hi gt Low e e gt Q E 2 Cable RxClk e
111. nition typedef struct RcvHDLCProtocol ADDR SEARCH MODE eAddrSearchMode UINT8 i u816BitControlEnable UINT8 u8LogicalControlEnable RCV HDLC PROTOCOL Fields Description eAddrSearchMode This specifies the address search mode u816BitControlEnable Use 16 bit control words for extended search u8LogicalControlEnable Use logical controls for extended search 3 2 16 REGISTER MOD PARAMS This structure defines the data fields applicable to performing register read modify write operations with the SIO4 MOD REGISTER IOCTL service Definition typedef struct RegisterModParams UINT32 u32RegisterNumber UINT32 u32Value UINT32 u32Mask REGISTER MOD PARAMS Fields Description u32RegisterNumber This identifies the register to access u32Value This is the value for the bits to modify u32Mask This is the set of bits to modify If a bit 1s set then the bit from the above field 1s applied If a bit is clear then that register bit is unchanged 3 2 17 REGISTER PARAMS This structure defines the data fields applicable to reading from and writing to SIO4 registers Definition typedef struct RegisterParams UINT32 u32RegisterNumber UINT32 u32Value REGISTER PARAMS 39 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual Fields Description u32RegisterNum
112. ns cccccceseesseesseesceesceesceecesecsecseecnaeceseeeeeeecsseeeseensecesesreseeenseeeaeenaeenaes 109 Figure 4 Cable data signal routing options sess enn en nnne en nnne nre 110 Figure 5 Cable CTS signal routing options sessssssssessesseseeeee eene en nnne en nennen nnns 110 Figure 6 Cable DCD signal routing options cccccceecsessseesceesceecesecesecsaecececaeecaeeeaeeeneseeeseseaeeeseeeeerenseeneeneenaeenaes 111 9 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual 1 Introduction This user manual applies to driver version 1 18 release 2 This release of the driver is intended for those SIO4 models that use the Zilog Z16C30 dual USC chips WARNING Driver versions 1 06 and 1 18 and later are not run time compatible with previous versions of the driver Applications written to versions 1 05 and 1 17 and earlier must be rebuilt before using a later version Additionally various components of the 1 05 and earlier interface have been updated and a few are no longer available Application may need a porting effort or they may optionally include the header sio4 legacy h to continue using some of the available but deprecated components Some deprecated components are not available via this legacy header NOTE The device models listed on the front cover are those that are specifically supported by this release of the driver Other models may be supported th
113. nsupported then the corresponding XXX UNKNOWN macro is returned If the feature is supported but the configuration is invalid then the corresponding XXX INVALID macro is returned 54 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual Usage ioctl Argument Description request SIO4 CTS CABLE CONFIG arg s32 see page 29 for valid values Example tinclude lt errno h gt tinclude lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 cts cable config int fd _ s32 set int status __s32 get int verbose status ioctl fd SIO4 CTS CABLE CONFIG amp set if get get 0 set if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 5 SIO4_DCD_CABLE_CONFIG This service configures the cable s DCD signal and retrieves its current configuration If one of the predefined configurations is requested it is applied If the corresponding XXX RI EAD macro is supplied then the current configuration is not changed Before returning the current configuration is obtained and reported to the caller If the feature is unsupported then the corresponding XXX UNKNOWN macro is returned If the feature is supported but the configuration is invalid then the corresponding XXX_ INVALID macro is returned
114. nt 92 3 4 60 SIO4 SET RCV ISOCHR O aret et 93 A A eare reae teers att 93 3 4 62 SIO4 SET RX ar A 94 34 63 SIO4 SET SYNC TEN e one n d Ue ae sedem E Ed mentis 94 3 4 64 SIO4 SET TX_ CLOCK SOUBGB el ee eue edits ues nates sea EU LL El Lr d 95 3 4 65 SIO4 SET WRITE A iie it bem s ded 96 3 4 66 SIO4 SET XM T ASYNGCCPBOT I a e e d Sales es 96 3 4 67 SIO4 SET XMT HDLC Rd de e nte te 97 3 4 68 SIO4 SET XMT HDLC SDLC LOOP PRO nte rece tt x tet e rta 98 3 4 69 SIO4 SET XMT ISOCHR PROT sos rccte petite etel tn doeet tn tote ue tote ie D trt 98 3 4 70 SIO4 TX CABLE CLOCK CONFIG ns 99 34 71 SIO4 TX CABLE CONFI Gaii eenn O aetna 100 3 4 72 SIO4 TX CABLE DATA CONFIG ad 100 3 4 73 SIO4 TX FIFO AB CONE ot 101 3 4 74 SIO4 TX FIFO AF CONEIG dina 102 a ARRE RE LE 102 3 4 76 SIO4_TX_FIFO SIZE iii ioiii PR aiaa en M E E 103 A AE R ARA MCN R MD LE 103 34 78 RIO TX TO AOR T nnee nonien e a a E a ARE AERE R 104 3 4 79 SIO4 TX TO MODE ONG ld 105 3 4 80 SIO4 EXC USC CONFIG i 105 3 4 81 SIO4 WRITE REGISTER 24 ctt tto coe mro b etie ttu tentia miei ats enema 106 4 Operation E c rl EL 4 1 Signal Routing M nono nos 108 4 1 1 Data and Clock Cable Pin Locations ennemis 108 4 12 Tx and Rx COCKS i eich eiit a eee eee 109 4 13 Tx and Rx Data teet ete aae tee aai np HG 110 4 Id CLS sine Beet eaaet rer ea e ag e trn p RE d 110 AI DIE D ZEEE E E A A uated ei adie ec veda tetas asbeste e
115. o h gt lt stdio h gt lt unistd h gt lt sys ioctl h gt SIOADocSrcLib h feature test int fd s32 set _ s32 get 2 arg set status ioctl fd EATURE T us SIO4 F EST amp arg get get 0 arg 1 errno verbose amp amp status printf ioctl failure Sd n 57 General Standards Corporation Phone 256 880 8787 int verbose errno SIO4 Linux Device Driver User Manual return status 3 4 9 SIO4_GET_DRIVER_INFO This service retrieves information about the driver itself At this time this includes only a driver version string Usage ioctl Argument Description request SIO4 GET DRIVER INFO arg SIO4 DRIVER INFO Example include lt errno h gt tinclude lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 driver info get int fd SIO4 DRIVER INFO info int status status ioctl fd SIO4 GET DRIVER INFO info if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 10 SIO4 INIT BOARD int verbose This service initializes all of the board s hardware This includes the USCs the FIFOs the cable configurations the transceivers and the programmable oscillators For boards with programmable oscillators and programmable transceivers these features are initialized in preparation
116. ognized Oy GI SIO4 MP PROT READ This requests that the driver report the current protocol SIO4 MP PROT RS 232 This refers to the RS 232 protocol SIO4 MP PROT RS 422 485 This refers to the RS 422 RS 485 protocols SIO4 MP PROT RS 423 This refers to the RS 423 protocol 43 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual SIO4 MP PROT UNKNOWN This is returned by the driver when the protocol is unknown 3 2 26 sio4_mp_t This data structure is used to exchange information and requests about the board s Multi Protocol transceiver feature between applications and the driver This structure is used with the Multi Protocol transceiver based IOCTL services Refers to the specific service for information on how this structure is used Definition typedef struct _ 832 chip 32 prot want 32 prot got sio4 mp t Field Description chip The driver will fill this field in with the Multi Protocol transceiver chip identifier Refer tothe sio4 mp chip t data type documentation elsewhere in this document prot want This refers to the protocol desired by the application prot got This refers to the protocol reported by the device 3 2 27 sio4 osc chip t This enumeration identifies the supported options for identifying the programmable oscillator feature on the SIOA Th
117. ome that are no longer in use The files are installed into the usr src linux drivers sio4 docsrc directory The files included are listed below NOTE This source code library is common across all SIO4 models supported by the driver and may include some code samples intended for SIO4 models not listed on the cover page of this user manual The sample code may work with other unlisted models but may not function as expected since they may not necessarily be intended for these models Library code not referenced in this user manual should generally not be used with those models listed on the cover page For other SIO4 models refer to the applicable driver user manual File Description uo These are the sources which correspond to the samples in this user manual makefile This is the library make file makefile dep This is a make dependency file This is updated automatically SIO4DocSrcLib a This is a pre built version of the library SIO4DocSrcLib h This is a header file that gives the prototypes for all library functions 16 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual 2 8 1 1 Build Follow the below steps to compile the example files 1 Change to the directory where the source code example files were installed This should be usr src linux drivers sio4 docsrc 2 Remove all existing build targets by issuing the below command make clean 3 Compile t
118. on request SIO4 OSC TEST arg sio4 osc t Example include lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4_osc_test int fd _ s32 want _ s32 got int verbose Sio4 osc t osc int status osc freq want want status ioctl fd SIO4_OSC_ TEST amp osc got 0 osc freq got if verbose amp amp status 1 printf ioctl failure errno din errno return status 3 4 27 SIO4_READ_FIFO_STATUS This service reads the status of the channel s Tx and Rx FIFOs The value reported by this service includes the status of both FIFOs packed into the lower eight bits of the parameter storage This value must be decoded to obtain the proper status information Usage ioctl Argument Description request S104 READ FIFO STATUS arg FIFO STATUS Example include lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 fifo read_status int fd FIFO STATUS tx FIFO STATUS rx int verbose 71 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual FIFO STATUS fifo int status status ioctl fd SIO4 READ FIFO STATUS amp fifo if tx tx 0 OxF amp fifo if rx rx 0 OxF amp fifo gt gt 4 if verbose amp amp status 1 printf ioc
119. one 256 880 8787 SIO4 Linux Device Driver User Manual Usage ioctl Argument Description request SIO4 TX FIFO TYPE arg s32 Example tinclude lt errno h gt tinclude lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 tx fifo type int fd _ s32 get int verbose int status status ioctl fd SIO4 TX FIFO TYPE get if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 78 SIO4 TX IO ABORT This service aborts an active data write operation an active write request This has no affect if no such request is active and it has no affect on future requests Usage ioctl Argument Description request SIO4 TX IO ABORT arg Unused Example tinclude lt errno h gt tinclude lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 tx io abort int fd int verbose int status status ioctl fd SIO4 TX IO ABORT if verbose amp amp status 1 printf ioctl failure errno d n errno 104 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual return status 3 4 79 SIO4_TX_1O_MODE_CONFIG This service updates and reports the mode used by the driver for data write operations This refers to how data is moved from ho
120. ons is requested it is applied If the corresponding XXX_READ macro is supplied then the current configuration is not changed Before returning the current configuration is obtained and reported to the caller If the configuration is invalid then the corresponding XXX INVALID macro is returned Usage ioctl Argument Description request SIO4 TX CABLE CONFIG arg s32 Example tinclude lt errno h gt tinclude lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 tx cable config int fd s32 set _ s32 get int verbose int status status ioctl fd SIO4 TX CABLE CONFIG amp set if get get 0 set if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 72 SIOA TX CABLE DATA CONFIG This service configures the channel s use of the Tx Cable Data signal and retrieves its current configuration If one of the predefined configurations is requested it is applied If the corresponding XXX READ macro is supplied then the current configuration is not changed Before returning the current configuration is obtained and reported to the caller If the feature is unsupported then the corresponding XXX UNKNOWN macro is returned If the feature is supported but the configuration is invalid then the corresponding XXX INVALID macro is returned Usage ioctl
121. or the corresponding XXX_UNKNOWN macro if the Rx FIFO Count Register is unsupported Usage ioctl Argument Description request SIO4 RX FIFO COUNT arg 832 Example include include include include include lt errno h gt lt stdio h gt lt unistd h gt lt sys ioctl h gt SIOADocSrcLib h 79 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual int sio4 rx fifo count int fd _ s32 get int verbose int status status ioctl fd SIO4 RX FIFO COUNT get if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 40 SIO4_RX_FIFO_FULL_CONFIG This service configures how the receiver responds to an Rx FIFO Full condition and reports on the current configuration If one of the predefined configurations is requested it is applied If the corresponding XXX RI macro is supplied then the current configuration is not changed Before returning the current configuratio EAD n is obtained and reported to the caller If the feature is not configurable on the current board then no change can be applied Usage ioctl Argument Description request SIO4 RX FIFO FULL CONFIG arg 332 Example include lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h
122. os set only options Description SIO4 TX CAB E DATA CONFIG R E AD Retrieve the current configuration Macros get only options Description SIO4 TX CAB E DATA CONFIG INVALID The current configuration is invalid SIO4 TX CAB T F DATA CONFIG UNKNOWN The current configuration is unknown 3 1 20 SIO4_TXC_USC_CONFIG Options This set of macros defines the options available for the STO4_TXC_USC_CONFIG IOCTL service Macros set and get options Description SIO4 TXC USC CONFIG IN CBL RC_ An input from the cable s RxClk signal SIO4 TXC USC CONFIG IN HI An input driven high SIO4 TXC USC CONFIG IN LOW An input driven low SIO4 TXC USC CONFIG IN PRG CLK An input from the programmable clock SIO4 TXC USC CONFIG OUT BRGO Output the BRGO output signal SIO4 TXC USC CONFIG OUT BRG1 Output the BRGI output signal SIO4 TXC USC CONFIG OUT CTR1 Output the CTR1 output signal SIO4 TXC USC CONFIG OUT DPLL Output the DPLL output signal SIO4 TXC USC CONFIG OUT TCC Output the USC s Transmit char clock signal SIO4 TXC USC CONFIG OUT TCLK Output the USC s TxClk signal SIO4 TXC USC CONFIG OUT TCOMP Output the USC Transmit Complete signal Macros set only options Description SIO4 TXC USC CONFIG READ Retrieve the current configuration 3
123. ough the level of support may vary The driver may work with other SIO4 models but performance may be degraded due to device feature and implementation differences 1 1 Purpose The purpose of this document is to describe the interface to the SIO4 Linux Device Driver This software provides the interface between Application Software and the SIO4 board The interface to this board is at the device level 1 2 Acronyms The following is a list of commonly occurring acronyms used throughout this document Acronyms Description DMA Direct Memory Access DMDMA Demand Mode DMA DPLL Digital Phase Lock Loop GSC General Standards Corporation PCI Peripheral Component Interconnect PMC PCI Mezzanine Card USC Universal Serial Controller 1 3 Definitions The following is a list of commonly occurring terms used throughout this document Term Definition Driver Driver means the kernel mode device driver which runs in the kernel space with kernel mode privileges Application Application means the user mode process which runs in the user space with user mode privileges 1 4 Software Overview The SIO4 driver software executes under control of the Linux operating system and runs in Kernel Mode as a Kernel Mode device driver The SIO4 device driver is implemented as a standard loadable Linux device driver written in the C programming language With the driver user applications ar
124. product or circuit described herein nor is any license conveyed under any patent rights or any rights of others General Standards Corporation assumes no responsibility for any consequences resulting from omissions or errors in this manual or from the use of information contained herein General Standards Corporation reserves the right to make any changes without notice to this product to improve reliability performance function or design ALL RIGHTS RESERVED The Purchaser of this software may use or modify in source form the subject software but not to re market or distribute it to outside agencies or separate internal company divisions The software however may be embedded in the Purchaser s distributed software In the event the Purchaser s customers require the software source code then they would have to purchase their own copy of the software General Standards Corporation makes no warranty of any kind with regard to this software including but not limited to the implied warranties of merchantability and fitness for a particular purpose and makes this software available solely on an as is basis General Standards Corporation reserves the right to make changes in this software without reservation and without notification to its users The information in this document is subject to change without notice This document may be copied or reproduced provided it is in support of products from General Standards Corporation Fo
125. ption chip The driver will fill this field in with the oscillator chip identifier Refer to the sio4 osc chip t data type documentation elsewhere in this document freq ref This refers to the frequency of the oscillator s reference source freq want This refers to the clock output frequency desired by the application freq got This refers to the clock output frequency produced by the device 3 2 29 STATUS_BLOCK_OPTIONS This enumeration defines the possible Receive Status Block and Transmit Control Block selection options for USC FIFO DMA operations Definition typedef enum StatusBlockOptions STATUS BLOCK OPTIONS Fields Description NO STATUS BLOCK Do not use Receive Status Blocks ONE WORD STATUS BLOCK Use 16 bit Receive Status Blocks TWO WORD STATUS BLOCK Use 32 bit Receive Status Blocks 3 2 30 STOP BITS This enumeration defines the possible transmitter stop bit selection options for the Asynchronous protocol Definition typedef enum StopBits STOP BITS Fields Description ONE STOP BIT Use one stop bit ONE STOP BIT SHAVED Use one shaved stop bit TWO STOP BITS Use two stop bits TWO STOP BITS SHAVED Use one full and one shaved stop bit NOTE The number of 1 16 bits shaved is determined by the TxShaveL field of the USC Channel Command Register 45 General Standards Corporation Phone 2
126. put the USC s TxClk signal SIO4 RXC USC CONFIG OUT TCOMP Output the USC Transmit Complete signal Macros set only options Description SIO4 RXC USC CONFIG READ Retrieve the current configuration Macros get only options Description SIO4 RXC USC CONFIG INVALID The current configuration is invalid SIO4 RXC USC CONFIG UNKNOWN The current configuration is unknown 3 1 17 SIO4 TX CABLE CLOCK CONFIG Options This set of macros defines the options available for the SIO4 TX CABLE T CLOCK CONFIG IOCTL service Macros set and get options Description SIO4 TX CABLE CLOCK CONFIG CBL RC Output the cable s RxCIk input signal SIO4 TX CABLE CLOCK CONFIG DRV HI An output driven high SIO4 TX CABLE CLOCK CONFIG DRV LOW An output driven low SIO4 TX CABLE CLOCK CONFIG PRG CLK Output the programmable clock output SIO4 TX CABLE CLOCK CONFIG USC RC Output the USC s RxCIk output signal SIO4 TX CABLE CLOCK CONFIG USC TC Output the USC s TxCIk output signal Macros set only options Description SIO4 TX CABLE CLOCK CONFIG READ Retrieve the current configuration Macros get only options Description SIO4 TX CABLE CLOCK CONFIG INVALID The current configuration is invalid SIO4 TX CABLE CLOCK CONFIG UNKNOWN The current configuration is unknown 32 General Sta
127. r any other use no part of this document may be copied or reproduced in any form or by any means without prior written consent of General Standards Corporation GSC is a trademark of General Standards Corporation PLX and PLX Technology are trademarks of PLX Technology Inc Zilog and Z16C30 are trademarks of Zilog Inc 3 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual Table of Contents A NL T T Purpose ii A ei 10 VDA CONAN MS ii A A ii 10 DIO AAA 10 YES ERIN foem 10 1 5 Hardware Overview csccsccssscsssssscssssssscssscsscsssssscssscssssssssssscnsesnsessssssesesenessseessssssesssnsecnsesesesseseseneseneeseeees 11 1 6 Reference Material me M MA 11 2 1 CPU and Kernel Support 4 eerie eee eee eee esten setenta setas ts connconoc coca nocn setas ta seta seta sess stesse senses sense snae 12 2 2 Compiler SUPport e 12 ZFS PLO O A 12 DA Eile A O UNO UTN 12 2 5 Directory AAA TN 13 AMADO AAA 13 AS ccssenssssocesenssesonevesunoscesssevssesseseute T susscseasense T descesesarsunssecensdeunsecuassonbsdescssenseceenss 14 AS A EE EE 14 DL nter s ei taie E ere NU DIA 14 2 77 23 VerttiCatloto A cir E a 15 2 RVS SOM tote hes Let ao Macc tae nd tein tot tM aR Lon Ms erc Mir de hs A 16 2 15 ButdoWHns AO 16 2 8 Document Source Code Examples 4 eeeeee esee ee esee eese eee
128. rcLib h int sio4 no function int fd int verbose int status status ioctl fd SIO4 NO FUNCTION if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 15 SIO4 MP CONFIG This service is used to select and or report on the current transceiver protocol The driver uses the prot want field and ignores all others The results are recorded in the data structure s prot got field Refer to the Multi Protocol transceiver programming information later in this document for more information NOTE The driver will fulfill the request based on the SIO4 s capabilities When the protocol can be changed and that requested is available the requested change will be selected Requests will otherwise fail and the protocol will be unchanged Usage ioctl Argument Description request SIO4 MP CONFIG arg sio4 mp t Example include lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt 62 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual tinclude SIO4DocSrcLib h int sio4 mp config int fd _s32 want _ s32 got int verbose sio4 mp t mp int status mp prot want want status ioctl fd SIO4 MP CONFIG amp mp if got got 0 mp prot got if verbose amp amp status 1 printf ioctl failure errno d n errno return status
129. received 3 2 24 sio4 mp chip t This enumeration identifies the supported options for identifying the Multi Protocol transceiver feature on the SIO4 The values are used in the chip field of the sio4 mp t data structure which is used with the Multi Protocol transceiver based IOCTL services Refers to the specific service for information on how this structure is used Definition typedef enum sio4 mp chip t Values Description SIO4 MP CHIP FIXED This refers to a fixed protocol implementation The driver may not know which protocol is implemented on the SIO4 SIO4 MP CHIP SP508 This refers to the Sipex SP508 Multi Protocol transceiver chip SIO4 MP CHIP UNKNOWN The chip type is unknown 3 2 25 sio4 mp prot t This enumeration identifies the protocol options supported by the Multi Protocol transceiver driver The values are used in the want and got fields of the sio4 mp t data structure which is used with the Multi Protocol transceiver based IOCTL services Refers to the specific service for information on how this structure is used Refer to the hardware user manual for detailed explanations of each protocol options Definition typedef enum sio4 mp prot t Values Description SIO4 MP PROT DISABLI This refers to the disabled or tri stated condition SIO4 MP PROT INVALI This is returned by the driver when a requested protocol is unsupported or unrec
130. reference frequency when the driver is first loaded If it cannot be measures then it is initialized to 20MHz Thereafter the reference frequency is changed only when done explicitly by application requests using the SIO4_OSC_REFERENCE IOCTL service 1 Determine if the driver is able to perform oscillator programming for the device This can be done using the SIO4 FEATURE TEST IOCTL service on the SIO4 FEATURE OSC PROGRAM feature If the feature in unsupported then do not attempt programming Attempting to use the driver s built in programming features will be unsuccessful when this feature is unsupported If the feature is supported then continue with the following steps 2 Tell the driver the SIO4 s reference frequency This is done using the SI04 OSC REFERENCE IOCTL service The specified reference frequency is applicable to all channels since the SIO4 has only a single reference oscillator The specified reference frequency is used for subsequent operations only 3 Reset the channel s clock This is done using the S104 OSC RESET IOCTL service Depending on the oscillator this may disable the channel s clock Depending on the SIOA this effort may affect all channels 4 Initialize the channel s clock This is done using the S104 OSC INIT IOCTL service Depending on the oscillator this should configure the channel to output the reference frequency Depending on t
131. request SIO4 WRITE REGISTER arg REGISTER PARAMS 106 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual Example tinclude lt errno h gt tinclude lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 reg write int fd _u32 reg _ u32 value int verbose REGISTER PARAMS parm int status parm u32RegisterNumber reg parm u32Value value status ioctl fd SIO4 WRITE REGISTER amp parm if verbose amp amp status 1 printf ioctl failure errno d n errno return status 107 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual 4 Operation This section explains some operational procedures on using the driver This is in no way intended to be a comprehensive guide on using the SIO4 and makes no attempt at explaining configuration of the Zilog Z16C30 This is simply to address a very few issues relating to GSC specific features of the SIO4 4 1 Signal Routing One of the basic requirements for proper operation of the SIO4 is defining how various signals are to be used This section gives on overview of the SIO4 s signal routing options including references to the applicable driver services On newer SIO4s signal routing is controlled by firmware only On older boards signal routing also requires manual adjustment of on board
132. required 7 When finished issue the SIO4 INT NOTIFY IOCTL service with an argument value of zero 0 to specify that notification be terminated Example include include include include include include include lt errno h gt fcntl h lt signal h gt lt stdio h gt lt unistd h gt lt sys ioctl h gt STO4DocSrcLib h static int _ fd static void handle sigio int signo SIO4 INTERRUPT STATUS int_stat int status status ioctl fd SIO4 READ INT STATUS amp int stat if status 1 else if int stat u8SIO4Status amp SIO4 INT NOTIFY TX FIFO AE int sio4_ int The request failed async setup int fd flags unsigned char notify EY Handle the Tx FIFO Almost Empty condition 116 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual pid t pid int status ioctl fd SIO4 INT NOTIFY 0 fd tad signal SIGIO handle sigio pid getpid fcn fla fla fcn not sta ret tl fd F SETOWN pid gs fcntl fd F GETFL gs FASYNC tl fd F_SETFL flags ify SIO4 INT NOTIFY TX FIFO AE tus ioctl fd SIO4 INT NOTIFY notify urn status 117 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual Document History Revision Description September 30 2005
133. results are dependent on the board s capabilities Refer to the hardware manual for additional details 67 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual Usage ioctl Argument Description request SIO4 OSC MEASURE arg sio4 osc t Example tinclude lt errno h gt tinclude lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 osc measure int fd _ s32 freq got int verbose sio4 osc t osc int status status ioctl fd SIO4 OSC MEASURE amp osc freq got 0 osc freq got if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 23 SIO4_OSC_PROGRAM This service is used to update and report on the programmed frequency produced by the channel s oscillator hardware This service will reprogram the channel s oscillator hardware to produce the requested frequency or one as near as possible to that requested The resulting frequency will depend on the capability of the hardware and how its resources are being used as applicable If the requested value is 1 then the service will report the channel s current configuration without making any changes The driver ignores all other fields and fills them in according to the channel s post programming configuration Refer to the oscillator programming informat
134. rvice returns current configuration information about the channel s oscillator The driver ignores the structure s current content and fills in all fields according to the channel s current configuration Refer to the oscillator programming information later in this document for more information Usage ioctl Argument Description request SIO4 OSC INFO arg sio4 osc t Example include lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 osc info int fd u32 chip s32 freq ref s32 freq want s32 freq got int verbose Sio4 osc t osc int status status ioctl fd SIO4 OSC INFO amp osc if chip chip 0 osc chip if freq ref freq ref 0 osc freq ref if freq want freq want 0 osc freq want if freq got freq got 0 osc freq got if verbose amp amp status 1 66 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual printf ioctl failure errno d n errno return status 3 4 21 SIO4_OSC_INIT This service initializes the channel s programmable oscillator hardware The channel s input clock will be reprogrammed to output the reference frequency as a result of this service depending on the device s capabilities The driver ignores the structure s current content and fills in all fields according to the
135. s recorded if it is 8MHz or higher and 30MHz or lower SIO4 OSC RESET The desired frequency is set to zero and the channel is reconfigured accordingly 02 4 4 2 Cypress IDC2053B Programmable Oscillator Support The driver does not include support for this device The driver returns EIO for all programmable oscillator requests when the SIO4 uses this chip 4 4 3 Fixed Oscillator Support When the SIO4 has a fixed oscillator no programming can be performed Rather than return errors though the driver treats the hardware as a programmable oscillator capable only of supply the reference frequency The driver responds to the IOCTL services according to the following table Service Response SIO4 OSC INFO The current settings are reported 113 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual SIO4 OSC INIT The freq got value is updated to the reference frequency SIO4 OSC MEASURE The freq got value is reported as 1 due to firmware limitations SIO4 OSC PROGRAM The requested value is recorded if it is non zero and 20MHz or lower SIO4 OSC REFERENCE The requested value is recorded if it is IMHz or higher and 20MHz or lower SIO4 OSC RESET 4 4 4 All Other Cases The freq got value is updated to the reference frequency This applies when the SIO4 inclu
136. s reported by the driver both when the driver is loaded and when it is unloaded depending on kernel configuration options this may be visible only in var log messages It is recorded in the file proc sio4 It can also be read by an application via the SIO4 GET DRIVER INFO IOCTL services 2 7 5 Shutdown Shutdown the driver following the below listed steps 1 Login as root user as some of the steps require root privileges 2 Ifthe driver is currently loaded then issue the below command to unload the driver rmmod sio4 3 Verify that the driver module has been unloaded by issuing the below command The module name sio4 should not be in the list lsmod 2 8 Document Source Code Examples The driver archive contains all of the source code examples included in this document They are provided in library form appropriate for linking with SIO4 command line applications The files are delivered undocumented and unsupported but may be used to assist in application development and to help ease the learning curve The files are described here only briefly though library use is described in the following paragraph The purpose of the files is to provide the user with the actual source code given in the manual to provide example code that can be used in customer applications and to provide a means of insuring that the examples cited will compile 2 8 1 SlO4DocSrcLib a This library comprises all code samples in this document along with s
137. s service is used to determine if the board s Multi Protocol transceiver feature supports a given protocol The protocol to be tested is recorded in the structure s prot_want field The results are recorded in the data structure s prot got field The reported value will be SIO4 MP PROT INVALID if the requested protocol value is unrecognized or unsupported It will be S104 MP PROT UNKNOWN when support for the specified protocol is unknown This is applicable when the SIO4 doesn t support the feature or when the chip used is unsupported by the driver The reported value will equal the requested protocol when that protocol is supported Refer to the Multi Protocol transceiver programming information later in this document for more information Usage ioctl Argument request arg Description SIO4 MP TEST sio4 mp t Example lt errno h gt lt stdio h gt lt unistd h gt lt sys ioctl h gt include include include include include SIO4DocSrcLib h int sio4 mp test int fd s32 want _ s32 got sio4 mp t int mp status mp prot want want 65 int verbose General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual status ioctl fd SIO4 MP TEST amp mp got 0 mp prot_got if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 20 SIO4_OSC_INFO This se
138. sBlockOptions UINT8 u8RxDMAWaitForTrigger USC DMA OPTIONS Field Description eTxStatusBlockOptions Configure the use of transmitter status blocks u8TxDMAWaitForTrigger Specifies when data transfer occurs eRxStatusBlockOptions Configure the use of receiver status blocks u8RxDMAWaitForTrigger Specifies when data transfer occurs 3 2 37 XMT ASYNC PROTOCOL This structure defines the available transmitter parameters for the Asynchronous protocol Definition typedef struct XmtASYNCProtocol T CLOCK RATE eTxClockRate STOP_BITS eTxStopBits XMT ASYNC PROTOCOL Fields Description eTxClockRate This specifies the source clock divisor eTxStopBits This specifies the number of stop bits 3 2 38 XMT HDLC PROTOCOL This structure defines the available transmitter parameters for the HDLC protocol Definition typedef struct XmtHDLCProtocol UINT8 u8SharedZeroFlags UINTS u8TxPreambleEnable TX UNDERRUN eTxUnderrun XMT HDLC PROTOCOL Fields Description Zero u8SharedZeroFlags This specifies that consecutive Flags do shared 1 or do not share 0 the u8TxPreambleEnable This enables 1 or disables 0 sending of the preamble pattern eTxUnderrun This specifies the transmitter response to an under run condition 3 2 39 XMT HDLC SDLC LOOP PROTOCOL This structure defines the available transmitter para
139. sio4 mp t Example include include include include include int sio4 lt errno h gt lt stdio h gt lt unistd h gt lt sys ioctl h gt STO4DocSrcLib h mp init int fd _ s32 got int verbose sio4 mp t mp int status status ioctl fd SIO4 MP INIT amp mp if got got 0 mp prot got if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 18 SIO4 MP RESET This service resets the board s Multi Protocol transceiver feature This disables the transceivers by tri stating the outputs The results are recorded in the data structure s prot got field Refer to the Multi Protocol transceiver programming information later in this document for more information Usage ioctl Argument Description request SIO4 MP RESET arg sio4 mp t 64 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual Example lt errno h gt lt stdio h gt lt unistd h gt lt sys ioctl h gt include include include include include SIO4DocSrcLib h int sio4 mp reset int fd _ s32 got int verbose sio4 mp t mp int status status ioctl fd SIO4 MP RESET amp mp if got got 0 mp prot got if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 19 SIO4_MP_TEST Thi
140. something like linux 2 4 or something similar Perform the substitution as appropriate or create a linux soft link 2 Copy the archive file sio4 tar gz into the current directory 3 Issue the following command to decompress and extract the files from the provided archive This creates the directory structure described earlier and copies all of the archive files into the created directories tar xzvf sio4 tar gz 13 General Standards Corporation Phone 256 880 8787 2 7 The Driver SIO4 Linux Device Driver User Manual The paragraphs that follow give instructions on building starting and verifying startup of the driver These files are installed into the usr src linux drivers sio4 driver directory File Description E These sources implement the driver interface and its functionality Some functionality has been modularized based on individual source file base names h These are driver header files Others are listed below makefile This is the driver make file makefile dep This is a make dependency file This is updated automatically sio4 h This is the driver interface header file It should be included by SIO4 applications sio4 o This is a pre built version of the executable driver module Sio4 legacy h This is an additional driver interface header file This includes some outdated and superceded definitions This should be included by applications on an as needed
141. st memory to the SIO4 when the write function is called Usage ioctl Argument Description request SIO4 TX IO MODE CONFIG arg s32 Example tinclude lt errno h gt tinclude lt stdio h gt include lt unistd h gt include sys ioctl h include SIO4DocSrcLib h int sio4 tx io mode config int fd s32 set _ s32 get int verbose int status status ioctl fd SIO4 TX IO MODE CONFIG amp set if get get 0 set if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 80 SIO4_TXC_USC_CONFIG This service configures the channel s use of the USC TxC signal and retrieves its current configuration If one of the predefined configurations is requested it is applied If the corresponding XXX READ macro is supplied then the current configuration is not changed Before returning the current configuration is obtained and reported to the caller If the feature is unsupported then the corresponding XXX_UNKNOWN macro is returned If the feature is supported but the configuration is invalid then the corresponding XXX INVALID macro is returned Usage ioctl Argument Description request SIO4 TXC USC CONFIG arg s32 105 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual Example tinclude lt errno h gt tinclude lt stdio h gt in
142. stdio h gt lt unistd h gt lt sys ioctl h gt STO4DocSrcLib h channel command send fd 84 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual SIO4 CHAN CMD command int verbose int status status ioctl fd SIO4 SEND CHANNEL COMMAND command if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 48 SIO4_SET_BRGO_MODE This service sets the operating mode for the USC channel s Baud Rate Generator 0 Usage ioctl Argument Description request SIO4 SET BRGO MODE arg BRG MODE Example include lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h T int sio4 brg0 set mode int fd BRG MODE mode int verbose int status status ioctl fd SIO4 SET BRGO MODE mode if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 49 SIO4_SET_BRGO_SOURCE E enumeration This service sets the USC channel s Baud Rate Generator 0 clock source The only CLOCK _SOURCI values that are valid options for this IOCTL are those listed below e Counter 0 e Counter 1 e The RxC pin 85 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual The TxC pin Usage ioctl Arg
143. ster CMCR SIO4 USC CMR Channel Mode Register CMR SIO4 USC DCCR Daisy Chain Control Register DCCR SIO4 USC HCR Hardware Configuration Register HCR SIO4 USC ICR Interrupt Control Register ICR SIO4 USC IOCR Input Output Control Register IOCR SIO4 USC IVR Interrupt Vector Register IVR SIO4 USC MIS Miscellaneous Interrupt Status Register MISR SIO4 USC RCC Receive Character Count Register RCCR SIO4 USC RCL N N X Receive Count Limit Register RCLR SIO4 USC RCSR Receive Command Status Register RCSR SIO4 USC RDR Receive Data Register RDR o E Receive Interrupt Control Register RICR SIO4 USC RIC SIO4 USC RMR Receive Mode Register RMR SIO4 USC RSR Receive Sync Register RSR SIO4 US CS IC Status Interrupt Control Register SICR SIO4 USC TCOR Time Constant 0 Register TCOR SIO4 USC TCIR Time Constant 1 Register TCIR SIO4 USC TCCR Transmit Character Count Register TCCR SIO4 USC TCLR Transmit Count Limit Register TCLR W V D AA SIO4 USC TCSR Transmit Command Status Register TCSR SIO4 USC_TDR Transmit Data Register TDR o SIO4 USC TICR Transmit Interrupt Control Register TICR po SIO4 USC TMCR Test Mode Control Register TMCR SIO4 USC TMDR Test Mode Data Register TMDR SIO4 USC TMR Transmit Mode Register TMR
144. sters and USC registers The PCI registers and the PLX feature set registers are read only Refer to the SIO4 User Manual and to sio4 h for a complete list of the available registers Usage ioctl Argument Description request SIO4 MOD REGISTER arg REGISTER MOD PARAMS Example tinclude lt errno h gt tinclude lt stdio h gt tinclude lt unistd h gt include lt sys ioctl h gt tinclude SIO4DocSrcLib h int sio4 reg mod int fd 432 reg _ u32 value u32 mask int verbose REGISTER MOD PARAMS parm int status parm u32RegisterNumber reg parm u32Value value parm u32Mask mask status ioctl fd SIO4 MOD REGISTER amp parm if verbose amp amp status 1 printf ioctl failure errno d n errno return status 61 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual 3 4 14 SIO4 NO FUNCTION This is an empty driver entry point This IOCTL may be given to verify that the driver is correctly installed and that an SIO4 serial channel has been successfully opened If an error status is returned then something isn t working properly Usage ioctl Argument Description request SIO4 NO FUNCTION arg Not used Example tinclude lt errno h gt tinclude lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocS
145. ted Refer to the oscillator programming information later in this document for more information Usage ioctl Argument Description request SIO4 OSC RESET arg sio4 osc t Example include lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 osc reset int fd s32 freq got int verbose sio4 osc t osc int status status ioctl fd SIO4 OSC RESET amp osc if freq_got freq got 0 osc freq got if verbose amp amp status 1 printf ioctl failure errno d n return status 3 4 26 SIO4_OSC_TEST This service reports the frequency that should be produced were the programming service requested for the desired frequency The channel s input clock will be set to the lowest possible frequency as a result of this service depending on the device s capabilities The driver ignores the structure s current content and fills in all fields according to the channel s post reset configuration The reference frequency is unaltered the desired frequency is set to zero and the frequency obtained is reported Refer to the oscillator programming information later in this document for more information 70 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual Usage ioctl Argument Descripti
146. ter Refer to the oscillator programming information later in this document for more information CAUTION Setting the reference frequency to an incorrect value may have an adverse affect on the programmable oscillator The results depend on the oscillator and the incorrect value specified Usage ioctl Argument Description request SIO4 OSC REFERENCE arg sio4 osc t Example tinclude lt errno h gt tinclude lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 osc reference int fd _ s32 freq ref int verbose sio4 osc t osc int status osc freq ref freq ref 0 status ioctl fd SIO4 OSC REFERENCE amp osc freq ref 0 osc freq ref if verbose amp amp status 1 printf ioctl failure errno d n errno 69 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual return status 3 4 25 SIO4_OSC_RESET This service resets the channel s oscillator hardware The channel s input clock will be set to the lowest possible frequency as a result of this service depending on the device s capabilities The driver ignores the structure s current content and fills in all fields according to the channel s post reset configuration The reference frequency is unaltered the desired frequency is set to zero and the frequency obtained is repor
147. the insignificant upper bits can be ignored and should be zero PCI Configuration Registers Macros Description SIO4 PCI BARO PCI Base Address Register for Memory Accesses to Local Runtime and DMA Registers PCIBARO SIO4 PCI BARI1 PCI Base Address Register for I O Accesses to Local Runtime and DMA Registers PCIBAR 1 25 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual SIO4 PCI BAR2 PCI Base Address Register for Memory Accesses to Local Address Space 0 PCIBAR2 SIO4 PCI BAR3 PCI Base Address Register for Memory Accesses to Local Address Space 1 PCIBAR3 SIO4 PCI BAR4 Unused Base Address Register PCIBARA SIO4 PCI BARS Unused Base Address Register PCIBARS SIO4 PCI BISTR PCI Built In Self Test Register PCIBISTR SIO4 PCI CCR PCI Class Code Register PCICCR SIO4 PCI CIS PCI Cardbus CIS Pointer Register PCICIS SIO4 PCI CLSR PCI Cache Line Size Register PCICLSR SIO4 PCI CR PCI Command Register PCICR SIO4 PCI DID PCI Device ID Register PCIDIDR SIO4 PCI ERBAR PCI Expansion ROM Base Address PCIERBAR SIO4 PCI HT PCI Header Type Register PCIHTR SIO4 PCI IL PCI Interrupt Line Register PCIILR SIO4 PCI IP PCI Interrupt Pin Register PCIIPR SIO4 PCI LT PCI Latency Timer Register PCILTR SIO4 PCI MG PCI Min Gnt Register PCIMGR
148. tion Phone 256 880 8787 SIO4 Linux Device Driver User Manual 3 1 15 SIO4 RX FIFO FULL CONFIG Options This set of macros defines the options available for the SIO4 RX FIFO FULL CONFIG IOCTL service Macros set and get options Description SIO4 RX FIFO FUL CONFIG HA LT Attempt to halt the flow of incoming data SIO4 RX FIFO FUL CONFIG OVERRUN Let the FIFO overrun by discarding excess data Macros set only options Description SIO4 RX FIFO FUL CONFIG READ Retrieve the current configuration 3 1 16 SI04_RXC_USC_CONFIG Options This set of macros defines the options available for the SIO4_RXC_USC CONFIG IOCTL service Macros set and get options Description SIO4 RXC USC CONFIG IN CBL RC An input from the cable s RxClk signal SIO4 RXC USC CONFIG IN HI An input driven high SIO4 RXC USC CONFIG IN LOW An input driven low SIO4 RXC USC CONFIG IN PRG CLK An input from the programmable clock SIO4 RXC USC CONFIG OUT BRGO Output the BRGO output signal SIO4 RXC USC CONFIG OUT BRG1 Output the BRGI output signal SIO4 RXC USC CONFIG OUT CTR1 Output the CTR1 output signal SIO4 RXC USC CONFIG OUT DPLL Output the DPLL output signal SIO4 RXC USC CONFIG OUT TCC Output the USC s Transmit char clock signal SIO4 RXC USC CONFIG OUT TCLK Out
149. tl failure errno d n errno return status 3 4 28 SIO4_READ_INT_STATUS This service requests the interrupt status information following interrupt notification The status reported reflects all of the interrupts for the channel The recorded status represents the accumulated status of all interrupts since the status was last read or notification requested Once read the recorded status is cleared WARNING If a USC interrupt occurs then that interrupt must be serviced within the USC by the application If this is not done then that interrupt source within the USC will continue to function as an active USC interrupt source In this case the SIO4 will continue to assert an interrupt while USC interrupts are enabled NOTE The application will not receive notification of any interrupt that the driver itself is waiting on NOTE Due to the timeliness of various interacting events it is possible for multiple interrupts to occur before the status is read This can result in one SIGIO prompted status read reporting multiple interrupts and the next SIGIO prompted status read reporting no interrupts Usage ioctl Argument Description request SIO4 READ INT STATUS arg SIO4 INTERRUPT STATUS Example tinclude lt errno h gt tinclude lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 int read status int fd SIO4_ INTERRUPT STATUS
150. tl h gt include include include include include SIO4DocSrcLib h int sio4 board jumpers int fd int status __s32 get int verbose get 0 OxDEADBEEF status ioctl fd SIO4 BOARD JUMPERS get if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 2 SIO4_CABLE_CONFIG This service configures the cable for the location where the cable data TxD and RxD and cable clock TxClk and RxClk signals will appear and retrieves the current configuration If one of the predefined configurations is requested it is applied If the corresponding XXX RI EAD macro is supplied then the current configuration is not changed Before returning the current configuration is obtained and reported to the caller If the feature is unsupported then the corresponding XXX UNKNOWN macro is returned If the feature is supported but the configuration is invalid then the corresponding XXX INVALID macro is returned Usage ioctl Argument Description LA P T request SIO4 CABLE CO NFIG arg s32 see page 28 for valid values Example lt errno h gt lt stdio h gt lt unistd h gt lt sys ioctl h gt include include include include include SIO4DocSrcLib h int sio4 cable config int fd int status s32 set s32 get int verbose 53 General Standards Corporation Phone
151. ument Description request SIO4 RESET CHANNEL arg Not used Example include lt errno h gt include lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 channel reset int fd int verbose 74 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual int status status ioctl fd SIO4 RESET CHANNEL if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 32 SIO4_RESET_DEVICE This service resets all of the board s hardware This includes the USCs the FIFOs the cable configurations the transceivers and the programmable oscillators The programmable transceivers and programmable oscillators are disabled if supported in hardware WARNING This service affects all channels on the board and should be used with care Usage ioctl Argument Description request SIO4 RESET DEVICE arg Not used Example tinclude lt errno h gt tinclude lt stdio h gt include lt unistd h gt include lt sys ioctl h gt include SIO4DocSrcLib h int sio4 reset device int fd int verbose int status status ioctl fd SIO4 RESET DEVICE if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 33 SIO4_RESET_FIFO This serv
152. ument request arg Description SIO4 SET BRGO SOURC CLOCK SOURCE E h P Example lt errno h gt lt stdio h gt lt unistd h gt lt sys ioctl h gt include include include include include SIO4DocSrcLib h int sio4 brg0 set clock source int fd int status status ioctl fd SIO4 SET BRGO SOURCI if verbose amp amp status 1 printf ioctl failure errno return status 3 4 50 SIO4 SET BRG1 MODE CLOCK SOURC F a Sd n P T int verbose src Src errno This service sets the operating mode for the USC channel s Baud Rate Generator 1 Usage ioctl Argument request arg Description SIO4 SET BRG MO El BRG1 MODI F a E Example lt errno h gt lt stdio h gt lt unistd h gt lt sys ioctl h gt include include include include include SIO4DocSrcLib h F py int sio4 brgl set mode int fd BRG MODI int status status ioctl fd SIO4 SET BRG1 MODI if verbose amp amp status 1 86 General Standards Corporation Phone 25 mode int verbose mode 6 880 8787 SIO4 Linux Device Driver User Manual printf ioctl failure errno d n errno return status 3 4 51 SIO4_SET_BRG1_SOURCE This service sets the USC channel s Baud Rate Generator 1 c
153. x Register 0 MBOX0 SIO4 PLX MBOX1 Mailbox Register 1 MBOX1 SIO4 PLX MBOX2 Mailbox Register 2 MBOX2 SIO4 PLX MBOX3 Mailbox Register 3 MBOX3 SIO4 PLX MBOX4 Mailbox Register 4 MBOX4 SIO4 PLX MBOX5 Mailbox Register 5 MBOX5 SIO4 PLX MBOX6 Mailbox Register 6 MBOX6 SIO4 PLX MBOX7 Mailbox Register 7 MBOX7 SIO4 PLX P2LDBELL PCI to Local Doorbell Register P2LDBELL SIO4 PLX PCIHIDR PCI Permanent Configuration ID Register PCIHIDR SIO4 PLX PCIHREV PCI Permanent Revision ID Register PCIHREV DMA Registers Macros Description SIO4 PLX DMAARB DMA Arbitration Register DMAARB SIO4 PLX DMACSRO DMA Channel 0 Command Status Register DMACSRO SIO4 PLX DMACSR1 DMA Channel 1 Command Status Register DMACSRI SIO4 PLX DMADPRO DMA Channel 0 Descriptor Pointer Register DMADPRO SIO4 PLX DMADPR1 DMA Channel 1 Descriptor Pointer Register DMADPRI SIO4 PLX DMALADRO DMA Channel 0 Local Address Register DMALADRO SIO4 PLX DMALADRI DMA Channel Local Address Register DMALADRI SIO4 PLX DMAMODEO DMA Channel 0 Mode Register DMAMODEO SIO4 PLX DMAMODEI DMA Channel 1 Mode Register DMAMODEI SIO4 PLX DMAPADRO DMA Channel 0 PCI Address Register DMAPADRO SIO4 PLX DMAPADRI DMA Channel 1 PCI Address Register DMAPADRI SIO4 PLX DMASIZO DMA Channel 0 Transfer Size Register DMASIZO SIO4 PLX DMASIZ1 DMA Channel Transfer Size Register DMASIZI SIO4 PLX DMATHR DMA Threshold Register DMATHR Message
154. x fifo ae config int fd _ s32 set _ s32 get int verbose status ioctl fd SIO4 RX FIFO AE CONFIG amp set if get get 0 set if verbose amp amp status 1 printf ioctl failure errno d n errno return status 78 General Standards Corporation Phone 256 880 8787 SIO4 Linux Device Driver User Manual 3 4 38 SIO4_RX_FIFO_AF_CONFIG This service configures the Rx FIFO Almost Full level and reports the current level When applying a setting the Rx FIFO is reset and the current content is lost If the corresponding XXX RI applied Before returning the current programmed level is obtained and supplied to the caller Usage request ioctl Argument Description SIO4 RX FIFO AF CONFIG arg 332 Example include include include include include int sio4 lt errno h gt lt stdio h gt lt unistd h gt lt sys ioctl h gt SIOADocSrcLib h rx fifo af config int fd _ s32 set _ s32 get int status status ioctl fd SIO4 RX FIFO AF CONFIG amp set if get get 0 set if verbose amp amp status 1 printf ioctl failure errno d n errno return status 3 4 39 SIO4_RX_FIFO_COUNT EAD macro is supplied then no change is int verbose This service retrieves the current Rx FIFO fill level The value obtained is either the number of bytes of data in the Rx FIFO
Download Pdf Manuals
Related Search
Related Contents
Kensington Comercio™ Hard Folio Case & Adjustable Stand for iPad Air™ & iPad Air™ 2 - Dermal Black NEOPERL 97260.05 Installation Guide TM-C7500 詳細取扱説明書 Bedrijfsinstructie Consignes Betriebsanweisung Operating instructions Snowden-Pencer™ - V. Mueller Catalog PV390 Series User's Manual 標準室ハイブリッドショベル Data Collectors - Norsecraft Geo operating instructions Copyright © All rights reserved.
Failed to retrieve file