source: rtems/c/src/lib/libbsp/m68k/idp/include/motorola/mc68681.h @ 5bc6237

4.115
Last change on this file since 5bc6237 was 5bc6237, checked in by Joel Sherrill <joel.sherrill@…>, on 03/09/15 at 20:47:47

Move libcsupport/include/motorola/*.h to m68k/idp BSP

These header files were only used by one BSP and they are
hardware dependent. The hardware dependency always made
them bad candidates for where they were in the tree. But
this fixes that.

  • Property mode set to 100644
File size: 13.1 KB
RevLine 
[4d3017a]1/**
2 * @file rtems/motorola/mc68681.h
3 *
4 *
[28a4b1d]5 * mc68681-duart.h -- Low level support code for the Motorola mc68681
[0789abef]6 *                   DUART.
[4d3017a]7 */
8
9/*
[0789abef]10 *
11 *  Originally written by rob@cygnus.com (Rob Savoye) for the libgloss
12 *    IDP support.
[28a4b1d]13 */
14
[7945944]15#ifndef _RTEMS_MOTOROLA_MC68681_H
16#define _RTEMS_MOTOROLA_MC68681_H
[28a4b1d]17
18/*
[0789abef]19 *  In the dark ages when this controller was designed, it was actually
20 *  possible to access data on unaligned byte boundaries with no penalty.
21 *  Now we find this chip in configurations in which the registers are
22 *  at 16-bit, 32-bit, and 64-bit boundaries at the whim of the board
23 *  designer.  If the registers are not at byte addresses, then
24 *  set this multiplier before including this file to correct the offsets.
25 */
26
27#ifndef MC68681_OFFSET_MULTIPLIER
28#define MC68681_OFFSET_MULTIPLIER 1
[28a4b1d]29#endif
30
[0789abef]31#define __MC68681_REG(_R) ((_R) * MC68681_OFFSET_MULTIPLIER)
32
33/*
34 * mc68681 register offsets Read/Write Addresses
35 */
36#define MC68681_MODE_REG_1A  __MC68681_REG(0)  /* MR1A-MR Prior to Read */
37#define MC68681_MODE_REG_2A  __MC68681_REG(0)  /* MR2A-MR After Read    */
38
39#define MC68681_COUNT_MODE_CURRENT_MSB       __MC68681_REG(6)  /* CTU   */
40#define MC68681_COUNTER_TIMER_UPPER_REG      __MC68681_REG(6)  /* CTU   */
41#define MC68681_COUNT_MODE_CURRENT_LSB       __MC68681_REG(7)  /* CTL   */
42#define MC68681_COUNTER_TIMER_LOWER_REG      __MC68681_REG(7)  /* CTL   */
43#define MC68681_INTERRUPT_VECTOR_REG         __MC68681_REG(12) /* IVR   */
44
45#define MC68681_MODE_REG_1B  __MC68681_REG(8)  /* MR1B-MR Prior to Read */
46#define MC68681_MODE_REG_2B  __MC68681_REG(8)  /* MR2BA-MR After Read   */
47
48/*
49 * mc68681 register offsets Read Only  Addresses
50 */
51#define MC68681_STATUS_REG_A                __MC68681_REG(1)   /* SRA   */
52#define MC68681_MASK_ISR_REG                __MC68681_REG(2)   /* MISR  */
53#define MC68681_RECEIVE_BUFFER_A            __MC68681_REG(3)   /* RHRA  */
54#define MC68681_INPUT_PORT_CHANGE_REG       __MC68681_REG(4)   /* IPCR  */
55#define MC68681_INTERRUPT_STATUS_REG        __MC68681_REG(5)   /* ISR   */
56#define MC68681_STATUS_REG_B                __MC68681_REG(9)   /* SRB   */
57#define MC68681_RECEIVE_BUFFER_B            __MC68681_REG(11)  /* RHRB  */
58#define MC68681_INPUT_PORT                  __MC68681_REG(13)  /* IP    */
59#define MC68681_START_COUNT_CMD             __MC68681_REG(14)  /* SCC   */
60#define MC68681_STOP_COUNT_CMD              __MC68681_REG(15)  /* STC   */
61
62/*
63 * mc68681 register offsets Write Only  Addresses
64 */
65#define MC68681_CLOCK_SELECT_REG_A          __MC68681_REG(1)   /* CSRA  */
66#define MC68681_COMMAND_REG_A               __MC68681_REG(2)   /* CRA   */
67#define MC68681_TRANSMIT_BUFFER_A           __MC68681_REG(3)   /* THRA  */
68#define MC68681_AUX_CTRL_REG                __MC68681_REG(4)   /* ACR   */
69#define MC68681_INTERRUPT_MASK_REG          __MC68681_REG(5)   /* IMR   */
70#define MC68681_CLOCK_SELECT_REG_B          __MC68681_REG(9)   /* CSRB  */
71#define MC68681_COMMAND_REG_B               __MC68681_REG(10)  /* CRB   */
72#define MC68681_TRANSMIT_BUFFER_B           __MC68681_REG(11)  /* THRB  */
73#define MC68681_OUTPUT_PORT_CONFIG_REG      __MC68681_REG(13)  /* OPCR  */
74#define MC68681_OUTPUT_PORT_SET_REG         __MC68681_REG(14)  /* SOPBC */
75#define MC68681_OUTPUT_PORT_RESET_BITS      __MC68681_REG(15)  /* COPBC */
[28a4b1d]76
77
[0789abef]78#ifndef MC6681_VOL
79#define MC6681_VOL( ptr )   ((volatile unsigned char *)(ptr))
[28a4b1d]80#endif
[0789abef]81
82#define MC68681_WRITE( _base, _reg, _data ) \
83   *((volatile unsigned char *)_base+_reg) = (_data)
84
85#define MC68681_READ( _base, _reg ) \
86   *(((volatile unsigned char *)_base+_reg))
87
88
89
[50f32b11]90#define  MC68681_CLEAR                                     0x00
[0789abef]91
92#define MC68681_PORT_A                                     0
93#define MC68681_PORT_B                                     1
94
[50f32b11]95/*
96 *  DUART Command Register Definitions:
[0789abef]97 *
[50f32b11]98 *  MC68681_COMMAND_REG_A,MC68681_COMMAND_REG_B
[0789abef]99 */
100#define MC68681_MODE_REG_ENABLE_RX                          0x01
101#define MC68681_MODE_REG_DISABLE_RX                         0x02
102#define MC68681_MODE_REG_ENABLE_TX                          0x04
103#define MC68681_MODE_REG_DISABLE_TX                         0x08
104#define MC68681_MODE_REG_RESET_MR_PTR                       0x10
105#define MC68681_MODE_REG_RESET_RX                           0x20
106#define MC68681_MODE_REG_RESET_TX                           0x30
107#define MC68681_MODE_REG_RESET_ERROR                        0x40
108#define MC68681_MODE_REG_RESET_BREAK                        0x50
109#define MC68681_MODE_REG_START_BREAK                        0x60
110#define MC68681_MODE_REG_STOP_BREAK                         0x70
111#define MC68681_MODE_REG_SET_RX_BRG                         0x80
112#define MC68681_MODE_REG_CLEAR_RX_BRG                       0x90
113#define MC68681_MODE_REG_SET_TX_BRG                         0xa0
114#define MC68681_MODE_REG_CLEAR_TX_BRG                       0xb0
115#define MC68681_MODE_REG_SET_STANDBY                        0xc0
116#define MC68681_MODE_REG_SET_ACTIVE                         0xd0
117
118/*
[b29378e]119 * Mode Register Definitions
[0789abef]120 *
[50f32b11]121 *  MC68681_MODE_REG_1A
122 *  MC68681_MODE_REG_1B
[0789abef]123 */
124#define MC68681_5BIT_CHARS                                  0x00
125#define MC68681_6BIT_CHARS                                  0x01
126#define MC68681_7BIT_CHARS                                  0x02
127#define MC68681_8BIT_CHARS                                  0x03
128
129#define MC68681_ODD_PARITY                                  0x00
130#define MC68681_EVEN_PARITY                                 0x04
131
132#define MC68681_WITH_PARITY                                 0x00
133#define MC68681_FORCE_PARITY                                0x08
134#define MC68681_NO_PARITY                                   0x10
135#define MC68681_MULTI_DROP                                  0x18
136
137#define MC68681_ERR_MODE_CHAR                               0x00
138#define MC68681_ERR_MODE_BLOCK                              0x20
139
140#define MC68681_RX_INTR_RX_READY                            0x00
141#define MC68681_RX_INTR_FFULL                               0x40
142
143#define MC68681_NO_RX_RTS_CTL                               0x00
144#define MC68681_RX_RTS_CTRL                                 0x80
145
146
147/*
[b29378e]148 * Mode Register Definitions
[0789abef]149 *
150 *  MC68681_MODE_REG_2A
151 *  MC68681_MODE_REG_2B
152 */
153#define MC68681_STOP_BIT_LENGTH__563                        0x00
154#define MC68681_STOP_BIT_LENGTH__625                        0x01
155#define MC68681_STOP_BIT_LENGTH__688                        0x02
156#define MC68681_STOP_BIT_LENGTH__75                         0x03
157#define MC68681_STOP_BIT_LENGTH__813                        0x04
158#define MC68681_STOP_BIT_LENGTH__875                        0x05
159#define MC68681_STOP_BIT_LENGTH__938                        0x06
160#define MC68681_STOP_BIT_LENGTH_1                           0x07
161#define MC68681_STOP_BIT_LENGTH_1_563                       0x08
162#define MC68681_STOP_BIT_LENGTH_1_625                       0x09
163#define MC68681_STOP_BIT_LENGTH_1_688                       0x0a
164#define MC68681_STOP_BIT_LENGTH_1_75                        0x0b
165#define MC68681_STOP_BIT_LENGTH_1_813                       0x0c
166#define MC68681_STOP_BIT_LENGTH_1_875                       0x0d
167#define MC68681_STOP_BIT_LENGTH_1_938                       0x0e
168#define MC68681_STOP_BIT_LENGTH_2                           0x0f
169
170#define MC68681_CTS_ENABLE_TX                               0x10
171#define MC68681_TX_RTS_CTRL                                 0x20
172
173#define MC68681_CHANNEL_MODE_NORMAL                         0x00
174#define MC68681_CHANNEL_MODE_ECHO                           0x40
175#define MC68681_CHANNEL_MODE_LOCAL_LOOP                     0x80
176#define MC68681_CHANNEL_MODE_REMOTE_LOOP                    0xc0
177
178/*
[b29378e]179 * Status Register Definitions
[0789abef]180 *
181 *    MC68681_STATUS_REG_A,  MC68681_STATUS_REG_B
182 */
183#define MC68681_RX_READY                                    0x01
184#define MC68681_FFULL                                       0x02
185#define MC68681_TX_READY                                    0x04
186#define MC68681_TX_EMPTY                                    0x08
187#define MC68681_OVERRUN_ERROR                               0x10
188#define MC68681_PARITY_ERROR                                0x20
189#define MC68681_FRAMING_ERROR                               0x40
190#define MC68681_RECEIVED_BREAK                              0x80
191
192
[50f32b11]193/*
194 * Interupt Status Register Definitions.
[0789abef]195 *
[50f32b11]196 * MC68681_INTERRUPT_STATUS_REG
[0789abef]197 */
198
199
[50f32b11]200/*
201 *  Interupt Mask Register Definitions
[0789abef]202 *
[50f32b11]203 *  MC68681_INTERRUPT_MASK_REG
[0789abef]204 */
205#define MC68681_IR_TX_READY_A                               0x01
206#define MC68681_IR_RX_READY_A                               0x02
207#define MC68681_IR_BREAK_A                                  0x04
208#define MC68681_IR_COUNTER_READY                            0x08
209#define MC68681_IR_TX_READY_B                               0x10
210#define MC68681_IR_RX_READY_B                               0x20
211#define MC68681_IR_BREAK_B                                  0x40
212#define MC68681_IR_INPUT_PORT_CHANGE                        0x80
213
[50f32b11]214/*
215 * Status Register Definitions.
216 *
217 * MC68681_STATUS_REG_A,MC68681_STATUS_REG_B
[0789abef]218 */
219#define MC68681_STATUS_RXRDY                                0x01
220#define MC68681_STATUS_FFULL                                0x02
221#define MC68681_STATUS_TXRDY                                0x04
222#define MC68681_STATUS_TXEMT                                0x08
223#define MC68681_STATUS_OVERRUN_ERROR                        0x10
224#define MC68681_STATUS_PARITY_ERROR                         0x20
225#define MC68681_STATUS_FRAMING_ERROR                        0x40
226#define MC68681_STATUS_RECEIVED_BREAK                       0x80
227
[50f32b11]228/*
229 * Definitions for the Interrupt Vector Register:
[0789abef]230 *
[50f32b11]231 * MC68681_INTERRUPT_VECTOR_REG
[0789abef]232 */
233#define  MC68681_INTERRUPT_VECTOR_INIT                      0x0f
234
[50f32b11]235/*
236 * Definitions for the Auxiliary Control Register
[0789abef]237 *
[50f32b11]238 * MC68681_AUX_CTRL_REG
[0789abef]239 */
240#define MC68681_AUX_BRG_SET1                                0x00
241#define MC68681_AUX_BRG_SET2                                0x80
242
243
[50f32b11]244/*
245 * The following Baud rates assume the X1 clock pin is driven with a
[0789abef]246 * 3.6864 MHz signal.  If a different frequency is used the DUART channel
247 * is running at the follwoing baud rate:
[50f32b11]248 *       ((Table Baud Rate)*frequency)/3.6864 MHz
[0789abef]249 */
250
[50f32b11]251/*
252 * Definitions for the Clock Select Register:
253 *
254 * MC68681_CLOCK_SELECT_REG_A,MC68681_CLOCK_SELECT_REG_A
[0789abef]255 *
256 * Note:  ACR[7] is the MSB of the Auxiliary Control register
257 *        X is the extend bit.
258 *        CRA - 0x08  Set Rx BRG Select Extend Bit   (X=1)
259 *        CRA - 0x09  Clear Rx BRG Select Extend Bit (X=0)
260 *        CRB - 0x0a  Set Tx BRG Select Extend Bit   (X=1)
261 *        CRB - 0x0b  Clear Tx BRG Select Extend Bit (x=1)
262 */
263#define MC68681_BAUD_RATE_MASK_50           0x00   /* ACR[7]=0,X=0 */
264                                                   /* ARC[7]=1,X=1 */
265#define MC68681_BAUD_RATE_MASK_75           0x00   /* ACR[7]=0,X=0 */
266                                                   /* ARC[7]=1,X=1 */
[50f32b11]267#define MC68681_BAUD_RATE_MASK_110          0x01
268#define MC68681_BAUD_RATE_MASK_134_5        0x02
[0789abef]269#define MC68681_BAUD_RATE_MASK_150          0x03   /* ACR[7]=0,X=0 */
270                                                   /* ARC[7]=1,X=1 */
271#define MC68681_BAUD_RATE_MASK_200          0x03   /* ACR[7]=0,X=0 */
272                                                   /* ARC[7]=1,X=1 */
273#define MC68681_BAUD_RATE_MASK_300          0x04   /* ACR[7]=0,X=0 */
274                                                   /* ARC[7]=1,X=1 */
275#define MC68681_BAUD_RATE_MASK_600          0x05   /* ACR[7]=0,X=0 */
276                                                   /* ARC[7]=1,X=1 */
277#define MC68681_BAUD_RATE_MASK_1050         0x07   /* ACR[7]=0,X=0 */
278                                                   /* ARC[7]=1,X=1 */
279#define MC68681_BAUD_RATE_MASK_1200         0x06   /* ACR[7]=0,X=0 */
280                                                   /* ARC[7]=1,X=1 */
281#define MC68681_BAUD_RATE_MASK_1800         0x0a   /* ACR[7]=0,X=0 */
282                                                   /* ARC[7]=1,X=1 */
283#define MC68681_BAUD_RATE_MASK_2400         0x08   /* ACR[7]=0,X=0 */
284                                                   /* ARC[7]=1,X=1 */
285#define MC68681_BAUD_RATE_MASK_3600         0x04   /* ACR[7]=0,X=0 */
286                                                   /* ARC[7]=1,X=1 */
[50f32b11]287#define MC68681_BAUD_RATE_MASK_4800         0x09
[0789abef]288#define MC68681_BAUD_RATE_MASK_7200         0x0a   /* ACR[7]=0,X=0 */
289                                                   /* ARC[7]=1,X=1 */
[50f32b11]290#define MC68681_BAUD_RATE_MASK_9600         0xbb
[0789abef]291
292#define MC68681_BAUD_RATE_MASK_14_4K        0x05   /* ACR[7]=0,X=0 */
293                                                   /* ARC[7]=1,X=1 */
294#define MC68681_BAUD_RATE_MASK_19_2K        0xcc   /* ACR[7]=1,X=0 */
295                                                   /* ARC[7]=0,X=1 */
296#define MC68681_BAUD_RATE_MASK_28_8K        0x06   /* ACR[7]=0,X=0 */
297                                                   /* ARC[7]=1,X=1 */
298#define MC68681_BAUD_RATE_MASK_38_4K        0xcc   /* ACR[7]=0,X=0 */
299                                                   /* ARC[7]=1,X=1 */
300#define MC68681_BAUD_RATE_MASK_57_6K        0x07   /* ACR[7]=0,X=0 */
301                                                   /* ARC[7]=1,X=1 */
[50f32b11]302#define MC68681_BAUD_RATE_MASK_115_5K       0x08
303#define MC68681_BAUD_RATE_MASK_TIMER        0xdd
304#define MC68681_BAUD_RATE_MASK_TIMER_16X    0xee
305#define MC68681_BAUD_RATE_MASK_TIMER_1X     0xff
[0789abef]306
307#endif
Note: See TracBrowser for help on using the repository browser.