i2hw.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. /*******************************************************************************
  2. *
  3. * (c) 1999 by Computone Corporation
  4. *
  5. ********************************************************************************
  6. *
  7. *
  8. * PACKAGE: Linux tty Device Driver for IntelliPort II family of multiport
  9. * serial I/O controllers.
  10. *
  11. * DESCRIPTION: Definitions limited to properties of the hardware or the
  12. * bootstrap firmware. As such, they are applicable regardless of
  13. * operating system or loadware (standard or diagnostic).
  14. *
  15. *******************************************************************************/
  16. #ifndef I2HW_H
  17. #define I2HW_H 1
  18. //------------------------------------------------------------------------------
  19. // Revision History:
  20. //
  21. // 23 September 1991 MAG First Draft Started...through...
  22. // 11 October 1991 ... Continuing development...
  23. // 6 August 1993 Added support for ISA-4 (asic) which is architected
  24. // as an ISA-CEX with a single 4-port box.
  25. //
  26. // 20 December 1996 AKM Version for Linux
  27. //
  28. //------------------------------------------------------------------------------
  29. /*------------------------------------------------------------------------------
  30. HARDWARE DESCRIPTION:
  31. Introduction:
  32. The IntelliPort-II and IntelliPort-IIEX products occupy a block of eight (8)
  33. addresses in the host's I/O space.
  34. Some addresses are used to transfer data to/from the board, some to transfer
  35. so-called "mailbox" messages, and some to read bit-mapped status information.
  36. While all the products in the line are functionally similar, some use a 16-bit
  37. data path to transfer data while others use an 8-bit path. Also, the use of
  38. command /status/mailbox registers differs slightly between the II and IIEX
  39. branches of the family.
  40. The host determines what type of board it is dealing with by reading a string of
  41. sixteen characters from the board. These characters are always placed in the
  42. fifo by the board's local processor whenever the board is reset (either from
  43. power-on or under software control) and are known as the "Power-on Reset
  44. Message." In order that this message can be read from either type of board, the
  45. hardware registers used in reading this message are the same. Once this message
  46. has been read by the host, then it has the information required to operate.
  47. General Differences between boards:
  48. The greatest structural difference is between the -II and -IIEX families of
  49. product. The -II boards use the Am4701 dual 512x8 bidirectional fifo to support
  50. the data path, mailbox registers, and status registers. This chip contains some
  51. features which are not used in the IntelliPort-II products; a description of
  52. these is omitted here. Because of these many features, it contains many
  53. registers, too many to access directly within a small address space. They are
  54. accessed by first writing a value to a "pointer" register. This value selects
  55. the register to be accessed. The next read or write to that address accesses
  56. the selected register rather than the pointer register.
  57. The -IIEX boards use a proprietary design similar to the Am4701 in function. But
  58. because of a simpler, more streamlined design it doesn't require so many
  59. registers. This means they can be accessed directly in single operations rather
  60. than through a pointer register.
  61. Besides these differences, there are differences in whether 8-bit or 16-bit
  62. transfers are used to move data to the board.
  63. The -II boards are capable only of 8-bit data transfers, while the -IIEX boards
  64. may be configured for either 8-bit or 16-bit data transfers. If the on-board DIP
  65. switch #8 is ON, and the card has been installed in a 16-bit slot, 16-bit
  66. transfers are supported (and will be expected by the standard loadware). The
  67. on-board firmware can determine the position of the switch, and whether the
  68. board is installed in a 16-bit slot; it supplies this information to the host as
  69. part of the power-up reset message.
  70. The configuration switch (#8) and slot selection do not directly configure the
  71. hardware. It is up to the on-board loadware and host-based drivers to act
  72. according to the selected options. That is, loadware and drivers could be
  73. written to perform 8-bit transfers regardless of the state of the DIP switch or
  74. slot (and in a diagnostic environment might well do so). Likewise, 16-bit
  75. transfers could be performed as long as the card is in a 16-bit slot.
  76. Note the slot selection and DIP switch selection are provided separately: a
  77. board running in 8-bit mode in a 16-bit slot has a greater range of possible
  78. interrupts to choose from; information of potential use to the host.
  79. All 8-bit data transfers are done in the same way, regardless of whether on a
  80. -II board or a -IIEX board.
  81. The host must consider two things then: 1) whether a -II or -IIEX product is
  82. being used, and 2) whether an 8-bit or 16-bit data path is used.
  83. A further difference is that -II boards always have a 512-byte fifo operating in
  84. each direction. -IIEX boards may use fifos of varying size; this size is
  85. reported as part of the power-up message.
  86. I/O Map Of IntelliPort-II and IntelliPort-IIEX boards:
  87. (Relative to the chosen base address)
  88. Addr R/W IntelliPort-II IntelliPort-IIEX
  89. ---- --- -------------- ----------------
  90. 0 R/W Data Port (byte) Data Port (byte or word)
  91. 1 R/W (Not used) (MSB of word-wide data written to Data Port)
  92. 2 R Status Register Status Register
  93. 2 W Pointer Register Interrupt Mask Register
  94. 3 R/W (Not used) Mailbox Registers (6 bits: 11111100)
  95. 4,5 -- Reserved for future products
  96. 6 -- Reserved for future products
  97. 7 R Guaranteed to have no effect
  98. 7 W Hardware reset of board.
  99. Rules:
  100. All data transfers are performed using the even i/o address. If byte-wide data
  101. transfers are being used, do INB/OUTB operations on the data port. If word-wide
  102. transfers are used, do INW/OUTW operations. In some circumstances (such as
  103. reading the power-up message) you will do INB from the data port, but in this
  104. case the MSB of each word read is lost. When accessing all other unreserved
  105. registers, use byte operations only.
  106. ------------------------------------------------------------------------------*/
  107. //------------------------------------------------
  108. // Mandatory Includes:
  109. //------------------------------------------------
  110. //
  111. #include "ip2types.h"
  112. //-------------------------------------------------------------------------
  113. // Manifests for the I/O map:
  114. //-------------------------------------------------------------------------
  115. // R/W: Data port (byte) for IntelliPort-II,
  116. // R/W: Data port (byte or word) for IntelliPort-IIEX
  117. // Incoming or outgoing data passes through a FIFO, the status of which is
  118. // available in some of the bits in FIFO_STATUS. This (bidirectional) FIFO is
  119. // the primary means of transferring data, commands, flow-control, and status
  120. // information between the host and board.
  121. //
  122. #define FIFO_DATA 0
  123. // Another way of passing information between the board and the host is
  124. // through "mailboxes". Unlike a FIFO, a mailbox holds only a single byte of
  125. // data. Writing data to the mailbox causes a status bit to be set, and
  126. // potentially interrupting the intended receiver. The sender has some way to
  127. // determine whether the data has been read yet; as soon as it has, it may send
  128. // more. The mailboxes are handled differently on -II and -IIEX products, as
  129. // suggested below.
  130. //------------------------------------------------------------------------------
  131. // Read: Status Register for IntelliPort-II or -IIEX
  132. // The presence of any bit set here will cause an interrupt to the host,
  133. // provided the corresponding bit has been unmasked in the interrupt mask
  134. // register. Furthermore, interrupts to the host are disabled globally until the
  135. // loadware selects the irq line to use. With the exception of STN_MR, the bits
  136. // remain set so long as the associated condition is true.
  137. //
  138. #define FIFO_STATUS 2
  139. // Bit map of status bits which are identical for -II and -IIEX
  140. //
  141. #define ST_OUT_FULL 0x40 // Outbound FIFO full
  142. #define ST_IN_EMPTY 0x20 // Inbound FIFO empty
  143. #define ST_IN_MAIL 0x04 // Inbound Mailbox full
  144. // The following exists only on the Intelliport-IIEX, and indicates that the
  145. // board has not read the last outgoing mailbox data yet. In the IntelliPort-II,
  146. // the outgoing mailbox may be read back: a zero indicates the board has read
  147. // the data.
  148. //
  149. #define STE_OUT_MAIL 0x80 // Outbound mailbox full (!)
  150. // The following bits are defined differently for -II and -IIEX boards. Code
  151. // which relies on these bits will need to be functionally different for the two
  152. // types of boards and should be generally avoided because of the additional
  153. // complexity this creates:
  154. // Bit map of status bits only on -II
  155. // Fifo has been RESET (cleared when the status register is read). Note that
  156. // this condition cannot be masked and would always interrupt the host, except
  157. // that the hardware reset also disables interrupts globally from the board
  158. // until re-enabled by loadware. This could also arise from the
  159. // Am4701-supported command to reset the chip, but this command is generally not
  160. // used here.
  161. //
  162. #define STN_MR 0x80
  163. // See the AMD Am4701 data sheet for details on the following four bits. They
  164. // are not presently used by Computone drivers.
  165. //
  166. #define STN_OUT_AF 0x10 // Outbound FIFO almost full (programmable)
  167. #define STN_IN_AE 0x08 // Inbound FIFO almost empty (programmable)
  168. #define STN_BD 0x02 // Inbound byte detected
  169. #define STN_PE 0x01 // Parity/Framing condition detected
  170. // Bit-map of status bits only on -IIEX
  171. //
  172. #define STE_OUT_HF 0x10 // Outbound FIFO half full
  173. #define STE_IN_HF 0x08 // Inbound FIFO half full
  174. #define STE_IN_FULL 0x02 // Inbound FIFO full
  175. #define STE_OUT_MT 0x01 // Outbound FIFO empty
  176. //------------------------------------------------------------------------------
  177. // Intelliport-II -- Write Only: the pointer register.
  178. // Values are written to this register to select the Am4701 internal register to
  179. // be accessed on the next operation.
  180. //
  181. #define FIFO_PTR 0x02
  182. // Values for the pointer register
  183. //
  184. #define SEL_COMMAND 0x1 // Selects the Am4701 command register
  185. // Some possible commands:
  186. //
  187. #define SEL_CMD_MR 0x80 // Am4701 command to reset the chip
  188. #define SEL_CMD_SH 0x40 // Am4701 command to map the "other" port into the
  189. // status register.
  190. #define SEL_CMD_UNSH 0 // Am4701 command to "unshift": port maps into its
  191. // own status register.
  192. #define SEL_MASK 0x2 // Selects the Am4701 interrupt mask register. The
  193. // interrupt mask register is bit-mapped to match
  194. // the status register (FIFO_STATUS) except for
  195. // STN_MR. (See above.)
  196. #define SEL_BYTE_DET 0x3 // Selects the Am4701 byte-detect register. (Not
  197. // normally used except in diagnostics.)
  198. #define SEL_OUTMAIL 0x4 // Selects the outbound mailbox (R/W). Reading back
  199. // a value of zero indicates that the mailbox has
  200. // been read by the board and is available for more
  201. // data./ Writing to the mailbox optionally
  202. // interrupts the board, depending on the loadware's
  203. // setting of its interrupt mask register.
  204. #define SEL_AEAF 0x5 // Selects AE/AF threshold register.
  205. #define SEL_INMAIL 0x6 // Selects the inbound mailbox (Read)
  206. //------------------------------------------------------------------------------
  207. // IntelliPort-IIEX -- Write Only: interrupt mask (and misc flags) register:
  208. // Unlike IntelliPort-II, bit assignments do NOT match those of the status
  209. // register.
  210. //
  211. #define FIFO_MASK 0x2
  212. // Mailbox readback select:
  213. // If set, reads to FIFO_MAIL will read the OUTBOUND mailbox (host to board). If
  214. // clear (default on reset) reads to FIFO_MAIL will read the INBOUND mailbox.
  215. // This is the normal situation. The clearing of a mailbox is determined on
  216. // -IIEX boards by waiting for the STE_OUT_MAIL bit to clear. Readback
  217. // capability is provided for diagnostic purposes only.
  218. //
  219. #define MX_OUTMAIL_RSEL 0x80
  220. #define MX_IN_MAIL 0x40 // Enables interrupts when incoming mailbox goes
  221. // full (ST_IN_MAIL set).
  222. #define MX_IN_FULL 0x20 // Enables interrupts when incoming FIFO goes full
  223. // (STE_IN_FULL).
  224. #define MX_IN_MT 0x08 // Enables interrupts when incoming FIFO goes empty
  225. // (ST_IN_MT).
  226. #define MX_OUT_FULL 0x04 // Enables interrupts when outgoing FIFO goes full
  227. // (ST_OUT_FULL).
  228. #define MX_OUT_MT 0x01 // Enables interrupts when outgoing FIFO goes empty
  229. // (STE_OUT_MT).
  230. // Any remaining bits are reserved, and should be written to ZERO for
  231. // compatibility with future Computone products.
  232. //------------------------------------------------------------------------------
  233. // IntelliPort-IIEX: -- These are only 6-bit mailboxes !!! -- 11111100 (low two
  234. // bits always read back 0).
  235. // Read: One of the mailboxes, usually Inbound.
  236. // Inbound Mailbox (MX_OUTMAIL_RSEL = 0)
  237. // Outbound Mailbox (MX_OUTMAIL_RSEL = 1)
  238. // Write: Outbound Mailbox
  239. // For the IntelliPort-II boards, the outbound mailbox is read back to determine
  240. // whether the board has read the data (0 --> data has been read). For the
  241. // IntelliPort-IIEX, this is done by reading a status register. To determine
  242. // whether mailbox is available for more outbound data, use the STE_OUT_MAIL bit
  243. // in FIFO_STATUS. Moreover, although the Outbound Mailbox can be read back by
  244. // setting MX_OUTMAIL_RSEL, it is NOT cleared when the board reads it, as is the
  245. // case with the -II boards. For this reason, FIFO_MAIL is normally used to read
  246. // the inbound FIFO, and MX_OUTMAIL_RSEL kept clear. (See above for
  247. // MX_OUTMAIL_RSEL description.)
  248. //
  249. #define FIFO_MAIL 0x3
  250. //------------------------------------------------------------------------------
  251. // WRITE ONLY: Resets the board. (Data doesn't matter).
  252. //
  253. #define FIFO_RESET 0x7
  254. //------------------------------------------------------------------------------
  255. // READ ONLY: Will have no effect. (Data is undefined.)
  256. // Actually, there will be an effect, in that the operation is sure to generate
  257. // a bus cycle: viz., an I/O byte Read. This fact can be used to enforce short
  258. // delays when no comparable time constant is available.
  259. //
  260. #define FIFO_NOP 0x7
  261. //------------------------------------------------------------------------------
  262. // RESET & POWER-ON RESET MESSAGE
  263. /*------------------------------------------------------------------------------
  264. RESET:
  265. The IntelliPort-II and -IIEX boards are reset in three ways: Power-up, channel
  266. reset, and via a write to the reset register described above. For products using
  267. the ISA bus, these three sources of reset are equvalent. For MCA and EISA buses,
  268. the Power-up and channel reset sources cause additional hardware initialization
  269. which should only occur at system startup time.
  270. The third type of reset, called a "command reset", is done by writing any data
  271. to the FIFO_RESET address described above. This resets the on-board processor,
  272. FIFO, UARTS, and associated hardware.
  273. This passes control of the board to the bootstrap firmware, which performs a
  274. Power-On Self Test and which detects its current configuration. For example,
  275. -IIEX products determine the size of FIFO which has been installed, and the
  276. number and type of expansion boxes attached.
  277. This and other information is then written to the FIFO in a 16-byte data block
  278. to be read by the host. This block is guaranteed to be present within two (2)
  279. seconds of having received the command reset. The firmware is now ready to
  280. receive loadware from the host.
  281. It is good practice to perform a command reset to the board explicitly as part
  282. of your software initialization. This allows your code to properly restart from
  283. a soft boot. (Many systems do not issue channel reset on soft boot).
  284. Because of a hardware reset problem on some of the Cirrus Logic 1400's which are
  285. used on the product, it is recommended that you reset the board twice, separated
  286. by an approximately 50 milliseconds delay. (VERY approximately: probably ok to
  287. be off by a factor of five. The important point is that the first command reset
  288. in fact generates a reset pulse on the board. This pulse is guaranteed to last
  289. less than 10 milliseconds. The additional delay ensures the 1400 has had the
  290. chance to respond sufficiently to the first reset. Why not a longer delay? Much
  291. more than 50 milliseconds gets to be noticable, but the board would still work.
  292. Once all 16 bytes of the Power-on Reset Message have been read, the bootstrap
  293. firmware is ready to receive loadware.
  294. Note on Power-on Reset Message format:
  295. The various fields have been designed with future expansion in view.
  296. Combinations of bitfields and values have been defined which define products
  297. which may not currently exist. This has been done to allow drivers to anticipate
  298. the possible introduction of products in a systematic fashion. This is not
  299. intended to suggest that each potential product is actually under consideration.
  300. ------------------------------------------------------------------------------*/
  301. //----------------------------------------
  302. // Format of Power-on Reset Message
  303. //----------------------------------------
  304. typedef union _porStr // "por" stands for Power On Reset
  305. {
  306. unsigned char c[16]; // array used when considering the message as a
  307. // string of undifferentiated characters
  308. struct // Elements used when considering values
  309. {
  310. // The first two bytes out of the FIFO are two magic numbers. These are
  311. // intended to establish that there is indeed a member of the
  312. // IntelliPort-II(EX) family present. The remaining bytes may be
  313. // expected // to be valid. When reading the Power-on Reset message,
  314. // if the magic numbers do not match it is probably best to stop
  315. // reading immediately. You are certainly not reading our board (unless
  316. // hardware is faulty), and may in fact be reading some other piece of
  317. // hardware.
  318. unsigned char porMagic1; // magic number: first byte == POR_MAGIC_1
  319. unsigned char porMagic2; // magic number: second byte == POR_MAGIC_2
  320. // The Version, Revision, and Subrevision are stored as absolute numbers
  321. // and would normally be displayed in the format V.R.S (e.g. 1.0.2)
  322. unsigned char porVersion; // Bootstrap firmware version number
  323. unsigned char porRevision; // Bootstrap firmware revision number
  324. unsigned char porSubRev; // Bootstrap firmware sub-revision number
  325. unsigned char porID; // Product ID: Bit-mapped according to
  326. // conventions described below. Among other
  327. // things, this allows us to distinguish
  328. // IntelliPort-II boards from IntelliPort-IIEX
  329. // boards.
  330. unsigned char porBus; // IntelliPort-II: Unused
  331. // IntelliPort-IIEX: Bus Information:
  332. // Bit-mapped below
  333. unsigned char porMemory; // On-board DRAM size: in 32k blocks
  334. // porPorts1 (and porPorts2) are used to determine the ports which are
  335. // available to the board. For non-expandable product, a single number
  336. // is sufficient. For expandable product, the board may be connected
  337. // to as many as four boxes. Each box may be (so far) either a 16-port
  338. // or an 8-port size. Whenever an 8-port box is used, the remaining 8
  339. // ports leave gaps between existing channels. For that reason,
  340. // expandable products must report a MAP of available channels. Since
  341. // each UART supports four ports, we represent each UART found by a
  342. // single bit. Using two bytes to supply the mapping information we
  343. // report the presense or absense of up to 16 UARTS, or 64 ports in
  344. // steps of 4 ports. For -IIEX products, the ports are numbered
  345. // starting at the box closest to the controller in the "chain".
  346. // Interpreted Differently for IntelliPort-II and -IIEX.
  347. // -II: Number of ports (Derived actually from product ID). See
  348. // Diag1&2 to indicate if uart was actually detected.
  349. // -IIEX: Bit-map of UARTS found, LSB (see below for MSB of this). This
  350. // bitmap is based on detecting the uarts themselves;
  351. // see porFlags for information from the box i.d's.
  352. unsigned char porPorts1;
  353. unsigned char porDiag1; // Results of on-board P.O.S.T, 1st byte
  354. unsigned char porDiag2; // Results of on-board P.O.S.T, 2nd byte
  355. unsigned char porSpeed; // Speed of local CPU: given as MHz x10
  356. // e.g., 16.0 MHz CPU is reported as 160
  357. unsigned char porFlags; // Misc information (see manifests below)
  358. // Bit-mapped: CPU type, UART's present
  359. unsigned char porPorts2; // -II: Undefined
  360. // -IIEX: Bit-map of UARTS found, MSB (see
  361. // above for LSB)
  362. // IntelliPort-II: undefined
  363. // IntelliPort-IIEX: 1 << porFifoSize gives the size, in bytes, of the
  364. // host interface FIFO, in each direction. When running the -IIEX in
  365. // 8-bit mode, fifo capacity is halved. The bootstrap firmware will
  366. // have already accounted for this fact in generating this number.
  367. unsigned char porFifoSize;
  368. // IntelliPort-II: undefined
  369. // IntelliPort-IIEX: The number of boxes connected. (Presently 1-4)
  370. unsigned char porNumBoxes;
  371. } e;
  372. } porStr, *porStrPtr;
  373. //--------------------------
  374. // Values for porStr fields
  375. //--------------------------
  376. //---------------------
  377. // porMagic1, porMagic2
  378. //----------------------
  379. //
  380. #define POR_MAGIC_1 0x96 // The only valid value for porMagic1
  381. #define POR_MAGIC_2 0x35 // The only valid value for porMagic2
  382. #define POR_1_INDEX 0 // Byte position of POR_MAGIC_1
  383. #define POR_2_INDEX 1 // Ditto for POR_MAGIC_2
  384. //----------------------
  385. // porID
  386. //----------------------
  387. //
  388. #define POR_ID_FAMILY 0xc0 // These bits indicate the general family of
  389. // product.
  390. #define POR_ID_FII 0x00 // Family is "IntelliPort-II"
  391. #define POR_ID_FIIEX 0x40 // Family is "IntelliPort-IIEX"
  392. // These bits are reserved, presently zero. May be used at a later date to
  393. // convey other product information.
  394. //
  395. #define POR_ID_RESERVED 0x3c
  396. #define POR_ID_SIZE 0x03 // Remaining bits indicate number of ports &
  397. // Connector information.
  398. #define POR_ID_II_8 0x00 // For IntelliPort-II, indicates 8-port using
  399. // standard brick.
  400. #define POR_ID_II_8R 0x01 // For IntelliPort-II, indicates 8-port using
  401. // RJ11's (no CTS)
  402. #define POR_ID_II_6 0x02 // For IntelliPort-II, indicates 6-port using
  403. // RJ45's
  404. #define POR_ID_II_4 0x03 // For IntelliPort-II, indicates 4-port using
  405. // 4xRJ45 connectors
  406. #define POR_ID_EX 0x00 // For IntelliPort-IIEX, indicates standard
  407. // expandable controller (other values reserved)
  408. //----------------------
  409. // porBus
  410. //----------------------
  411. // IntelliPort-IIEX only: Board is installed in a 16-bit slot
  412. //
  413. #define POR_BUS_SLOT16 0x20
  414. // IntelliPort-IIEX only: DIP switch #8 is on, selecting 16-bit host interface
  415. // operation.
  416. //
  417. #define POR_BUS_DIP16 0x10
  418. // Bits 0-2 indicate type of bus: This information is stored in the bootstrap
  419. // loadware, different loadware being used on different products for different
  420. // buses. For most situations, the drivers do not need this information; but it
  421. // is handy in a diagnostic environment. For example, on microchannel boards,
  422. // you would not want to try to test several interrupts, only the one for which
  423. // you were configured.
  424. //
  425. #define POR_BUS_TYPE 0x07
  426. // Unknown: this product doesn't know what bus it is running in. (e.g. if same
  427. // bootstrap firmware were wanted for two different buses.)
  428. //
  429. #define POR_BUS_T_UNK 0
  430. // Note: existing firmware for ISA-8 and MC-8 currently report the POR_BUS_T_UNK
  431. // state, since the same bootstrap firmware is used for each.
  432. #define POR_BUS_T_MCA 1 // MCA BUS */
  433. #define POR_BUS_T_EISA 2 // EISA BUS */
  434. #define POR_BUS_T_ISA 3 // ISA BUS */
  435. // Values 4-7 Reserved
  436. // Remaining bits are reserved
  437. //----------------------
  438. // porDiag1
  439. //----------------------
  440. #define POR_BAD_MAPPER 0x80 // HW failure on P.O.S.T: Chip mapper failed
  441. // These two bits valid only for the IntelliPort-II
  442. //
  443. #define POR_BAD_UART1 0x01 // First 1400 bad
  444. #define POR_BAD_UART2 0x02 // Second 1400 bad
  445. //----------------------
  446. // porDiag2
  447. //----------------------
  448. #define POR_DEBUG_PORT 0x80 // debug port was detected by the P.O.S.T
  449. #define POR_DIAG_OK 0x00 // Indicates passage: Failure codes not yet
  450. // available.
  451. // Other bits undefined.
  452. //----------------------
  453. // porFlags
  454. //----------------------
  455. #define POR_CPU 0x03 // These bits indicate supposed CPU type
  456. #define POR_CPU_8 0x01 // Board uses an 80188 (no such thing yet)
  457. #define POR_CPU_6 0x02 // Board uses an 80186 (all existing products)
  458. #define POR_CEX4 0x04 // If set, this is an ISA-CEX/4: An ISA-4 (asic)
  459. // which is architected like an ISA-CEX connected
  460. // to a (hitherto impossible) 4-port box.
  461. #define POR_BOXES 0xf0 // Valid for IntelliPort-IIEX only: Map of Box
  462. // sizes based on box I.D.
  463. #define POR_BOX_16 0x10 // Set indicates 16-port, clear 8-port
  464. //-------------------------------------
  465. // LOADWARE and DOWNLOADING CODE
  466. //-------------------------------------
  467. /*
  468. Loadware may be sent to the board in two ways:
  469. 1) It may be read from a (binary image) data file block by block as each block
  470. is sent to the board. This is only possible when the initialization is
  471. performed by code which can access your file system. This is most suitable
  472. for diagnostics and appications which use the interface library directly.
  473. 2) It may be hard-coded into your source by including a .h file (typically
  474. supplied by Computone), which declares a data array and initializes every
  475. element. This acheives the same result as if an entire loadware file had
  476. been read into the array.
  477. This requires more data space in your program, but access to the file system
  478. is not required. This method is more suited to driver code, which typically
  479. is running at a level too low to access the file system directly.
  480. At present, loadware can only be generated at Computone.
  481. All Loadware begins with a header area which has a particular format. This
  482. includes a magic number which identifies the file as being (purportedly)
  483. loadware, CRC (for the loader), and version information.
  484. */
  485. //-----------------------------------------------------------------------------
  486. // Format of loadware block
  487. //
  488. // This is defined as a union so we can pass a pointer to one of these items
  489. // and (if it is the first block) pick out the version information, etc.
  490. //
  491. // Otherwise, to deal with this as a simple character array
  492. //------------------------------------------------------------------------------
  493. #define LOADWARE_BLOCK_SIZE 512 // Number of bytes in each block of loadware
  494. typedef union _loadHdrStr
  495. {
  496. unsigned char c[LOADWARE_BLOCK_SIZE]; // Valid for every block
  497. struct // These fields are valid for only the first block of loadware.
  498. {
  499. unsigned char loadMagic; // Magic number: see below
  500. unsigned char loadBlocksMore; // How many more blocks?
  501. unsigned char loadCRC[2]; // Two CRC bytes: used by loader
  502. unsigned char loadVersion; // Version number
  503. unsigned char loadRevision; // Revision number
  504. unsigned char loadSubRevision; // Sub-revision number
  505. unsigned char loadSpares[9]; // Presently unused
  506. unsigned char loadDates[32]; // Null-terminated string which can give
  507. // date and time of compilation
  508. } e;
  509. } loadHdrStr, *loadHdrStrPtr;
  510. //------------------------------------
  511. // Defines for downloading code:
  512. //------------------------------------
  513. // The loadMagic field in the first block of the loadfile must be this, else the
  514. // file is not valid.
  515. //
  516. #define MAGIC_LOADFILE 0x3c
  517. // How do we know the load was successful? On completion of the load, the
  518. // bootstrap firmware returns a code to indicate whether it thought the download
  519. // was valid and intends to execute it. These are the only possible valid codes:
  520. //
  521. #define LOADWARE_OK 0xc3 // Download was ok
  522. #define LOADWARE_BAD 0x5a // Download was bad (CRC error)
  523. // Constants applicable to writing blocks of loadware:
  524. // The first block of loadware might take 600 mS to load, in extreme cases.
  525. // (Expandable board: worst case for sending startup messages to the LCD's).
  526. // The 600mS figure is not really a calculation, but a conservative
  527. // guess/guarantee. Usually this will be within 100 mS, like subsequent blocks.
  528. //
  529. #define MAX_DLOAD_START_TIME 1000 // 1000 mS
  530. #define MAX_DLOAD_READ_TIME 100 // 100 mS
  531. // Firmware should respond with status (see above) within this long of host
  532. // having sent the final block.
  533. //
  534. #define MAX_DLOAD_ACK_TIME 100 // 100 mS, again!
  535. //------------------------------------------------------
  536. // MAXIMUM NUMBER OF PORTS PER BOARD:
  537. // This is fixed for now (with the expandable), but may
  538. // be expanding according to even newer products.
  539. //------------------------------------------------------
  540. //
  541. #define ABS_MAX_BOXES 4 // Absolute most boxes per board
  542. #define ABS_BIGGEST_BOX 16 // Absolute the most ports per box
  543. #define ABS_MOST_PORTS (ABS_MAX_BOXES * ABS_BIGGEST_BOX)
  544. #define I2_OUTSW(port, addr, count) outsw((port), (addr), (((count)+1)/2))
  545. #define I2_OUTSB(port, addr, count) outsb((port), (addr), (((count)+1))&-2)
  546. #define I2_INSW(port, addr, count) insw((port), (addr), (((count)+1)/2))
  547. #define I2_INSB(port, addr, count) insb((port), (addr), (((count)+1))&-2)
  548. #endif // I2HW_H