1 | /* |
---|
2 | * Copyright (c) 2016 embedded brains GmbH. All rights reserved. |
---|
3 | * |
---|
4 | * embedded brains GmbH |
---|
5 | * Dornierstr. 4 |
---|
6 | * 82178 Puchheim |
---|
7 | * Germany |
---|
8 | * <info@embedded-brains.de> |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.rtems.org/license/LICENSE. |
---|
13 | */ |
---|
14 | |
---|
15 | #ifndef LIBBSP_ARM_ATSAM_SC16IS752_H |
---|
16 | #define LIBBSP_ARM_ATSAM_SC16IS752_H |
---|
17 | |
---|
18 | #ifdef __cplusplus |
---|
19 | extern "C" { |
---|
20 | #endif /* __cplusplus */ |
---|
21 | |
---|
22 | /* General register set */ |
---|
23 | #define SC16IS752_RHR 0x0 |
---|
24 | #define SC16IS752_THR 0x0 |
---|
25 | #define SC16IS752_IER 0x1 |
---|
26 | #define SC16IS752_FCR 0x2 |
---|
27 | #define SC16IS752_IIR 0x2 |
---|
28 | #define SC16IS752_LCR 0x3 |
---|
29 | #define SC16IS752_MCR 0x4 |
---|
30 | #define SC16IS752_LSR 0x5 |
---|
31 | #define SC16IS752_MSR 0x6 |
---|
32 | #define SC16IS752_TCR 0x6 |
---|
33 | #define SC16IS752_SPR 0x7 |
---|
34 | #define SC16IS752_TLR 0x7 |
---|
35 | #define SC16IS752_TXLVL 0x8 |
---|
36 | #define SC16IS752_RXLVL 0x9 |
---|
37 | #define SC16IS752_IODIR 0xA |
---|
38 | #define SC16IS752_IOSTATE 0xB |
---|
39 | #define SC16IS752_IOINTENA 0xC |
---|
40 | #define SC16IS752_IOCONTROL 0xE |
---|
41 | #define SC16IS752_EFCR 0xF |
---|
42 | |
---|
43 | /* Special register set */ |
---|
44 | #define SC16IS752_DLL 0x0 |
---|
45 | #define SC16IS752_DLH 0x1 |
---|
46 | |
---|
47 | /* Enhanced register set */ |
---|
48 | #define SC16IS752_EFR 0x2 |
---|
49 | #define SC16IS752_XON1 0x4 |
---|
50 | #define SC16IS752_XON2 0x5 |
---|
51 | #define SC16IS752_XOFF1 0x6 |
---|
52 | #define SC16IS752_XOFF2 0x7 |
---|
53 | |
---|
54 | /* FCR */ |
---|
55 | #define FCR_FIFO_EN 0x01 |
---|
56 | #define FCR_RX_FIFO_RST 0x02 |
---|
57 | #define FCR_TX_FIFO_RST 0x04 |
---|
58 | #define FCR_TX_FIFO_TRG_8 0x00 |
---|
59 | #define FCR_TX_FIFO_TRG_16 0x10 |
---|
60 | #define FCR_TX_FIFO_TRG_32 0x20 |
---|
61 | #define FCR_TX_FIFO_TRG_56 0x30 |
---|
62 | #define FCR_RX_FIFO_TRG_8 0x00 |
---|
63 | #define FCR_RX_FIFO_TRG_16 0x40 |
---|
64 | #define FCR_RX_FIFO_TRG_56 0x80 |
---|
65 | #define FCR_RX_FIFO_TRG_60 0xc0 |
---|
66 | |
---|
67 | /* EFCR */ |
---|
68 | #define EFCR_RS485_ENABLE (1u << 0) |
---|
69 | #define EFCR_RX_DISABLE (1u << 1) |
---|
70 | #define EFCR_TX_DISABLE (1u << 2) |
---|
71 | |
---|
72 | /* IER */ |
---|
73 | #define IER_RHR (1u << 0) |
---|
74 | #define IER_THR (1u << 1) |
---|
75 | #define IER_RECEIVE_LINE_STATUS (1u << 2) |
---|
76 | #define IER_MODEM_STATUS (1u << 3) |
---|
77 | #define IER_SLEEP_MODE (1u << 4) |
---|
78 | #define IER_XOFF (1u << 5) |
---|
79 | #define IER_RTS (1u << 6) |
---|
80 | #define IER_CTS (1u << 7) |
---|
81 | |
---|
82 | /* IIR */ |
---|
83 | #define IIR_TX_INTERRUPT (1u << 1) |
---|
84 | #define IIR_RX_INTERRUPT (1u << 2) |
---|
85 | |
---|
86 | /* LCR */ |
---|
87 | #define LCR_CHRL_5_BIT (0u << 1) | (0u << 0) |
---|
88 | #define LCR_CHRL_6_BIT (0u << 1) | (1u << 0) |
---|
89 | #define LCR_CHRL_7_BIT (1u << 1) | (0u << 0) |
---|
90 | #define LCR_CHRL_8_BIT (1u << 1) | (1u << 0) |
---|
91 | #define LCR_2_STOP_BIT (1u << 2) |
---|
92 | #define LCR_SET_PARITY (1u << 3) |
---|
93 | #define LCR_EVEN_PARITY (1u << 4) |
---|
94 | #define LCR_ENABLE_DIVISOR (1u << 7) |
---|
95 | |
---|
96 | /* LSR */ |
---|
97 | #define LSR_TXEMPTY (1u << 5) |
---|
98 | #define LSR_RXRDY (1u << 0) |
---|
99 | #define LSR_ERROR_BITS (7u << 2) |
---|
100 | |
---|
101 | /* MCR */ |
---|
102 | #define MCR_PRESCALE_NEEDED (1u << 0) |
---|
103 | |
---|
104 | /* EFR */ |
---|
105 | #define EFR_ENHANCED_FUNC_ENABLE (1u << 4) |
---|
106 | #define EFR_SPECIAL_CHAR_DETECT (1u << 5) |
---|
107 | #define EFR_RTS_FLOW_CTRL_EN (1u << 6) |
---|
108 | #define EFR_CTS_FLOW_CTRL_EN (1u << 7) |
---|
109 | |
---|
110 | /* IOCONTROL: User accessible. Therefore see sc16is752.h for the defines. */ |
---|
111 | |
---|
112 | #define SC16IS752_FIFO_DEPTH 64 |
---|
113 | |
---|
114 | #ifdef __cplusplus |
---|
115 | } |
---|
116 | #endif /* __cplusplus */ |
---|
117 | |
---|
118 | #endif /* LIBBSP_ARM_ATSAM_SC16IS752_H */ |
---|