Go to the documentation of this file.
99 #define GET_INT_STATUS_SIZE(NumPorts) (sizeof(__u16) + (sizeof(__u16) * (NumPorts)))
109 #define IOSP_DATA_HDR_SIZE 2
110 #define IOSP_CMD_HDR_SIZE 2
112 #define IOSP_MAX_DATA_LENGTH 0x0FFF // 12 bits -> 4K
114 #define IOSP_PORT_MASK 0x07 // Mask to isolate port number
115 #define IOSP_CMD_STAT_BIT 0x80 // If set, this is command/status header
117 #define IS_CMD_STAT_HDR(Byte1) ((Byte1) & IOSP_CMD_STAT_BIT)
118 #define IS_DATA_HDR(Byte1) (!IS_CMD_STAT_HDR(Byte1))
120 #define IOSP_GET_HDR_PORT(Byte1) ((__u8) ((Byte1) & IOSP_PORT_MASK))
121 #define IOSP_GET_HDR_DATA_LEN(Byte1, Byte2) ((__u16) (((__u16)((Byte1) & 0x78)) << 5) | (Byte2))
122 #define IOSP_GET_STATUS_CODE(Byte1) ((__u8) (((Byte1) & 0x78) >> 3))
128 #define IOSP_BUILD_DATA_HDR1(Port, Len) ((__u8) (((Port) | ((__u8) (((__u16) (Len)) >> 5) & 0x78))))
129 #define IOSP_BUILD_DATA_HDR2(Port, Len) ((__u8) (Len))
135 #define IOSP_BUILD_CMD_HDR1(Port, Cmd) ((__u8) (IOSP_CMD_STAT_BIT | (Port) | ((__u8) ((Cmd) << 3))))
163 #define IOSP_WRITE_UART_REG(n) ((n) & 0x07) // UartReg[ n ] := P1
169 #define IOSP_EXT_CMD 0x09 // P1 = Command code (defined below)
178 #define IOSP_CMD_OPEN_PORT 0x00 // Enable ints, init UART. (NO PARAM)
179 #define IOSP_CMD_CLOSE_PORT 0x01 // Disable ints, flush buffers. (NO PARAM)
180 #define IOSP_CMD_CHASE_PORT 0x02 // Wait for Edgeport TX buffers to empty. (NO PARAM)
181 #define IOSP_CMD_SET_RX_FLOW 0x03 // Set Rx Flow Control in Edgeport
182 #define IOSP_CMD_SET_TX_FLOW 0x04 // Set Tx Flow Control in Edgeport
183 #define IOSP_CMD_SET_XON_CHAR 0x05 // Set XON Character in Edgeport
184 #define IOSP_CMD_SET_XOFF_CHAR 0x06 // Set XOFF Character in Edgeport
185 #define IOSP_CMD_RX_CHECK_REQ 0x07 // Request Edgeport to insert a Checkpoint into
189 #define IOSP_CMD_SET_BREAK 0x08 // Turn on the BREAK (LCR bit 6)
190 #define IOSP_CMD_CLEAR_BREAK 0x09 // Turn off the BREAK (LCR bit 6)
197 #define MAKE_CMD_WRITE_REG(ppBuf, pLen, Port, Reg, Val) \
199 (*(ppBuf))[0] = IOSP_BUILD_CMD_HDR1((Port), \
200 IOSP_WRITE_UART_REG(Reg)); \
201 (*(ppBuf))[1] = (Val); \
207 #define MAKE_CMD_EXT_CMD(ppBuf, pLen, Port, ExtCmd, Param) \
209 (*(ppBuf))[0] = IOSP_BUILD_CMD_HDR1((Port), IOSP_EXT_CMD); \
210 (*(ppBuf))[1] = (ExtCmd); \
211 (*(ppBuf))[2] = (Param); \
241 #define IOSP_RX_FLOW_RTS 0x01 // Edgeport drops RTS to stop incoming data
242 #define IOSP_RX_FLOW_DTR 0x02 // Edgeport drops DTR to stop incoming data
243 #define IOSP_RX_FLOW_DSR_SENSITIVITY 0x04 // Ignores Rx data unless DSR high
246 #define IOSP_RX_FLOW_XON_XOFF 0x08 // Edgeport sends XOFF char to stop incoming data.
262 #define IOSP_TX_FLOW_CTS 0x01 // Edgeport stops Tx if CTS low
263 #define IOSP_TX_FLOW_DSR 0x02 // Edgeport stops Tx if DSR low
264 #define IOSP_TX_FLOW_DCD 0x04 // Edgeport stops Tx if DCD low
265 #define IOSP_TX_FLOW_XON_XOFF 0x08 // Edgeport stops Tx upon receiving XOFF char.
270 #define IOSP_TX_FLOW_XOFF_CONTINUE 0x10 // If not set, Edgeport stops Tx when
278 #define IOSP_TX_TOGGLE_RTS 0x20 // Edgeport drives RTS as a true half-duplex
370 #define IOSP_STATUS_LSR 0x00 // P1 is new value of LSR register.
381 #define IOSP_STATUS_MSR 0x01 // P1 is new value of MSR register.
401 #define IOSP_STATUS_LSR_DATA 0x08 // P1 is new value of LSR register (same as STATUS_LSR)
406 #define IOSP_EXT_STATUS 0x09 // P1 is status/response code, param in P2.
411 #define IOSP_EXT_STATUS_CHASE_RSP 0 // Reply to CHASE_PORT cmd. P2 is outcome:
412 #define IOSP_EXT_STATUS_CHASE_PASS 0 // P2 = 0: All Tx data drained successfully
413 #define IOSP_EXT_STATUS_CHASE_FAIL 1 // P2 = 1: Timed out (stuck due to flow
417 #define IOSP_EXT_STATUS_RX_CHECK_RSP 1 // Reply to RX_CHECK cmd. P2 is sequence number
420 #define IOSP_STATUS_OPEN_RSP 0x0A // Reply to OPEN_PORT cmd.
428 #define GET_TX_BUFFER_SIZE(P2) (((P2) + 1) * 64)
437 #define IOSP_EXT4_STATUS 0x0C // Extended status code in P1,
450 #define IOSP_GET_STATUS_LEN(code) ((code) < 8 ? 2 : ((code) < 0x0A ? 3 : 4))
452 #define IOSP_STATUS_IS_2BYTE(code) ((code) < 0x08)
453 #define IOSP_STATUS_IS_3BYTE(code) (((code) >= 0x08) && ((code) <= 0x0B))
454 #define IOSP_STATUS_IS_4BYTE(code) (((code) >= 0x0C) && ((code) <= 0x0D))