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