diff options
Diffstat (limited to 'drivers/usb/serial/io_ionsp.h')
-rw-r--r-- | drivers/usb/serial/io_ionsp.h | 95 |
1 files changed, 48 insertions, 47 deletions
diff --git a/drivers/usb/serial/io_ionsp.h b/drivers/usb/serial/io_ionsp.h index 092e03d2dfc4..5cc591bae54d 100644 --- a/drivers/usb/serial/io_ionsp.h +++ b/drivers/usb/serial/io_ionsp.h | |||
@@ -89,10 +89,10 @@ All 16-bit fields are sent in little-endian (Intel) format. | |||
89 | // | 89 | // |
90 | 90 | ||
91 | struct int_status_pkt { | 91 | struct int_status_pkt { |
92 | __u16 RxBytesAvail; // Additional bytes available to | 92 | __u16 RxBytesAvail; // Additional bytes available to |
93 | // be read from Bulk IN pipe | 93 | // be read from Bulk IN pipe |
94 | __u16 TxCredits[ MAX_RS232_PORTS ]; // Additional space available in | 94 | __u16 TxCredits[MAX_RS232_PORTS]; // Additional space available in |
95 | // given port's TxBuffer | 95 | // given port's TxBuffer |
96 | }; | 96 | }; |
97 | 97 | ||
98 | 98 | ||
@@ -115,24 +115,24 @@ struct int_status_pkt { | |||
115 | #define IOSP_CMD_STAT_BIT 0x80 // If set, this is command/status header | 115 | #define IOSP_CMD_STAT_BIT 0x80 // If set, this is command/status header |
116 | 116 | ||
117 | #define IS_CMD_STAT_HDR(Byte1) ((Byte1) & IOSP_CMD_STAT_BIT) | 117 | #define IS_CMD_STAT_HDR(Byte1) ((Byte1) & IOSP_CMD_STAT_BIT) |
118 | #define IS_DATA_HDR(Byte1) (! IS_CMD_STAT_HDR(Byte1)) | 118 | #define IS_DATA_HDR(Byte1) (!IS_CMD_STAT_HDR(Byte1)) |
119 | 119 | ||
120 | #define IOSP_GET_HDR_PORT(Byte1) ((__u8) ((Byte1) & IOSP_PORT_MASK)) | 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)) | 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)) | 122 | #define IOSP_GET_STATUS_CODE(Byte1) ((__u8) (((Byte1) & 0x78) >> 3)) |
123 | 123 | ||
124 | 124 | ||
125 | // | 125 | // |
126 | // These macros build the 1st and 2nd bytes for a data header | 126 | // These macros build the 1st and 2nd bytes for a data header |
127 | // | 127 | // |
128 | #define IOSP_BUILD_DATA_HDR1(Port, Len) ((__u8) (((Port) | ((__u8) (((__u16) (Len)) >> 5) & 0x78 )))) | 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)) | 129 | #define IOSP_BUILD_DATA_HDR2(Port, Len) ((__u8) (Len)) |
130 | 130 | ||
131 | 131 | ||
132 | // | 132 | // |
133 | // These macros build the 1st and 2nd bytes for a command header | 133 | // These macros build the 1st and 2nd bytes for a command header |
134 | // | 134 | // |
135 | #define IOSP_BUILD_CMD_HDR1(Port, Cmd) ((__u8) ( IOSP_CMD_STAT_BIT | (Port) | ((__u8) ((Cmd) << 3)) )) | 135 | #define IOSP_BUILD_CMD_HDR1(Port, Cmd) ((__u8) (IOSP_CMD_STAT_BIT | (Port) | ((__u8) ((Cmd) << 3)))) |
136 | 136 | ||
137 | 137 | ||
138 | //-------------------------------------------------------------- | 138 | //-------------------------------------------------------------- |
@@ -194,24 +194,25 @@ struct int_status_pkt { | |||
194 | // Define macros to simplify building of IOSP cmds | 194 | // Define macros to simplify building of IOSP cmds |
195 | // | 195 | // |
196 | 196 | ||
197 | #define MAKE_CMD_WRITE_REG(ppBuf, pLen, Port, Reg, Val) \ | 197 | #define MAKE_CMD_WRITE_REG(ppBuf, pLen, Port, Reg, Val) \ |
198 | do { \ | 198 | do { \ |
199 | (*(ppBuf))[0] = IOSP_BUILD_CMD_HDR1( (Port), IOSP_WRITE_UART_REG(Reg) ); \ | 199 | (*(ppBuf))[0] = IOSP_BUILD_CMD_HDR1((Port), \ |
200 | (*(ppBuf))[1] = (Val); \ | 200 | IOSP_WRITE_UART_REG(Reg)); \ |
201 | \ | 201 | (*(ppBuf))[1] = (Val); \ |
202 | *ppBuf += 2; \ | 202 | \ |
203 | *pLen += 2; \ | 203 | *ppBuf += 2; \ |
204 | } while (0) | 204 | *pLen += 2; \ |
205 | } while (0) | ||
205 | 206 | ||
206 | #define MAKE_CMD_EXT_CMD(ppBuf, pLen, Port, ExtCmd, Param) \ | 207 | #define MAKE_CMD_EXT_CMD(ppBuf, pLen, Port, ExtCmd, Param) \ |
207 | do { \ | 208 | do { \ |
208 | (*(ppBuf))[0] = IOSP_BUILD_CMD_HDR1( (Port), IOSP_EXT_CMD ); \ | 209 | (*(ppBuf))[0] = IOSP_BUILD_CMD_HDR1((Port), IOSP_EXT_CMD); \ |
209 | (*(ppBuf))[1] = (ExtCmd); \ | 210 | (*(ppBuf))[1] = (ExtCmd); \ |
210 | (*(ppBuf))[2] = (Param); \ | 211 | (*(ppBuf))[2] = (Param); \ |
211 | \ | 212 | \ |
212 | *ppBuf += 3; \ | 213 | *ppBuf += 3; \ |
213 | *pLen += 3; \ | 214 | *pLen += 3; \ |
214 | } while (0) | 215 | } while (0) |
215 | 216 | ||
216 | 217 | ||
217 | 218 | ||
@@ -310,16 +311,16 @@ struct int_status_pkt { | |||
310 | // | 311 | // |
311 | // IOSP_CMD_RX_CHECK_REQ | 312 | // IOSP_CMD_RX_CHECK_REQ |
312 | // | 313 | // |
313 | // This command is used to assist in the implementation of the | 314 | // This command is used to assist in the implementation of the |
314 | // IOCTL_SERIAL_PURGE Windows IOCTL. | 315 | // IOCTL_SERIAL_PURGE Windows IOCTL. |
315 | // This IOSP command tries to place a marker at the end of the RX | 316 | // This IOSP command tries to place a marker at the end of the RX |
316 | // queue in the Edgeport. If the Edgeport RX queue is full then | 317 | // queue in the Edgeport. If the Edgeport RX queue is full then |
317 | // the Check will be discarded. | 318 | // the Check will be discarded. |
318 | // It is up to the device driver to timeout waiting for the | 319 | // It is up to the device driver to timeout waiting for the |
319 | // RX_CHECK_RSP. If a RX_CHECK_RSP is received, the driver is | 320 | // RX_CHECK_RSP. If a RX_CHECK_RSP is received, the driver is |
320 | // sure that all data has been received from the edgeport and | 321 | // sure that all data has been received from the edgeport and |
321 | // may now purge any internal RX buffers. | 322 | // may now purge any internal RX buffers. |
322 | // Note tat the sequence numbers may be used to detect lost | 323 | // Note tat the sequence numbers may be used to detect lost |
323 | // CHECK_REQs. | 324 | // CHECK_REQs. |
324 | 325 | ||
325 | // Example for Port 0 | 326 | // Example for Port 0 |
@@ -341,7 +342,7 @@ struct int_status_pkt { | |||
341 | // | 342 | // |
342 | // 1ssssPPP P1P1P1P1 [ P2P2P2P2P2 ]... | 343 | // 1ssssPPP P1P1P1P1 [ P2P2P2P2P2 ]... |
343 | // | 344 | // |
344 | // ssss: 00-07 2-byte status. ssss identifies which UART register | 345 | // ssss: 00-07 2-byte status. ssss identifies which UART register |
345 | // has changed value, and the new value is in P1. | 346 | // has changed value, and the new value is in P1. |
346 | // Note that the ssss values do not correspond to the | 347 | // Note that the ssss values do not correspond to the |
347 | // 16554 register numbers given in 16554.H. Instead, | 348 | // 16554 register numbers given in 16554.H. Instead, |
@@ -383,14 +384,14 @@ struct int_status_pkt { | |||
383 | // returns this in order to report | 384 | // returns this in order to report |
384 | // changes in modem status lines | 385 | // changes in modem status lines |
385 | // (CTS, DSR, RI, CD) | 386 | // (CTS, DSR, RI, CD) |
386 | // | 387 | // |
387 | 388 | ||
388 | // 0x02 // Available for future expansion | 389 | // 0x02 // Available for future expansion |
389 | // 0x03 // | 390 | // 0x03 // |
390 | // 0x04 // | 391 | // 0x04 // |
391 | // 0x05 // | 392 | // 0x05 // |
392 | // 0x06 // | 393 | // 0x06 // |
393 | // 0x07 // | 394 | // 0x07 // |
394 | 395 | ||
395 | 396 | ||
396 | /**************************************************** | 397 | /**************************************************** |
@@ -400,7 +401,7 @@ struct int_status_pkt { | |||
400 | #define IOSP_STATUS_LSR_DATA 0x08 // P1 is new value of LSR register (same as STATUS_LSR) | 401 | #define IOSP_STATUS_LSR_DATA 0x08 // P1 is new value of LSR register (same as STATUS_LSR) |
401 | 402 | ||
402 | // P2 is errored character read from | 403 | // P2 is errored character read from |
403 | // RxFIFO after LSR reported an error. | 404 | // RxFIFO after LSR reported an error. |
404 | 405 | ||
405 | #define IOSP_EXT_STATUS 0x09 // P1 is status/response code, param in P2. | 406 | #define IOSP_EXT_STATUS 0x09 // P1 is status/response code, param in P2. |
406 | 407 | ||
@@ -408,7 +409,7 @@ struct int_status_pkt { | |||
408 | // Response Codes (P1 values) for 3-byte status messages | 409 | // Response Codes (P1 values) for 3-byte status messages |
409 | 410 | ||
410 | #define IOSP_EXT_STATUS_CHASE_RSP 0 // Reply to CHASE_PORT cmd. P2 is outcome: | 411 | #define IOSP_EXT_STATUS_CHASE_RSP 0 // Reply to CHASE_PORT cmd. P2 is outcome: |
411 | #define IOSP_EXT_STATUS_CHASE_PASS 0 // P2 = 0: All Tx data drained successfully | 412 | #define IOSP_EXT_STATUS_CHASE_PASS 0 // P2 = 0: All Tx data drained successfully |
412 | #define IOSP_EXT_STATUS_CHASE_FAIL 1 // P2 = 1: Timed out (stuck due to flow | 413 | #define IOSP_EXT_STATUS_CHASE_FAIL 1 // P2 = 1: Timed out (stuck due to flow |
413 | 414 | ||
414 | // control from remote device). | 415 | // control from remote device). |
@@ -446,9 +447,9 @@ struct int_status_pkt { | |||
446 | // Macros to parse status messages | 447 | // Macros to parse status messages |
447 | // | 448 | // |
448 | 449 | ||
449 | #define IOSP_GET_STATUS_LEN(code) ( (code) < 8 ? 2 : ((code) < 0x0A ? 3 : 4) ) | 450 | #define IOSP_GET_STATUS_LEN(code) ((code) < 8 ? 2 : ((code) < 0x0A ? 3 : 4)) |
450 | 451 | ||
451 | #define IOSP_STATUS_IS_2BYTE(code) ( (code) < 0x08 ) | 452 | #define IOSP_STATUS_IS_2BYTE(code) ((code) < 0x08) |
452 | #define IOSP_STATUS_IS_3BYTE(code) ( ((code) >= 0x08) && ((code) <= 0x0B) ) | 453 | #define IOSP_STATUS_IS_3BYTE(code) (((code) >= 0x08) && ((code) <= 0x0B)) |
453 | #define IOSP_STATUS_IS_4BYTE(code) ( ((code) >= 0x0C) && ((code) <= 0x0D) ) | 454 | #define IOSP_STATUS_IS_4BYTE(code) (((code) >= 0x0C) && ((code) <= 0x0D)) |
454 | 455 | ||