m68302.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:30k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* m68302.h - Motorola MC68302 CPU control registers */
  2. /* Copyright 1984-1996, Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01i,16dec96,dat  fixed some hdlc values, SPR 2260
  7. 01h,31may96,dat  correct use of volatile type for SCC_BUFF & SCC_REG
  8. 01g,10may96,dat  added IMP_SCCX_PARAM and IMP_SCCX_PROT for m68302Sio.
  9. 01f,22sep92,rrr  added support for c++
  10. 01e,10aug92,caf  added TY_CO_DEV and function declarations for 5.1 upgrade.
  11.  for 5.0.x compatibility, define INCLUDE_TY_CO_DRV_50 when
  12.  including this header.
  13. 01d,26may92,rrr  the tree shuffle
  14. 01c,04oct91,rrr  passed through the ansification filter
  15.   -fixed #else and #endif
  16.   -changed ASMLANGUAGE to _ASMLANGUAGE
  17.   -changed copyright notice
  18. 01b,30sep91,caf  added _ASMLANGUAGE conditional.
  19. 01a,19sep91,jcf  written.
  20. */
  21. /*
  22. This file contains I/O address and related constants for the MC68302.
  23. */
  24. #ifndef __INCm68302h
  25. #define __INCm68302h
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. #ifndef _ASMLANGUAGE
  30. #ifndef INCLUDE_TY_CO_DRV_50
  31. #include "tyLib.h"
  32. #endif /* INCLUDE_TY_CO_DRV_50 */
  33. /* System Configuration Registers */
  34. #define IMP_BAR ((UINT16 *)0xf2) /* Base Address Register */
  35. #define IMP_SCR ((UINT32 *)0xf4) /* System Control Register */
  36. /* MC68302 parameter register addresses */
  37. #define IMP_SCC1 ((SCC *)    (IMP_BASE_ADRS + 0x400))
  38. #define IMP_SCC1_PARAM ((SCC_PARAM *)(IMP_BASE_ADRS + 0x480))
  39. #define IMP_SCC1_PROT ((PROT_UART *) (IMP_BASE_ADRS + 0x49c))
  40. #define IMP_SCC2 ((SCC *)    (IMP_BASE_ADRS + 0x500))
  41. #define IMP_SCC2_PARAM ((SCC_PARAM *)(IMP_BASE_ADRS + 0x580))
  42. #define IMP_SCC2_PROT ((PROT_UART *) (IMP_BASE_ADRS + 0x59c))
  43. #define IMP_SCC3 ((SCC3 *)   (IMP_BASE_ADRS + 0x600))
  44. #define IMP_SCC3_PARAM ((SCC_PARAM *)(IMP_BASE_ADRS + 0x680))
  45. #define IMP_SCC3_PROT ((PROT_UART *) (IMP_BASE_ADRS + 0x69c))
  46. #define IMP_CMR ((UINT16 *) (IMP_BASE_ADRS + 0x802))
  47. #define IMP_SAPR ((UINT32 *) (IMP_BASE_ADRS + 0x804))
  48. #define IMP_DAPR ((UINT32 *) (IMP_BASE_ADRS + 0x808))
  49. #define IMP_BCR ((UINT16 *) (IMP_BASE_ADRS + 0x80c))
  50. #define IMP_CSR ((UINT8 *)  (IMP_BASE_ADRS + 0x80e))
  51. #define IMP_FCR ((UINT8 *)  (IMP_BASE_ADRS + 0x810))
  52. #define IMP_GIMR ((UINT16 *) (IMP_BASE_ADRS + 0x812))
  53. #define IMP_IPR ((UINT16 *) (IMP_BASE_ADRS + 0x814))
  54. #define IMP_IMR ((UINT16 *) (IMP_BASE_ADRS + 0x816))
  55. #define IMP_ISR ((UINT16 *) (IMP_BASE_ADRS + 0x818))
  56. #define IMP_PACNT ((UINT16 *) (IMP_BASE_ADRS + 0x81e))
  57. #define IMP_PADDR ((UINT16 *) (IMP_BASE_ADRS + 0x820))
  58. #define IMP_PADAT ((UINT16 *) (IMP_BASE_ADRS + 0x822))
  59. #define IMP_PBCNT ((UINT16 *) (IMP_BASE_ADRS + 0x824))
  60. #define IMP_PBDDR ((UINT16 *) (IMP_BASE_ADRS + 0x826))
  61. #define IMP_PBDAT ((UINT16 *) (IMP_BASE_ADRS + 0x828))
  62. #define IMP_BR0 ((UINT16 *) (IMP_BASE_ADRS + 0x830))
  63. #define IMP_OR0 ((UINT16 *) (IMP_BASE_ADRS + 0x832))
  64. #define IMP_BR1 ((UINT16 *) (IMP_BASE_ADRS + 0x834))
  65. #define IMP_OR1 ((UINT16 *) (IMP_BASE_ADRS + 0x836))
  66. #define IMP_BR2 ((UINT16 *) (IMP_BASE_ADRS + 0x838))
  67. #define IMP_OR2 ((UINT16 *) (IMP_BASE_ADRS + 0x83a))
  68. #define IMP_BR3 ((UINT16 *) (IMP_BASE_ADRS + 0x83c))
  69. #define IMP_OR3 ((UINT16 *) (IMP_BASE_ADRS + 0x83e))
  70. #define IMP_TMR1 ((UINT16 *) (IMP_BASE_ADRS + 0x840))
  71. #define IMP_TRR1 ((UINT16 *) (IMP_BASE_ADRS + 0x842))
  72. #define IMP_TCR1 ((UINT16 *) (IMP_BASE_ADRS + 0x844))
  73. #define IMP_TCN1 ((UINT16 *) (IMP_BASE_ADRS + 0x846))
  74. #define IMP_TER1 ((UINT8 *)  (IMP_BASE_ADRS + 0x849))
  75. #define IMP_WRR ((UINT16 *) (IMP_BASE_ADRS + 0x84a))
  76. #define IMP_WCN ((UINT16 *) (IMP_BASE_ADRS + 0x84c))
  77. #define IMP_TMR2 ((UINT16 *) (IMP_BASE_ADRS + 0x850))
  78. #define IMP_TRR2 ((UINT16 *) (IMP_BASE_ADRS + 0x852))
  79. #define IMP_TCR2 ((UINT16 *) (IMP_BASE_ADRS + 0x854))
  80. #define IMP_TCN2 ((UINT16 *) (IMP_BASE_ADRS + 0x856))
  81. #define IMP_TER2 ((UINT8 *)  (IMP_BASE_ADRS + 0x859))
  82. #define IMP_CR ((UINT8 *)  (IMP_BASE_ADRS + 0x860))
  83. #define IMP_SCC1_REG ((SCC_REG *)(IMP_BASE_ADRS + 0x880))
  84. #define IMP_SCC2_REG ((SCC_REG *)(IMP_BASE_ADRS + 0x890))
  85. #define IMP_SCC3_REG ((SCC_REG *)(IMP_BASE_ADRS + 0x8a0))
  86. #define IMP_SPMODE ((UINT16 *) (IMP_BASE_ADRS + 0x8b0))
  87. #define IMP_SIMASK ((UINT16 *) (IMP_BASE_ADRS + 0x8b2))
  88. #define IMP_SIMODE ((UINT16 *) (IMP_BASE_ADRS + 0x8b4))
  89. /* Internal Register Defines */
  90. /* CR - Command Registers */
  91. #define CR_FLG 0x01 /* CP/IMP spinlock flag */
  92. #define CR_GCI 0x40 /* GCI command */
  93. #define CR_GCI_TAR 0x00 /* GCI - Transmit abort request */
  94. #define CR_GCI_TOUT 0x10 /* GCI - Timeout */
  95. #define CR_RST 0x80 /* software reset command */
  96. /* GIMR - Global Interrupt Mode Registers */
  97. #define GIMR_VEC_MASK  0x00e0 /* vector bits 7 - 5 */
  98. #define GIMR_EDGE1  0x0100 /* IRQ1 edge triggered (else level) */
  99. #define GIMR_EDGE6  0x0200 /* IRQ6 edge triggered (else level) */
  100. #define GIMR_EDGE7  0x0400 /* IRQ7 edge triggered (else level) */
  101. #define GIMR_EXT_VEC1  0x1000 /* level 1 vector external */
  102. #define GIMR_EXT_VEC6  0x2000 /* level 6 vector external */
  103. #define GIMR_EXT_VEC7  0x4000 /* level 7 vector external */
  104. #define GIMR_DISCRETE  0x8000 /* IPL0-IPL2 are IRQ1/IRQ6/IRQ7 */
  105. /* IPR/IMR/ISR - Interrupt Pending/Mask/In-Service Registers */
  106. #define INT_ERR 0x0001 /* response to ext. level 4 */
  107. #define INT_PB8 0x0002 /* parrallel port B (bit 8) */
  108. #define INT_SMC2  0x0004 /* serial management controller 2 */
  109. #define INT_SMC1  0x0008 /* serial management controller 1 */
  110. #define INT_TMR3  0x0010 /* timer 3 */
  111. #define INT_SCP  0x0020 /* serial comunication port */
  112. #define INT_TMR2  0x0040 /* timer 2 */
  113. #define INT_PB9  0x0080 /* parrallel port B (bit 9) */
  114. #define INT_SCC3  0x0100 /* serial comunication controller 3 */
  115. #define INT_TMR1  0x0200 /* timer 1 */
  116. #define INT_SCC2  0x0400 /* serial comunication controller 2 */
  117. #define INT_IDMA  0x0800 /* independent direct memory access */
  118. #define INT_SDMA  0x1000 /* serial direct memory access */
  119. #define INT_SCC1  0x2000 /* serial comunication controller 1 */
  120. #define INT_PB10  0x4000 /* parrallel port B (bit 10) */
  121. #define INT_PB11  0x8000 /* parrallel port B (bit 11) */
  122. /* Interrupt Vectors */
  123. #define INT_VEC_ERR (0x0 | (*IMP_GIMR & GIMR_VEC_MASK))
  124. #define INT_VEC_PB8 (0x1 | (*IMP_GIMR & GIMR_VEC_MASK))
  125. #define INT_VEC_SMC2 (0x2 | (*IMP_GIMR & GIMR_VEC_MASK))
  126. #define INT_VEC_SMC1 (0x3 | (*IMP_GIMR & GIMR_VEC_MASK))
  127. #define INT_VEC_TMR3 (0x4 | (*IMP_GIMR & GIMR_VEC_MASK))
  128. #define INT_VEC_SCP (0x5 | (*IMP_GIMR & GIMR_VEC_MASK))
  129. #define INT_VEC_TMR2 (0x6 | (*IMP_GIMR & GIMR_VEC_MASK))
  130. #define INT_VEC_PB9 (0x7 | (*IMP_GIMR & GIMR_VEC_MASK))
  131. #define INT_VEC_SCC3 (0x8 | (*IMP_GIMR & GIMR_VEC_MASK))
  132. #define INT_VEC_TMR1 (0x9 | (*IMP_GIMR & GIMR_VEC_MASK))
  133. #define INT_VEC_SCC2 (0xa | (*IMP_GIMR & GIMR_VEC_MASK))
  134. #define INT_VEC_IDMA (0xb | (*IMP_GIMR & GIMR_VEC_MASK))
  135. #define INT_VEC_SDMA (0xc | (*IMP_GIMR & GIMR_VEC_MASK))
  136. #define INT_VEC_SCC1 (0xd | (*IMP_GIMR & GIMR_VEC_MASK))
  137. #define INT_VEC_PB10 (0xe | (*IMP_GIMR & GIMR_VEC_MASK))
  138. #define INT_VEC_PB11 (0xf | (*IMP_GIMR & GIMR_VEC_MASK))
  139. /* TMR1/TMR2 - Timer Mode Register */
  140. #define TMR_ENABLE  0x0001 /* enable timer */
  141. #define TMR_STOP 0x0000 /* stop count */
  142. #define TMR_CLK 0x0002 /* count source is master clock */
  143. #define TMR_CLK16 0x0004 /* count source is master clock/16 */
  144. #define TMR_CLK_EXT 0x0006 /* count source is falling edge TIN */
  145. #define TMR_RESTART 0x0008 /* count is restarted upon ref cnt */
  146. #define TMR_INT 0x0010 /* enable interrupt upon ref cnt */
  147. #define TMR_TOGGLE 0x0020 /* toggle output */
  148. #define TMR_CAP_DIS 0x0000 /* disable interrupt on capture event */
  149. #define TMR_CAP_RISE 0x0040 /* enable int w/ capture rising edge */
  150. #define TMR_CAP_FALL 0x0080 /* enable int w/ capture falling edge */
  151. #define TMR_CAP_ANY 0x00c0 /* enable int w/ capture any edge */
  152. /* TER1/TER2 - Timer Event Register */
  153. #define TER_CAPTURE  0x01 /* counter value has been captured */
  154. #define TER_REF_CNT 0x02 /* counter value reached ref. cnt */
  155. /* CS_BR - Chip Select Base Register */
  156. #define CS_BR_ENABLE 0x0001 /* chip select pin is enabled */
  157. #define CS_BR_WRITE 0x0002 /* chip select pin write only */
  158. /* CS_OR - Chip Select Options Register */
  159. #define CS_OR_CFC 0x0001 /* function code of CS_BR compared */
  160. #define CS_OR_UNMASK_RW 0x0002 /* r/w bit of CS_BR is not masked */
  161. /* SCR - System Control Register */
  162. #define SCR_LPEN  0x00000020 /* low power mode enabled */
  163. #define SCR_LPP16  0x00000040 /* low power clock/16 prescale enable */
  164. #define SCR_LPREC  0x00000080 /* destructive low power recovery */
  165. #define SCR_HWDEN  0x00000800 /* hardware watchdog enable */
  166. #define SCR_SAM  0x00001000 /* synchronous access mode */
  167. #define SCR_FRZ1  0x00002000 /* freeze timer 1 */
  168. #define SCR_FRZ2  0x00004000 /* freeze timer 2 */
  169. #define SCR_FRZW  0x00008000 /* freeze watchdog timer */
  170. #define SCR_BCLM  0x00010000 /* BCLR derived from IPEND */
  171. #define SCR_ADCE  0x00020000 /* BERR on address decode conflict */
  172. #define SCR_EMWS  0x00040000 /* external master wait state */
  173. #define SCR_RMCST  0x00080000 /* RMC cycle special treatment */
  174. #define SCR_WPVE  0x00100000 /* BERR on write protect violation */
  175. #define SCR_VGE  0x00200000 /* vector generation enable (discpu) */
  176. #define SCR_ERRE  0x00400000 /* external RISC request enable */
  177. #define SCR_ADC  0x01000000 /* address decode conflict */
  178. #define SCR_WPV  0x02000000 /* write protect violation */
  179. #define SCR_HWT  0x04000000 /* hardware watchdog timeout */
  180. #define SCR_IPA  0x08000000 /* interrupt priority active */
  181. /* SCC - Serial Comunications Controller */
  182. typedef volatile struct /* SCC_BUF */
  183.     {
  184.     UINT16 statusMode; /* status/mode protocal specific */
  185.     UINT16 dataLength; /* length of buffer in bytes */
  186.     char * dataPointer; /* points to data buffer */
  187.     } SCC_BUF;
  188. typedef struct /* SCC_PARAM */
  189.     {
  190.     UINT8 rfcr; /* receive function code */
  191.     UINT8 tfcr; /* transmit function code */
  192.     UINT16 mrblr; /* maximum receive buffer length */
  193.     UINT16 res1; /* reserved/internal */
  194.     UINT8 res2; /* reserved/internal */
  195.     UINT8 rbd; /* receive internal buffer number */
  196.     UINT16 res3[5]; /* reserved/internal */
  197.     UINT8 res4; /* reserved/internal */
  198.     UINT8 tbd; /* transmit internal buffer number */
  199.     UINT16 res5[4]; /* reserved/internal */
  200.     } SCC_PARAM;
  201. typedef struct /* SCC */
  202.     {
  203.     SCC_BUF rxBd[8]; /* receive buffer descriptors */
  204.     SCC_BUF txBd[8]; /* transmit buffer descriptors */
  205.     SCC_PARAM param; /* SCC parameters */
  206.     char prot[64]; /* protocol specific area */
  207.     } SCC;
  208. typedef struct /* SCC3 */
  209.     {
  210.     SCC_BUF rxBd[8]; /* receive buffer descriptors */
  211.     SCC_BUF txBd[4]; /* transmit buffer descriptors */
  212.     UINT16 res1[3]; /* reserved/internal */
  213.     UINT16 smc1RxBd; /* SMC1 receive buffer descriptor */
  214.     UINT16 smc1TxBd; /* SMC1 transmit buffer descriptor */
  215.     UINT16 smc2RxBd; /* SMC2 receive buffer descriptor */
  216.     UINT16 smc2TxBd; /* SMC2 transmit buffer descriptor */
  217.     UINT16 res2[6]; /* reserved/internal */
  218.     UINT16 scpBd; /* SCP buffer descriptor */
  219.     UINT16 sccBerr; /* SCC channel bus error status */
  220.     UINT16 rev; /* MC68302 revision number */
  221.     SCC_PARAM param; /* SCC parameters */
  222.     char prot[64]; /* protocol specific area */
  223.     } SCC3;
  224. typedef volatile struct /* SCC_REG */
  225.     {
  226.     UINT16 res1; /* reserved/internal */
  227.     UINT16 scon; /* configuration register */
  228.     UINT16 scm; /* mode register */
  229.     UINT16 dsr; /* data sync. register */
  230.     UINT8 scce; /* event register */
  231.     UINT8 res2; /* reserved/internal */
  232.     UINT8 sccm; /* mask register */
  233.     UINT8 res3; /* reserved/internal */
  234.     UINT8 sccs; /* status register */
  235.     UINT8 res4; /* reserved/internal */
  236.     UINT16 res5; /* reserved/internal */
  237.     } SCC_REG;
  238. /* SCC Configuration Register */
  239. #define SCON_DIV4 0x0001 /* SCC clock prescaler divide by 4 */
  240. #define SCON_EXT_RX_CLK 0x1000 /* RCLK pin is rx baud rate source */
  241. #define SCON_EXT_TX_CLK 0x2000 /* RCLK pin is tx baud rate source */
  242. #define SCON_EXT_BAUD 0x4000 /* TIN1 pin is baud rate clk source */
  243. #define SCON_WIRED_OR 0x8000 /* TXD pin is placed in open drain */
  244. /* UART Protocol - SCC protocol specific parameters */
  245. typedef volatile struct /* PROT_UART */
  246.     {
  247.     UINT16 maxIdl; /* maximum idle characters */
  248.     UINT16 idlc; /* temporary receive idle counter */
  249.     UINT16 brkcr; /* break count register */
  250.     UINT16 parec; /* receive parity error counter */
  251.     UINT16 frmec; /* receive framing error counter */
  252.     UINT16 nosec; /* receive noise counter */
  253.     UINT16 brkec; /* receive break character counter */
  254.     UINT16 uaddr1; /* uart address character 1 */
  255.     UINT16 uaddr2; /* uart address character 2 */
  256.     UINT16 rccr; /* receive control character register */
  257.     UINT16 cntChar1; /* control character 1 */
  258.     UINT16 cntChar2; /* control character 2 */
  259.     UINT16 cntChar3; /* control character 3 */
  260.     UINT16 cntChar4; /* control character 4 */
  261.     UINT16 cntChar5; /* control character 5 */
  262.     UINT16 cntChar6; /* control character 6 */
  263.     UINT16 cntChar7; /* control character 7 */
  264.     UINT16 cntChar8; /* control character 8 */
  265.     } PROT_UART;
  266. /* UART Protocol - SCC Mode Register */
  267. #define UART_SCM_HDLC 0x0000 /* hdlc mode */
  268. #define UART_SCM_ASYNC 0x0001 /* asynchronous mode (uart/ddcmp) */
  269. #define UART_SCM_SYNC 0x0002 /* synchronous mode (ddcmp/v.110) */
  270. #define UART_SCM_BISYNC 0x0003 /* bisync/promiscuous mode */
  271. #define UART_SCM_ENT 0x0004 /* enable transmitter */
  272. #define UART_SCM_ENR 0x0008 /* enable receiver */
  273. #define UART_SCM_LOOPBACK 0x0010 /* transmitter hooked to receiver */
  274. #define UART_SCM_ECHO 0x0020 /* transmitter echoes received chars */
  275. #define UART_SCM_MANUAL 0x0030 /* cts/cd under software control */
  276. #define UART_SCM_STOP_2 0x0040 /* two stop bits (one otherwise) */
  277. #define UART_SCM_RTSM 0x0080 /* 0:rts w/ tx char; 1:rts w/ tx enbl */
  278. #define UART_SCM_8BIT 0x0100 /* 8 bit char. length (7 otherwise) */
  279. #define UART_SCM_FRZ_TX 0x0200 /* freeze transmitter */
  280. #define UART_SCM_DROP1 0x0400 /* multidrop w/o adrs. recognition */
  281. #define UART_SCM_DDCMP 0x0800 /* ddcmp protocol selected */
  282. #define UART_SCM_DROP2 0x0c00 /* multidrop w adrs. recognition */
  283. #define UART_SCM_PARITY 0x1000 /* parity is enabled */
  284. #define UART_SCM_RX_EVEN 0x2000 /* rx even parity */
  285. #define UART_SCM_TX_ODD 0x0000 /* tx odd parity */
  286. #define UART_SCM_TX_SPACE 0x4000 /* tx space parity */
  287. #define UART_SCM_TX_EVEN 0x8000 /* tx even parity */
  288. #define UART_SCM_TX_MARK 0xc000 /* tx mark parity */
  289. /* UART Protocol - SCC Event Register */
  290. #define UART_SCCE_RX  0x01 /* buffer received */
  291. #define UART_SCCE_TX  0x02 /* buffer transmitted */
  292. #define UART_SCCE_BSY  0x04 /* character discarded, no buffers */
  293. #define UART_SCCE_CCR  0x08 /* control character received */
  294. #define UART_SCCE_BRK  0x10 /* break character received */
  295. #define UART_SCCE_IDL  0x20 /* idle sequence status changed */
  296. #define UART_SCCE_CD   0x40 /* carrier detect status changed */
  297. #define UART_SCCE_CTS  0x80 /* clear to send status changed */
  298. /* UART Protocol - Receive Buffer Descriptor */
  299. #define UART_RX_BD_CD 0x0001 /* carrier detect loss during rx */
  300. #define UART_RX_BD_OV 0x0002 /* receiver overrun */
  301. #define UART_RX_BD_PR 0x0008 /* parity error */
  302. #define UART_RX_BD_FR 0x0010 /* framing error */
  303. #define UART_RX_BD_BR 0x0020 /* break received */
  304. #define UART_RX_BD_ID 0x0100 /* buf closed on reception of IDLES */
  305. #define UART_RX_BD_UADDR1 0x0200 /* matched UADDR1 (UADDR2 otherwise) */
  306. #define UART_RX_BD_ADDR 0x0400 /* buffer contained address */
  307. #define UART_RX_BD_CNT 0x0800 /* control character in last byte */
  308. #define UART_RX_BD_INT 0x1000 /* interrupt will be generated */
  309. #define UART_RX_BD_WRAP 0x2000 /* wrap back to first BD */
  310. #define UART_RX_BD_EXT 0x4000 /* buffer in external memory */
  311. #define UART_RX_BD_EMPTY 0x8000 /* buffer is empty (available to CP) */
  312. /* UART Protocol - Transmit Buffer Descriptor */
  313. #define UART_TX_BD_CT 0x0001 /* cts was lost during tx */
  314. #define UART_TX_BD_PREAMBLE 0x0200 /* enable preamble */
  315. #define UART_TX_BD_ADDR 0x0400 /* buffer contained address char */
  316. #define UART_TX_BD_CTSR 0x0800 /* normal cts error reporting */
  317. #define UART_TX_BD_INT 0x1000 /* interrupt will be generated */
  318. #define UART_TX_BD_WRAP 0x2000 /* wrap back to first BD */
  319. #define UART_TX_BD_EXT 0x4000 /* buffer in external memory */
  320. #define UART_TX_BD_READY 0x8000 /* buffer is being sent (don't touch) */
  321. /* HDLC Protocol - SCC protocol specific parameters */
  322. typedef struct /* PROT_HDLC */
  323.     {
  324.     UINT16 rcrcLow; /* temporary receive crc low */
  325.     UINT16 rcrcHigh; /* temporary receive crc high */
  326.     UINT16 cMaskLow; /* constant (0xf0b8:16b; 0xdebb:32b) */
  327.     UINT16 cMaskHigh; /* constant (0xf0b8:16b; 0x20e3:32b) */
  328.     UINT16 tCrcLow; /* temporary transmit crc low */
  329.     UINT16 tCrcHigh; /* temporary transmit crc high */
  330.     UINT16 disfc; /* discard frame counter */
  331.     UINT16 crcec; /* crc error counter */
  332.     UINT16 abtsc; /* abort sequence counter */
  333.     UINT16 nmarc; /* nonmatching adrs received counter */
  334.     UINT16 retrc; /* frame retransmission counter */
  335.     UINT16 mflr; /* max frame length register */
  336.     UINT16 maxCnt; /* max length counter */
  337.     UINT16 hmask; /* user-defined frame address mask */
  338.     UINT16 haddr1; /* user-defined frame address */
  339.     UINT16 haddr2; /* user-defined frame address */
  340.     UINT16 haddr3; /* user-defined frame address */
  341.     UINT16 haddr4; /* user-defined frame address */
  342.     } PROT_HDLC;
  343. /* HDLC Protocol - SCC Mode Register */
  344. #define HDLC_SCM_HDLC 0x0000 /* hdlc mode */
  345. #define HDLC_SCM_ASYNC 0x0001 /* asynchronous mode (uart/ddcmp) */
  346. #define HDLC_SCM_SYNC 0x0002 /* synchronous mode (ddcmp/v.110) */
  347. #define HDLC_SCM_BISYNC 0x0003 /* bisync/promiscuous mode */
  348. #define HDLC_SCM_ENT 0x0004 /* enable transmitter */
  349. #define HDLC_SCM_ENR 0x0008 /* enable receiver */
  350. #define HDLC_SCM_LOOPBACK 0x0010 /* transmitter hooked to receiver */
  351. #define HDLC_SCM_ECHO 0x0020 /* transmitter echoes received chars */
  352. #define HDLC_SCM_MANUAL 0x0030 /* cts/cd under software control */
  353. #define HDLC_SCM_NRZI 0x0040 /* nrzi tx encoding (nrz otherwise) */
  354. #define HDLC_SCM_FLG 0x0080 /* send flags between frames */
  355. #define HDLC_SCM_RTE 0x0100 /* retransmit enable */
  356. #define HDLC_SCM_FSE 0x0400 /* flag sharing enable */
  357. #define HDLC_SCM_C32 0x0800 /* 32 bit CCITT crc */
  358. /* HDLC Protocol - SCC Event Register */
  359. #define HDLC_SCCE_RXB  0x01 /* incomplete buffer received */
  360. #define HDLC_SCCE_TXB  0x02 /* buffer transmitted */
  361. #define HDLC_SCCE_BSY  0x04 /* frame discarded, no buffers */
  362. #define HDLC_SCCE_RXF  0x08 /* complete frame received */
  363. #define HDLC_SCCE_TXE  0x10 /* transmitter error */
  364. #define HDLC_SCCE_IDL  0x20 /* idle sequence status changed */
  365. #define HDLC_SCCE_CD   0x40 /* carrier detect status changed */
  366. #define HDLC_SCCE_CTS  0x80 /* clear to send status changed */
  367. /* HDLC Protocol - Receive Buffer Descriptor */
  368. #define HDLC_RX_BD_CD 0x0001 /* carrier detect loss during rx */
  369. #define HDLC_RX_BD_OV 0x0002 /* receiver overrun */
  370. #define HDLC_RX_BD_CRC 0x0004 /* crc error */
  371. #define HDLC_RX_BD_ABORT 0x0008 /* abort sequence */
  372. #define HDLC_RX_BD_NO 0x0010 /* non-octet frame received */
  373. #define HDLC_RX_BD_LG 0x0020 /* rx frame length violation */
  374. #define HDLC_RX_BD_FIRST 0x0400 /* buffer first in frame */
  375. #define HDLC_RX_BD_LAST 0x0800 /* buffer last in frame */
  376. #define HDLC_RX_BD_INT 0x1000 /* interrupt will be generated */
  377. #define HDLC_RX_BD_WRAP 0x2000 /* wrap back to first BD */
  378. #define HDLC_RX_BD_EXT 0x4000 /* buffer in external memory */
  379. #define HDLC_RX_BD_EMPTY 0x8000 /* buffer is empty (available to CP) */
  380. /* HDLC Protocol - Transmit Buffer Descriptor */
  381. #define HDLC_TX_BD_CT 0x0001 /* cts was lost during tx */
  382. #define HDLC_TX_BD_UN 0x0002 /* underrun during tx */
  383. #define HDLC_TX_BD_CRC 0x0400 /* transmit crc after last byte */
  384. #define HDLC_TX_BD_LAST 0x0800 /* last buffer in current frame */
  385. #define HDLC_TX_BD_INT 0x1000 /* interrupt will be generated */
  386. #define HDLC_TX_BD_WRAP 0x2000 /* wrap back to first BD */
  387. #define HDLC_TX_BD_EXT 0x4000 /* buffer in external memory */
  388. #define HDLC_TX_BD_READY 0x8000 /* buffer is being sent (don't touch) */
  389. /* BISYNC Protocol - SCC protocol specific parameters */
  390. typedef struct /* PROT_BISYNC */
  391.     {
  392.     UINT16 rcrc; /* temporary receive crc */
  393.     UINT16 crcc; /* crc constant */
  394.     UINT16 prcrc; /* preset receiver crc16/lrc */
  395.     UINT16 tcrc; /* temporary transmit crc */
  396.     UINT16 ptcrc; /* preset transmit crc16/lrc */
  397.     UINT16 res1; /* reserved */
  398.     UINT16 res2; /* reserved */
  399.     UINT16 parec; /* receive parity error counter */
  400.     UINT16 bsync; /* bisync sync character */
  401.     UINT16 bdle; /* bisync dle character */
  402.     UINT16 cntChar1; /* control character 1 */
  403.     UINT16 cntChar2; /* control character 2 */
  404.     UINT16 cntChar3; /* control character 3 */
  405.     UINT16 cntChar4; /* control character 4 */
  406.     UINT16 cntChar5; /* control character 5 */
  407.     UINT16 cntChar6; /* control character 6 */
  408.     UINT16 cntChar7; /* control character 7 */
  409.     UINT16 cntChar8; /* control character 8 */
  410.     } PROT_BISYNC;
  411. /* BISYNC Protocol - SCC Mode Register */
  412. #define BISYNC_SCM_HDLC 0x0000 /* hdlc mode */
  413. #define BISYNC_SCM_ASYNC 0x0001 /* asynchronous mode (uart/ddcmp) */
  414. #define BISYNC_SCM_SYNC 0x0002 /* synchronous mode (ddcmp/v.110) */
  415. #define BISYNC_SCM_BISYNC 0x0003 /* bisync/promiscuous mode */
  416. #define BISYNC_SCM_ENT 0x0004 /* enable transmitter */
  417. #define BISYNC_SCM_ENR 0x0008 /* enable receiver */
  418. #define BISYNC_SCM_LOOPBACK 0x0010 /* transmitter hooked to receiver */
  419. #define BISYNC_SCM_ECHO 0x0020 /* transmitter echoes received chars */
  420. #define BISYNC_SCM_MANUAL 0x0030 /* cts/cd under software control */
  421. #define BISYNC_SCM_NRZI 0x0040 /* nrzi tx encoding (nrz otherwise) */
  422. #define BISYNC_SCM_SYNF 0x0080 /* send SYN1-SYN2 pairs between msgs */
  423. #define BISYNC_SCM_RBCS 0x0100 /* enable receive BCS */
  424. #define BISYNC_SCM_RTR 0x0200 /* enable receiver transparent mode */
  425. #define BISYNC_SCM_BCS 0x0800 /* CRC16 (LRC otherwise) */
  426. #define BISYNC_SCM_REVD 0x1000 /* reverse data (msb first) */
  427. #define BISYNC_SCM_NTSYN 0x2000 /* no transmit sync */
  428. #define BISYNC_SCM_EXSYN 0x4000 /* external sync mode */
  429. #define BISYNC_SCM_EVEN 0x8000 /* even parity */
  430. /* BISYNC Protocol - SCC Event Register */
  431. #define BISYNC_SCCE_RX 0x01 /* buffer received */
  432. #define BISYNC_SCCE_TX 0x02 /* buffer transmitted */
  433. #define BISYNC_SCCE_BSY 0x04 /* character discarded, no buffers */
  434. #define BISYNC_SCCE_RCH 0x08 /* character received, put in buffer */
  435. #define BISYNC_SCCE_TXE 0x10 /* transmitter error */
  436. #define BISYNC_SCCE_CD  0x40 /* carrier detect status changed */
  437. #define BISYNC_SCCE_CTS 0x80 /* clear to send status changed */
  438. /* BISYNC Protocol - Receive Buffer Descriptor */
  439. #define BISYNC_RX_BD_CD 0x0001 /* carrier detect loss during rx */
  440. #define BISYNC_RX_BD_OV 0x0002 /* receiver overrun */
  441. #define BISYNC_RX_BD_BCS_ERR 0x0004 /* bcs error */
  442. #define BISYNC_TX_BD_PARITY 0x0008 /* parity error */
  443. #define BISYNC_RX_BD_DLE 0x0010 /* DLE follow character error */
  444. #define BISYNC_RX_BD_BCS 0x0400 /* BCS received */
  445. #define BISYNC_RX_BD_CNT 0x0800 /* last byte is control character */
  446. #define BISYNC_RX_BD_INT 0x1000 /* interrupt will be generated */
  447. #define BISYNC_RX_BD_WRAP 0x2000 /* wrap back to first BD */
  448. #define BISYNC_RX_BD_EXT 0x4000 /* buffer in external memory */
  449. #define BISYNC_RX_BD_EMPTY 0x8000 /* buffer is empty (available to CP) */
  450. /* BISYNC Protocol - Transmit Buffer Descriptor */
  451. #define BISYNC_TX_BD_CT 0x0001 /* cts was lost during tx */
  452. #define BISYNC_TX_BD_UN 0x0002 /* underrun during tx */
  453. #define BISYNC_TX_BD_TR 0x0040 /* transparent mode */
  454. #define BISYNC_TX_BD_TX_DLE  0x0080 /* transmit DLE character */
  455. #define BISYNC_TX_BD_BR  0x0100 /* reset BCS accumulation */
  456. #define BISYNC_TX_BD_BCS 0x0200 /* include buffer in BCS accumulation */
  457. #define BISYNC_TX_BD_BCS_TX 0x0400 /* transmit BCS after last byte */
  458. #define BISYNC_TX_BD_LAST 0x0800 /* last buffer in current frame */
  459. #define BISYNC_TX_BD_INT 0x1000 /* interrupt will be generated */
  460. #define BISYNC_TX_BD_WRAP 0x2000 /* wrap back to first BD */
  461. #define BISYNC_TX_BD_EXT 0x4000 /* buffer in external memory */
  462. #define BISYNC_TX_BD_READY 0x8000 /* buffer is being sent (don't touch) */
  463. /* DDCMP Protocol - SCC protocol specific parameters */
  464. typedef struct /* PROT_DDCMP */
  465.     {
  466.     UINT16 rcrc; /* temporary receive crc */
  467.     UINT16 crcc; /* crc constant */
  468.     UINT16 pcrc; /* preset receiver crc16 */
  469.     UINT16 tcrc; /* temporary transmit crc */
  470.     UINT16 dsoh; /* ddcmp soh character */
  471.     UINT16 denq; /* ddcmp enq character */
  472.     UINT16 ddle; /* ddcmp dle character */
  473.     UINT16 crc1ec; /* crc1 error counter */
  474.     UINT16 crc2ec; /* crc2 error counter */
  475.     UINT16 nmarc; /* nonmatching adrs received counter */
  476.     UINT16 dismc; /* discard message counter */
  477.     UINT16 rmlg; /* received message length */
  478.     UINT16 rmlgCnt; /* received message length counter */
  479.     UINT16 dmask; /* user-defined frame address mask */
  480.     UINT16 daddr1; /* user-defined frame address */
  481.     UINT16 daddr2; /* user-defined frame address */
  482.     UINT16 daddr3; /* user-defined frame address */
  483.     UINT16 daddr4; /* user-defined frame address */
  484.     } PROT_DDCMP;
  485. /* DDCMP Protocol - SCC Mode Register */
  486. #define DDCMP_SCM_HDLC 0x0000 /* hdlc mode */
  487. #define DDCMP_SCM_ASYNC 0x0001 /* asynchronous mode (uart/ddcmp) */
  488. #define DDCMP_SCM_SYNC 0x0002 /* synchronous mode (ddcmp/v.110) */
  489. #define DDCMP_SCM_BISYNC 0x0003 /* bisync/promiscuous mode */
  490. #define DDCMP_SCM_ENT 0x0004 /* enable transmitter */
  491. #define DDCMP_SCM_ENR 0x0008 /* enable receiver */
  492. #define DDCMP_SCM_LOOPBACK 0x0010 /* transmitter hooked to receiver */
  493. #define DDCMP_SCM_ECHO 0x0020 /* transmitter echoes received chars */
  494. #define DDCMP_SCM_MANUAL 0x0030 /* cts/cd under software control */
  495. #define DDCMP_SCM_NRZI 0x0040 /* nrzi tx encoding (nrz otherwise) */
  496. #define DDCMP_SCM_SYNF 0x0080 /* send SYN1-SYN2 pairs between msgs */
  497. #define DDCMP_SCM_V110 0x0400 /* V.110 protocol selected */
  498. /* DDCMP Protocol - SCC Event Register */
  499. #define DDCMP_SCCE_RBD  0x01 /* incomplete buffer received */
  500. #define DDCMP_SCCE_TX  0x02 /* buffer transmitted */
  501. #define DDCMP_SCCE_BSY  0x04 /* data byte discarded, no buffers */
  502. #define DDCMP_SCCE_RBK  0x08 /* complete block received */
  503. #define DDCMP_SCCE_TXE  0x10 /* transmitter error */
  504. #define DDCMP_SCCE_CD   0x40 /* carrier detect status changed */
  505. #define DDCMP_SCCE_CTS  0x80 /* clear to send status changed */
  506. /* DDCMP Protocol - Receive Buffer Descriptor */
  507. #define DDCMP_RX_BD_CD 0x0001 /* carrier detect loss during rx */
  508. #define DDCMP_RX_BD_OV 0x0002 /* receiver overrun */
  509. #define DDCMP_RX_BD_CRC_ERR 0x0004 /* crc error */
  510. #define DDCMP_TX_BD_PARITY 0x0008 /* parity error */
  511. #define DDCMP_RX_BD_FR 0x0010 /* framing error */
  512. #define DDCMP_RX_BD_CF 0x0020 /* crc follow error */
  513. #define DDCMP_RX_BD_DATA 0x0000 /* data message */
  514. #define DDCMP_RX_BD_CNT 0x0100 /* control message */
  515. #define DDCMP_RX_BD_MAINT 0x0200 /* maintenance message */
  516. #define DDCMP_RX_BD_HEADER 0x0400 /* buffer contains header */
  517. #define DDCMP_RX_BD_LAST 0x0800 /* last byte is control character */
  518. #define DDCMP_TX_BD_INT 0x1000 /* interrupt will be generated */
  519. #define DDCMP_RX_BD_WRAP 0x2000 /* wrap back to first BD */
  520. #define DDCMP_RX_BD_EXT 0x4000 /* buffer in external memory */
  521. #define DDCMP_RX_BD_EMPTY 0x8000 /* buffer is empty (available to CP) */
  522. /* DDCMP Protocol - Transmit Buffer Descriptor */
  523. #define DDCMP_TX_BD_CT 0x0001 /* cts was lost during tx */
  524. #define DDCMP_TX_BD_UN 0x0002 /* underrun during tx */
  525. #define DDCMP_TX_BD_OPTLAST 0x0200 /* optional last */
  526. #define DDCMP_TX_BD_TX_CRC 0x0400 /* transmit crc16 after last byte */
  527. #define DDCMP_TX_BD_LAST 0x0800 /* last buffer in current frame */
  528. #define DDCMP_TX_BD_INT 0x1000 /* interrupt will be generated */
  529. #define DDCMP_TX_BD_WRAP 0x2000 /* wrap back to first BD */
  530. #define DDCMP_TX_BD_EXT 0x4000 /* buffer in external memory */
  531. #define DDCMP_TX_BD_READY 0x8000 /* buffer is being sent (don't touch) */
  532. /* V.110 Protocol - SCC protocol specific parameters */
  533. /* V.110 Protocol - SCC Event Register */
  534. #define V110_SCCE_TX  0x02 /* buffer transmitted */
  535. #define V110_SCCE_BSY  0x04 /* data byte discarded, no buffers */
  536. #define V110_SCCE_RXF  0x08 /* complete frame received */
  537. #define V110_SCCE_TXE  0x10 /* transmitter error */
  538. /* V110 Protocol - Receive Buffer Descriptor */
  539. #define V110_RX_BD_OV 0x0002 /* receiver overrun */
  540. #define V110_RX_BD_SYNC_ERR 0x0008 /* synchronization error */
  541. #define V110_RX_BD_WRAP 0x2000 /* wrap back to first BD */
  542. #define V110_RX_BD_EXT 0x4000 /* buffer in external memory */
  543. #define V110_RX_BD_EMPTY 0x8000 /* buffer is empty (available to CP) */
  544. /* V110 Protocol - Transmit Buffer Descriptor */
  545. #define V110_TX_BD_UN 0x0002 /* underrun during tx */
  546. #define V110_TX_BD_TR 0x0040 /* transparent mode */
  547. #define V110_TX_BD_LAST 0x0800 /* last buffer in current frame */
  548. #define V110_TX_BD_INT 0x1000 /* interrupt will be generated */
  549. #define V110_TX_BD_WRAP 0x2000 /* wrap back to first BD */
  550. #define V110_TX_BD_EXT 0x4000 /* buffer in external memory */
  551. #define V110_TX_BD_READY 0x8000 /* buffer is being sent (don't touch) */
  552. #ifndef INCLUDE_TY_CO_DRV_50
  553. typedef struct          /* TY_CO_DEV */
  554.     {
  555.     TY_DEV tyDev;     /* tyLib will handle this portion */
  556.     BOOL created;    /* true if this device has been created */
  557.     char       numChannels; /* number of channels to support */
  558.     int       clockRate;  /* CPU clock frequency (Hz) */
  559.     SCC * pScc;     /* serial communication cntrlr */
  560.     SCC_REG * pSccReg;    /* serial communication cntrlr registers */
  561.     int        rxBdNext;   /* next rcv buffer descriptor to fill */
  562.     UINT16     intAck;     /* interrupt acknowledge mask */
  563.     } TY_CO_DEV;
  564. /* function declarations */
  565. #if defined(__STDC__) || defined(__cplusplus)
  566. IMPORT void tyCoInt (TY_CO_DEV * pDv);
  567. #else /* __STDC__ */
  568. IMPORT void tyCoInt ();
  569. #endif /* __STDC__ */
  570. #endif /* INCLUDE_TY_CO_DRV_50 */
  571. #endif /* _ASMLANGUAGE */
  572. #ifdef __cplusplus
  573. }
  574. #endif
  575. #endif /* __INCm68302h */