RTEMS  5.0.0
m340uart.h
Go to the documentation of this file.
1 
9 /*
10  * Header file for console driver
11  * defines for accessing M68340/68349 UART registers
12  *
13  * Author:
14  * Geoffroy Montel
15  * France Telecom - CNET/DSM/TAM/CAT
16  * 4, rue du Clos Courtel
17  * 35512 CESSON-SEVIGNE
18  * FRANCE
19  *
20  * e-mail: g_montel@yahoo.com
21  *
22  *
23  * COPYRIGHT (c) 1989-2008.
24  * On-Line Applications Research Corporation (OAR).
25  *
26  * The license and distribution terms for this file may be
27  * found in the file LICENSE in this distribution or at
28  * http://www.rtems.org/license/LICENSE.
29  */
30 
31 #ifndef __m340uart_H__
32 #define __m340uart_H__
33 
34 #include <sys/types.h>
35 
36 /* UART initialisation */
37 #define UART_CHANNEL_A 0
38 #define UART_CHANNEL_B 1
39 #define UART_NUMBER_OF_CHANNELS 2
40 #define UART_CONSOLE_NAME "/dev/console"
41 #define UART_RAW_IO_NAME "/dev/tty1"
42 #define UART_FIFO_FULL 0
43 #define UART_CRR 1
44 #define UART_INTERRUPTS 0
45 #define UART_POLLING 1
46 #define UART_TERMIOS_CONSOLE 0
47 #define UART_TERMIOS_RAW 1
48 #define UART_TERMIOS_MIN_DEFAULT 1
49 #define UART_TERMIOS_TIME_DEFAULT 0
50 
51 void Init_UART_Table(void);
52 
53 typedef struct {
54  uint8_t enable;
55  uint16_t rx_buffer_size; /* NOT IMPLEMENTED */
56  uint16_t tx_buffer_size; /* NOT IMPLEMENTED */
58 
59 typedef struct { /* for one channel */
60  uint8_t enable; /* use this channel */
61  char name[64]; /* use UART_CONSOLE_NAME for console purpose */
62  uint8_t parity_mode; /* parity mode, see MR1 section for defines */
63  uint8_t bits_per_char; /* bits per character, see MR1 section for defines */
64  float rx_baudrate; /* Rx baudrate */
65  float tx_baudrate; /* Tx baudrate */
66  uint8_t rx_mode; /* FIFO Full (UART_FIFO_FULL) or ChannelReceiverReady (UART_CRR) */
67  uint8_t mode; /* use interrupts (UART_INTERRUPTS) or polling (UART_POLLING) */
68  uart_termios_config termios;
70 
71 extern uart_channel_config m340_uart_config[UART_NUMBER_OF_CHANNELS];
72 
73 typedef struct {
74  int set; /* number of the m340 baud speed set */
75  int rcs; /* RCS for the needed baud set */
76  int tcs; /* TCS for the needed baud set */
77  } t_baud_speed;
78 
79 typedef struct {
80  t_baud_speed baud_speed_table[2];
81  short nb;
83 
84 extern t_baud_speed_table
85 Find_Right_m340_UART_Config(float ChannelA_ReceiverBaudRate, float ChannelA_TransmitterBaudRate, uint8_t enableA,
86  float ChannelB_ReceiverBaudRate, float ChannelB_TransmitterBaudRate, uint8_t enableB);
87 
88 extern rtems_isr InterruptHandler (rtems_vector_number v);
89 
90 extern int dbugRead (int minor);
91 extern ssize_t dbugWrite (int minor, const char *buf, size_t len);
92 
93 extern float m340_Baud_Rates_Table[16][2];
94 
95 /* SR */
96 #define m340_Rx_RDY 1
97 #define m340_FFULL (1<<1)
98 #define m340_Tx_RDY (1<<2)
99 #define m340_TxEMP (1<<3)
100 #define m340_OE (1<<4)
101 #define m340_PE (1<<5)
102 #define m340_FE (1<<6)
103 #define m340_RB (1<<7)
104 
105 /* IER */
106 #define m340_TxRDYA 1
107 #define m340_RxRDYA (1<<1)
108 #define m340_TxRxRDYA 0x3
109 #define m340_TxRDYB (1<<4)
110 #define m340_RxRDYB (1<<5)
111 #define m340_TxRxRDYB 0x30
112 
113 /* CR */
114 #define m340_Reset_Error_Status 0x40
115 #define m340_Reset_Receiver 0x20
116 #define m340_Reset_Transmitter 0x30
117 #define m340_Transmitter_Enable (1<<2)
118 #define m340_Receiver_Enable 1
119 #define m340_Transmitter_Disable (2<<2)
120 #define m340_Receiver_Disable 2
121 
122 /* ACR */
123 #define m340_BRG_Set1 0
124 #define m340_BRG_Set2 (1<<7)
125 
126 /* OPCR */
127 #define m340_OPCR_Gal 0x0
128 #define m340_OPCR_Aux 0xFF
129 
130 /* ISR */
131 #define m340_COS (1<<7)
132 #define m340_DBB (1<<6)
133 #define m340_XTAL_RDY (1<<3)
134 #define m340_DBA (1<<2)
135 
136 /* MR1 */
137 #define m340_RxRTS (1<<7)
138 #define m340_R_F (1<<6) /* character or block mode */
139 #define m340_ERR (1<<5)
140 #define m340_RxRTX (1<<7)
141 #define m340_Even_Parity 0
142 #define m340_Odd_Parity (1<<2)
143 #define m340_Low_Parity (2<<2)
144 #define m340_High_Parity (3<<2)
145 #define m340_No_Parity (4<<2)
146 #define m340_Data_Character (6<<2)
147 #define m340_Address_Character (7<<2)
148 #define m340_5bpc 0x0
149 #define m340_6bpc 0x1
150 #define m340_7bpc 0x2
151 #define m340_8bpc 0x3
152 
153 /* MR2 */
154 #define m340_normal (0<<6)
155 #define m340_automatic_echo (1<<6)
156 #define m340_local_loopback (2<<6)
157 #define m340_remote_loopback (3<<6)
158 #define m340_TxRTS (1<<5)
159 #define m340_TxCTS (1<<4)
160 
161 /* Baud rates for Transmitter/Receiver */
162 #define SCLK 1 /* put your own SCLK value here */
163 
164 #endif
ISR_Vector_number rtems_vector_number
Control block type used to manage the vectors.
Definition: intr.h:47
ISR_Handler rtems_isr
Return type for interrupt handler.
Definition: intr.h:52
Definition: m340uart.h:59
Definition: m340uart.h:73
Definition: m340uart.h:53
unsigned v
Definition: tte.h:73
Definition: m340uart.h:79