RTEMS 7.0-rc1
Loading...
Searching...
No Matches
sc16is752-regs.h
1/*
2 * Copyright (C) 2016 embedded brains GmbH & Co. KG
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
17 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23 * POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#ifndef LIBBSP_ARM_ATSAM_SC16IS752_H
27#define LIBBSP_ARM_ATSAM_SC16IS752_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif /* __cplusplus */
32
33/* General register set */
34#define SC16IS752_RHR 0x0
35#define SC16IS752_THR 0x0
36#define SC16IS752_IER 0x1
37#define SC16IS752_FCR 0x2
38#define SC16IS752_IIR 0x2
39#define SC16IS752_LCR 0x3
40#define SC16IS752_MCR 0x4
41#define SC16IS752_LSR 0x5
42#define SC16IS752_MSR 0x6
43#define SC16IS752_TCR 0x6
44#define SC16IS752_SPR 0x7
45#define SC16IS752_TLR 0x7
46#define SC16IS752_TXLVL 0x8
47#define SC16IS752_RXLVL 0x9
48#define SC16IS752_IODIR 0xA
49#define SC16IS752_IOSTATE 0xB
50#define SC16IS752_IOINTENA 0xC
51#define SC16IS752_IOCONTROL 0xE
52#define SC16IS752_EFCR 0xF
53
54/* Special register set */
55#define SC16IS752_DLL 0x0
56#define SC16IS752_DLH 0x1
57
58/* Enhanced register set */
59#define SC16IS752_EFR 0x2
60#define SC16IS752_XON1 0x4
61#define SC16IS752_XON2 0x5
62#define SC16IS752_XOFF1 0x6
63#define SC16IS752_XOFF2 0x7
64
65/* FCR */
66#define SC16IS752_FCR_FIFO_EN 0x01
67#define SC16IS752_FCR_RX_FIFO_RST 0x02
68#define SC16IS752_FCR_TX_FIFO_RST 0x04
69#define SC16IS752_FCR_TX_FIFO_TRG_8 0x00
70#define SC16IS752_FCR_TX_FIFO_TRG_16 0x10
71#define SC16IS752_FCR_TX_FIFO_TRG_32 0x20
72#define SC16IS752_FCR_TX_FIFO_TRG_56 0x30
73#define SC16IS752_FCR_RX_FIFO_TRG_8 0x00
74#define SC16IS752_FCR_RX_FIFO_TRG_16 0x40
75#define SC16IS752_FCR_RX_FIFO_TRG_56 0x80
76#define SC16IS752_FCR_RX_FIFO_TRG_60 0xc0
77
78/* EFCR */
79#define SC16IS752_EFCR_RS485_ENABLE (1u << 0)
80#define SC16IS752_EFCR_RX_DISABLE (1u << 1)
81#define SC16IS752_EFCR_TX_DISABLE (1u << 2)
82#define SC16IS752_EFCR_RTSCON (1u << 4)
83#define SC16IS752_EFCR_RTSINVER (1u << 5)
84
85/* IER */
86#define SC16IS752_IER_RHR (1u << 0)
87#define SC16IS752_IER_THR (1u << 1)
88#define SC16IS752_IER_RECEIVE_LINE_STATUS (1u << 2)
89#define SC16IS752_IER_MODEM_STATUS (1u << 3)
90#define SC16IS752_IER_SLEEP_MODE (1u << 4)
91#define SC16IS752_IER_XOFF (1u << 5)
92#define SC16IS752_IER_RTS (1u << 6)
93#define SC16IS752_IER_CTS (1u << 7)
94
95/* IIR */
96#define SC16IS752_IIR_TX_INTERRUPT (1u << 1)
97#define SC16IS752_IIR_RX_INTERRUPT (1u << 2)
98
99/* LCR */
100#define SC16IS752_LCR_CHRL_5_BIT (0u << 1) | (0u << 0)
101#define SC16IS752_LCR_CHRL_6_BIT (0u << 1) | (1u << 0)
102#define SC16IS752_LCR_CHRL_7_BIT (1u << 1) | (0u << 0)
103#define SC16IS752_LCR_CHRL_8_BIT (1u << 1) | (1u << 0)
104#define SC16IS752_LCR_2_STOP_BIT (1u << 2)
105#define SC16IS752_LCR_SET_PARITY (1u << 3)
106#define SC16IS752_LCR_EVEN_PARITY (1u << 4)
107#define SC16IS752_LCR_BREAK (1u << 5)
108#define SC16IS752_LCR_ENABLE_DIVISOR (1u << 7)
109
110/* LSR */
111#define SC16IS752_LSR_TXEMPTY (1u << 5)
112#define SC16IS752_LSR_RXRDY (1u << 0)
113#define SC16IS752_LSR_ERROR_BITS (7u << 2)
114
115/* MCR */
116#define SC16IS752_MCR_DTR (1u << 0)
117#define SC16IS752_MCR_RTS (1u << 1)
118#define SC16IS752_MCR_TCR_TLR (1u << 2)
119#define SC16IS752_MCR_LOOPBACK (1u << 4)
120#define SC16IS752_MCR_XON_ANY (1u << 5)
121#define SC16IS752_MCR_IRDA_ENABLE (1u << 6)
122#define SC16IS752_MCR_PRESCALE_NEEDED (1u << 7)
123
124/* MSR */
125#define SC16IS752_MSR_dCTS (1u << 0)
126#define SC16IS752_MSR_dDSR (1u << 1)
127#define SC16IS752_MSR_dRI (1u << 2)
128#define SC16IS752_MSR_dCD (1u << 3)
129#define SC16IS752_MSR_CTS (1u << 4)
130#define SC16IS752_MSR_DSR (1u << 5)
131#define SC16IS752_MSR_RI (1u << 6)
132#define SC16IS752_MSR_CD (1u << 7)
133
134/* EFR */
135#define SC16IS752_EFR_ENHANCED_FUNC_ENABLE (1u << 4)
136#define SC16IS752_EFR_SPECIAL_CHAR_DETECT (1u << 5)
137#define SC16IS752_EFR_RTS_FLOW_CTRL_EN (1u << 6)
138#define SC16IS752_EFR_CTS_FLOW_CTRL_EN (1u << 7)
139
140/* IOCONTROL: User accessible. Therefore see sc16is752.h for the defines. */
141
142#define SC16IS752_FIFO_DEPTH 64
143
144#ifdef __cplusplus
145}
146#endif /* __cplusplus */
147
148#endif /* LIBBSP_ARM_ATSAM_SC16IS752_H */