1 | /** |
---|
2 | * @file |
---|
3 | * @ingroup sparc_bsp |
---|
4 | * @defgroup uart UART |
---|
5 | * @ingroup uart |
---|
6 | * @brief Driver interface for APBUART |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * COPYRIGHT (c) 2007. |
---|
11 | * Gaisler Research |
---|
12 | * |
---|
13 | * The license and distribution terms for this file may be |
---|
14 | * found in the file LICENSE in this distribution or at |
---|
15 | * http://www.rtems.com/license/LICENSE. |
---|
16 | * |
---|
17 | */ |
---|
18 | |
---|
19 | #ifndef __APBUART_H__ |
---|
20 | #define __APBUART_H__ |
---|
21 | |
---|
22 | #include <ambapp.h> |
---|
23 | |
---|
24 | #ifdef __cplusplus |
---|
25 | extern "C" { |
---|
26 | #endif |
---|
27 | |
---|
28 | typedef struct { |
---|
29 | unsigned int hw_dovr; |
---|
30 | unsigned int hw_parity; |
---|
31 | unsigned int hw_frame; |
---|
32 | unsigned int sw_dovr; |
---|
33 | unsigned int rx_cnt; |
---|
34 | unsigned int tx_cnt; |
---|
35 | } apbuart_stats; |
---|
36 | |
---|
37 | #define APBUART_START 0 |
---|
38 | #define APBUART_STOP 1 |
---|
39 | #define APBUART_SET_RXFIFO_LEN 2 |
---|
40 | #define APBUART_SET_TXFIFO_LEN 3 |
---|
41 | #define APBUART_SET_BAUDRATE 4 |
---|
42 | #define APBUART_SET_SCALER 5 |
---|
43 | #define APBUART_SET_BLOCKING 6 |
---|
44 | #define APBUART_SET_ASCII_MODE 7 |
---|
45 | |
---|
46 | |
---|
47 | #define APBUART_GET_STATS 16 |
---|
48 | #define APBUART_CLR_STATS 17 |
---|
49 | |
---|
50 | #define APBUART_BLK_RX 0x1 |
---|
51 | #define APBUART_BLK_TX 0x2 |
---|
52 | #define APBUART_BLK_FLUSH 0x4 |
---|
53 | |
---|
54 | |
---|
55 | #define APBUART_CTRL_RE 0x1 |
---|
56 | #define APBUART_CTRL_TE 0x2 |
---|
57 | #define APBUART_CTRL_RI 0x4 |
---|
58 | #define APBUART_CTRL_TI 0x8 |
---|
59 | #define APBUART_CTRL_PS 0x10 |
---|
60 | #define APBUART_CTRL_PE 0x20 |
---|
61 | #define APBUART_CTRL_FL 0x40 |
---|
62 | #define APBUART_CTRL_LB 0x80 |
---|
63 | #define APBUART_CTRL_EC 0x100 |
---|
64 | #define APBUART_CTRL_TF 0x200 |
---|
65 | #define APBUART_CTRL_RF 0x400 |
---|
66 | |
---|
67 | #define APBUART_STATUS_DR 0x1 |
---|
68 | #define APBUART_STATUS_TS 0x2 |
---|
69 | #define APBUART_STATUS_TE 0x4 |
---|
70 | #define APBUART_STATUS_BR 0x8 |
---|
71 | #define APBUART_STATUS_OV 0x10 |
---|
72 | #define APBUART_STATUS_PE 0x20 |
---|
73 | #define APBUART_STATUS_FE 0x40 |
---|
74 | #define APBUART_STATUS_TH 0x80 |
---|
75 | #define APBUART_STATUS_RH 0x100 |
---|
76 | #define APBUART_STATUS_TF 0x200 |
---|
77 | #define APBUART_STATUS_RF 0x400 |
---|
78 | |
---|
79 | /* Register APBUART driver |
---|
80 | * bus = pointer to AMBA bus description used to search for APBUART(s). |
---|
81 | * (&ambapp_plb for LEON3), (LEON2: see amba_scan) |
---|
82 | */ |
---|
83 | int apbuart_register (struct ambapp_bus *bus); |
---|
84 | |
---|
85 | #ifdef __cplusplus |
---|
86 | } |
---|
87 | #endif |
---|
88 | |
---|
89 | #endif /* __APBUART_H__ */ |
---|