Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 1 | #ifndef _MXSER_H |
| 2 | #define _MXSER_H |
| 3 | |
| 4 | /* |
| 5 | * Semi-public control interfaces |
| 6 | */ |
| 7 | |
| 8 | /* |
| 9 | * MOXA ioctls |
| 10 | */ |
| 11 | |
| 12 | #define MOXA 0x400 |
| 13 | #define MOXA_GETDATACOUNT (MOXA + 23) |
| 14 | #define MOXA_GET_CONF (MOXA + 35) |
| 15 | #define MOXA_DIAGNOSE (MOXA + 50) |
| 16 | #define MOXA_CHKPORTENABLE (MOXA + 60) |
| 17 | #define MOXA_HighSpeedOn (MOXA + 61) |
| 18 | #define MOXA_GET_MAJOR (MOXA + 63) |
| 19 | #define MOXA_GET_CUMAJOR (MOXA + 64) |
| 20 | #define MOXA_GETMSTATUS (MOXA + 65) |
| 21 | #define MOXA_SET_OP_MODE (MOXA + 66) |
| 22 | #define MOXA_GET_OP_MODE (MOXA + 67) |
| 23 | |
| 24 | #define RS232_MODE 0 |
| 25 | #define RS485_2WIRE_MODE 1 |
| 26 | #define RS422_MODE 2 |
| 27 | #define RS485_4WIRE_MODE 3 |
| 28 | #define OP_MODE_MASK 3 |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 29 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 30 | #define MOXA_SDS_RSTICOUNTER (MOXA + 69) |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 31 | #define MOXA_ASPP_OQUEUE (MOXA + 70) |
| 32 | #define MOXA_ASPP_SETBAUD (MOXA + 71) |
| 33 | #define MOXA_ASPP_GETBAUD (MOXA + 72) |
| 34 | #define MOXA_ASPP_MON (MOXA + 73) |
| 35 | #define MOXA_ASPP_LSTATUS (MOXA + 74) |
| 36 | #define MOXA_ASPP_MON_EXT (MOXA + 75) |
| 37 | #define MOXA_SET_BAUD_METHOD (MOXA + 76) |
Jiri Slaby | f64c84a | 2007-02-10 01:45:21 -0800 | [diff] [blame] | 38 | #define MOXA_SET_SPECIAL_BAUD_RATE (MOXA + 77) |
| 39 | #define MOXA_GET_SPECIAL_BAUD_RATE (MOXA + 78) |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 40 | |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 41 | /* --------------------------------------------------- */ |
| 42 | |
| 43 | #define NPPI_NOTIFY_PARITY 0x01 |
| 44 | #define NPPI_NOTIFY_FRAMING 0x02 |
| 45 | #define NPPI_NOTIFY_HW_OVERRUN 0x04 |
| 46 | #define NPPI_NOTIFY_SW_OVERRUN 0x08 |
| 47 | #define NPPI_NOTIFY_BREAK 0x10 |
| 48 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 49 | #define NPPI_NOTIFY_CTSHOLD 0x01 /* Tx hold by CTS low */ |
| 50 | #define NPPI_NOTIFY_DSRHOLD 0x02 /* Tx hold by DSR low */ |
| 51 | #define NPPI_NOTIFY_XOFFHOLD 0x08 /* Tx hold by Xoff received */ |
| 52 | #define NPPI_NOTIFY_XOFFXENT 0x10 /* Xoff Sent */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 53 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 54 | /* follow just for Moxa Must chip define. */ |
| 55 | /* */ |
| 56 | /* when LCR register (offset 0x03) write following value, */ |
| 57 | /* the Must chip will enter enchance mode. And write value */ |
| 58 | /* on EFR (offset 0x02) bit 6,7 to change bank. */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 59 | #define MOXA_MUST_ENTER_ENCHANCE 0xBF |
| 60 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 61 | /* when enhance mode enable, access on general bank register */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 62 | #define MOXA_MUST_GDL_REGISTER 0x07 |
| 63 | #define MOXA_MUST_GDL_MASK 0x7F |
| 64 | #define MOXA_MUST_GDL_HAS_BAD_DATA 0x80 |
| 65 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 66 | #define MOXA_MUST_LSR_RERR 0x80 /* error in receive FIFO */ |
| 67 | /* enchance register bank select and enchance mode setting register */ |
| 68 | /* when LCR register equal to 0xBF */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 69 | #define MOXA_MUST_EFR_REGISTER 0x02 |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 70 | /* enchance mode enable */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 71 | #define MOXA_MUST_EFR_EFRB_ENABLE 0x10 |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 72 | /* enchance reister bank set 0, 1, 2 */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 73 | #define MOXA_MUST_EFR_BANK0 0x00 |
| 74 | #define MOXA_MUST_EFR_BANK1 0x40 |
| 75 | #define MOXA_MUST_EFR_BANK2 0x80 |
| 76 | #define MOXA_MUST_EFR_BANK3 0xC0 |
| 77 | #define MOXA_MUST_EFR_BANK_MASK 0xC0 |
| 78 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 79 | /* set XON1 value register, when LCR=0xBF and change to bank0 */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 80 | #define MOXA_MUST_XON1_REGISTER 0x04 |
| 81 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 82 | /* set XON2 value register, when LCR=0xBF and change to bank0 */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 83 | #define MOXA_MUST_XON2_REGISTER 0x05 |
| 84 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 85 | /* set XOFF1 value register, when LCR=0xBF and change to bank0 */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 86 | #define MOXA_MUST_XOFF1_REGISTER 0x06 |
| 87 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 88 | /* set XOFF2 value register, when LCR=0xBF and change to bank0 */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 89 | #define MOXA_MUST_XOFF2_REGISTER 0x07 |
| 90 | |
| 91 | #define MOXA_MUST_RBRTL_REGISTER 0x04 |
| 92 | #define MOXA_MUST_RBRTH_REGISTER 0x05 |
| 93 | #define MOXA_MUST_RBRTI_REGISTER 0x06 |
| 94 | #define MOXA_MUST_THRTL_REGISTER 0x07 |
| 95 | #define MOXA_MUST_ENUM_REGISTER 0x04 |
| 96 | #define MOXA_MUST_HWID_REGISTER 0x05 |
| 97 | #define MOXA_MUST_ECR_REGISTER 0x06 |
| 98 | #define MOXA_MUST_CSR_REGISTER 0x07 |
| 99 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 100 | /* good data mode enable */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 101 | #define MOXA_MUST_FCR_GDA_MODE_ENABLE 0x20 |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 102 | /* only good data put into RxFIFO */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 103 | #define MOXA_MUST_FCR_GDA_ONLY_ENABLE 0x10 |
| 104 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 105 | /* enable CTS interrupt */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 106 | #define MOXA_MUST_IER_ECTSI 0x80 |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 107 | /* enable RTS interrupt */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 108 | #define MOXA_MUST_IER_ERTSI 0x40 |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 109 | /* enable Xon/Xoff interrupt */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 110 | #define MOXA_MUST_IER_XINT 0x20 |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 111 | /* enable GDA interrupt */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 112 | #define MOXA_MUST_IER_EGDAI 0x10 |
| 113 | |
| 114 | #define MOXA_MUST_RECV_ISR (UART_IER_RDI | MOXA_MUST_IER_EGDAI) |
| 115 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 116 | /* GDA interrupt pending */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 117 | #define MOXA_MUST_IIR_GDA 0x1C |
| 118 | #define MOXA_MUST_IIR_RDA 0x04 |
| 119 | #define MOXA_MUST_IIR_RTO 0x0C |
| 120 | #define MOXA_MUST_IIR_LSR 0x06 |
| 121 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 122 | /* recieved Xon/Xoff or specical interrupt pending */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 123 | #define MOXA_MUST_IIR_XSC 0x10 |
| 124 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 125 | /* RTS/CTS change state interrupt pending */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 126 | #define MOXA_MUST_IIR_RTSCTS 0x20 |
| 127 | #define MOXA_MUST_IIR_MASK 0x3E |
| 128 | |
| 129 | #define MOXA_MUST_MCR_XON_FLAG 0x40 |
| 130 | #define MOXA_MUST_MCR_XON_ANY 0x80 |
| 131 | #define MOXA_MUST_MCR_TX_XON 0x08 |
| 132 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 133 | /* software flow control on chip mask value */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 134 | #define MOXA_MUST_EFR_SF_MASK 0x0F |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 135 | /* send Xon1/Xoff1 */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 136 | #define MOXA_MUST_EFR_SF_TX1 0x08 |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 137 | /* send Xon2/Xoff2 */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 138 | #define MOXA_MUST_EFR_SF_TX2 0x04 |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 139 | /* send Xon1,Xon2/Xoff1,Xoff2 */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 140 | #define MOXA_MUST_EFR_SF_TX12 0x0C |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 141 | /* don't send Xon/Xoff */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 142 | #define MOXA_MUST_EFR_SF_TX_NO 0x00 |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 143 | /* Tx software flow control mask */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 144 | #define MOXA_MUST_EFR_SF_TX_MASK 0x0C |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 145 | /* don't receive Xon/Xoff */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 146 | #define MOXA_MUST_EFR_SF_RX_NO 0x00 |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 147 | /* receive Xon1/Xoff1 */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 148 | #define MOXA_MUST_EFR_SF_RX1 0x02 |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 149 | /* receive Xon2/Xoff2 */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 150 | #define MOXA_MUST_EFR_SF_RX2 0x01 |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 151 | /* receive Xon1,Xon2/Xoff1,Xoff2 */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 152 | #define MOXA_MUST_EFR_SF_RX12 0x03 |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 153 | /* Rx software flow control mask */ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 154 | #define MOXA_MUST_EFR_SF_RX_MASK 0x03 |
| 155 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 156 | #define ENABLE_MOXA_MUST_ENCHANCE_MODE(baseio) do { \ |
| 157 | u8 __oldlcr, __efr; \ |
| 158 | __oldlcr = inb((baseio)+UART_LCR); \ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 159 | outb(MOXA_MUST_ENTER_ENCHANCE, (baseio)+UART_LCR); \ |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 160 | __efr = inb((baseio)+MOXA_MUST_EFR_REGISTER); \ |
| 161 | __efr |= MOXA_MUST_EFR_EFRB_ENABLE; \ |
| 162 | outb(__efr, (baseio)+MOXA_MUST_EFR_REGISTER); \ |
| 163 | outb(__oldlcr, (baseio)+UART_LCR); \ |
| 164 | } while (0) |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 165 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 166 | #define DISABLE_MOXA_MUST_ENCHANCE_MODE(baseio) do { \ |
| 167 | u8 __oldlcr, __efr; \ |
| 168 | __oldlcr = inb((baseio)+UART_LCR); \ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 169 | outb(MOXA_MUST_ENTER_ENCHANCE, (baseio)+UART_LCR); \ |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 170 | __efr = inb((baseio)+MOXA_MUST_EFR_REGISTER); \ |
| 171 | __efr &= ~MOXA_MUST_EFR_EFRB_ENABLE; \ |
| 172 | outb(__efr, (baseio)+MOXA_MUST_EFR_REGISTER); \ |
| 173 | outb(__oldlcr, (baseio)+UART_LCR); \ |
| 174 | } while (0) |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 175 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 176 | #define SET_MOXA_MUST_XON1_VALUE(baseio, Value) do { \ |
| 177 | u8 __oldlcr, __efr; \ |
| 178 | __oldlcr = inb((baseio)+UART_LCR); \ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 179 | outb(MOXA_MUST_ENTER_ENCHANCE, (baseio)+UART_LCR); \ |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 180 | __efr = inb((baseio)+MOXA_MUST_EFR_REGISTER); \ |
| 181 | __efr &= ~MOXA_MUST_EFR_BANK_MASK; \ |
| 182 | __efr |= MOXA_MUST_EFR_BANK0; \ |
| 183 | outb(__efr, (baseio)+MOXA_MUST_EFR_REGISTER); \ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 184 | outb((u8)(Value), (baseio)+MOXA_MUST_XON1_REGISTER); \ |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 185 | outb(__oldlcr, (baseio)+UART_LCR); \ |
| 186 | } while (0) |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 187 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 188 | #define SET_MOXA_MUST_XOFF1_VALUE(baseio, Value) do { \ |
| 189 | u8 __oldlcr, __efr; \ |
| 190 | __oldlcr = inb((baseio)+UART_LCR); \ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 191 | outb(MOXA_MUST_ENTER_ENCHANCE, (baseio)+UART_LCR); \ |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 192 | __efr = inb((baseio)+MOXA_MUST_EFR_REGISTER); \ |
| 193 | __efr &= ~MOXA_MUST_EFR_BANK_MASK; \ |
| 194 | __efr |= MOXA_MUST_EFR_BANK0; \ |
| 195 | outb(__efr, (baseio)+MOXA_MUST_EFR_REGISTER); \ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 196 | outb((u8)(Value), (baseio)+MOXA_MUST_XOFF1_REGISTER); \ |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 197 | outb(__oldlcr, (baseio)+UART_LCR); \ |
| 198 | } while (0) |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 199 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 200 | #define SET_MOXA_MUST_FIFO_VALUE(info) do { \ |
| 201 | u8 __oldlcr, __efr; \ |
| 202 | __oldlcr = inb((info)->ioaddr+UART_LCR); \ |
| 203 | outb(MOXA_MUST_ENTER_ENCHANCE, (info)->ioaddr+UART_LCR);\ |
Jiri Slaby | 55b307d | 2006-12-08 02:38:14 -0800 | [diff] [blame] | 204 | __efr = inb((info)->ioaddr+MOXA_MUST_EFR_REGISTER); \ |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 205 | __efr &= ~MOXA_MUST_EFR_BANK_MASK; \ |
| 206 | __efr |= MOXA_MUST_EFR_BANK1; \ |
Jiri Slaby | 55b307d | 2006-12-08 02:38:14 -0800 | [diff] [blame] | 207 | outb(__efr, (info)->ioaddr+MOXA_MUST_EFR_REGISTER); \ |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 208 | outb((u8)((info)->rx_high_water), (info)->ioaddr+ \ |
| 209 | MOXA_MUST_RBRTH_REGISTER); \ |
| 210 | outb((u8)((info)->rx_trigger), (info)->ioaddr+ \ |
| 211 | MOXA_MUST_RBRTI_REGISTER); \ |
| 212 | outb((u8)((info)->rx_low_water), (info)->ioaddr+ \ |
| 213 | MOXA_MUST_RBRTL_REGISTER); \ |
| 214 | outb(__oldlcr, (info)->ioaddr+UART_LCR); \ |
| 215 | } while (0) |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 216 | |
Jiri Slaby | f64c84a | 2007-02-10 01:45:21 -0800 | [diff] [blame] | 217 | #define SET_MOXA_MUST_ENUM_VALUE(baseio, Value) do { \ |
| 218 | u8 __oldlcr, __efr; \ |
| 219 | __oldlcr = inb((baseio)+UART_LCR); \ |
| 220 | outb(MOXA_MUST_ENTER_ENCHANCE, (baseio)+UART_LCR); \ |
| 221 | __efr = inb((baseio)+MOXA_MUST_EFR_REGISTER); \ |
| 222 | __efr &= ~MOXA_MUST_EFR_BANK_MASK; \ |
| 223 | __efr |= MOXA_MUST_EFR_BANK2; \ |
| 224 | outb(__efr, (baseio)+MOXA_MUST_EFR_REGISTER); \ |
| 225 | outb((u8)(Value), (baseio)+MOXA_MUST_ENUM_REGISTER); \ |
| 226 | outb(__oldlcr, (baseio)+UART_LCR); \ |
| 227 | } while (0) |
| 228 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 229 | #define GET_MOXA_MUST_HARDWARE_ID(baseio, pId) do { \ |
| 230 | u8 __oldlcr, __efr; \ |
| 231 | __oldlcr = inb((baseio)+UART_LCR); \ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 232 | outb(MOXA_MUST_ENTER_ENCHANCE, (baseio)+UART_LCR); \ |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 233 | __efr = inb((baseio)+MOXA_MUST_EFR_REGISTER); \ |
| 234 | __efr &= ~MOXA_MUST_EFR_BANK_MASK; \ |
| 235 | __efr |= MOXA_MUST_EFR_BANK2; \ |
| 236 | outb(__efr, (baseio)+MOXA_MUST_EFR_REGISTER); \ |
| 237 | *pId = inb((baseio)+MOXA_MUST_HWID_REGISTER); \ |
| 238 | outb(__oldlcr, (baseio)+UART_LCR); \ |
| 239 | } while (0) |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 240 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 241 | #define SET_MOXA_MUST_NO_SOFTWARE_FLOW_CONTROL(baseio) do { \ |
| 242 | u8 __oldlcr, __efr; \ |
| 243 | __oldlcr = inb((baseio)+UART_LCR); \ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 244 | outb(MOXA_MUST_ENTER_ENCHANCE, (baseio)+UART_LCR); \ |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 245 | __efr = inb((baseio)+MOXA_MUST_EFR_REGISTER); \ |
| 246 | __efr &= ~MOXA_MUST_EFR_SF_MASK; \ |
| 247 | outb(__efr, (baseio)+MOXA_MUST_EFR_REGISTER); \ |
| 248 | outb(__oldlcr, (baseio)+UART_LCR); \ |
| 249 | } while (0) |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 250 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 251 | #define ENABLE_MOXA_MUST_TX_SOFTWARE_FLOW_CONTROL(baseio) do { \ |
| 252 | u8 __oldlcr, __efr; \ |
| 253 | __oldlcr = inb((baseio)+UART_LCR); \ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 254 | outb(MOXA_MUST_ENTER_ENCHANCE, (baseio)+UART_LCR); \ |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 255 | __efr = inb((baseio)+MOXA_MUST_EFR_REGISTER); \ |
| 256 | __efr &= ~MOXA_MUST_EFR_SF_TX_MASK; \ |
| 257 | __efr |= MOXA_MUST_EFR_SF_TX1; \ |
| 258 | outb(__efr, (baseio)+MOXA_MUST_EFR_REGISTER); \ |
| 259 | outb(__oldlcr, (baseio)+UART_LCR); \ |
| 260 | } while (0) |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 261 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 262 | #define DISABLE_MOXA_MUST_TX_SOFTWARE_FLOW_CONTROL(baseio) do { \ |
| 263 | u8 __oldlcr, __efr; \ |
| 264 | __oldlcr = inb((baseio)+UART_LCR); \ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 265 | outb(MOXA_MUST_ENTER_ENCHANCE, (baseio)+UART_LCR); \ |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 266 | __efr = inb((baseio)+MOXA_MUST_EFR_REGISTER); \ |
| 267 | __efr &= ~MOXA_MUST_EFR_SF_TX_MASK; \ |
| 268 | outb(__efr, (baseio)+MOXA_MUST_EFR_REGISTER); \ |
| 269 | outb(__oldlcr, (baseio)+UART_LCR); \ |
| 270 | } while (0) |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 271 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 272 | #define ENABLE_MOXA_MUST_RX_SOFTWARE_FLOW_CONTROL(baseio) do { \ |
| 273 | u8 __oldlcr, __efr; \ |
| 274 | __oldlcr = inb((baseio)+UART_LCR); \ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 275 | outb(MOXA_MUST_ENTER_ENCHANCE, (baseio)+UART_LCR); \ |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 276 | __efr = inb((baseio)+MOXA_MUST_EFR_REGISTER); \ |
| 277 | __efr &= ~MOXA_MUST_EFR_SF_RX_MASK; \ |
| 278 | __efr |= MOXA_MUST_EFR_SF_RX1; \ |
| 279 | outb(__efr, (baseio)+MOXA_MUST_EFR_REGISTER); \ |
| 280 | outb(__oldlcr, (baseio)+UART_LCR); \ |
| 281 | } while (0) |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 282 | |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 283 | #define DISABLE_MOXA_MUST_RX_SOFTWARE_FLOW_CONTROL(baseio) do { \ |
| 284 | u8 __oldlcr, __efr; \ |
| 285 | __oldlcr = inb((baseio)+UART_LCR); \ |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 286 | outb(MOXA_MUST_ENTER_ENCHANCE, (baseio)+UART_LCR); \ |
Jiri Slaby | ed79ba1 | 2007-02-10 01:45:18 -0800 | [diff] [blame] | 287 | __efr = inb((baseio)+MOXA_MUST_EFR_REGISTER); \ |
| 288 | __efr &= ~MOXA_MUST_EFR_SF_RX_MASK; \ |
| 289 | outb(__efr, (baseio)+MOXA_MUST_EFR_REGISTER); \ |
| 290 | outb(__oldlcr, (baseio)+UART_LCR); \ |
| 291 | } while (0) |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 292 | |
Jiri Slaby | 037ad48 | 2006-12-08 02:38:11 -0800 | [diff] [blame] | 293 | #endif |