18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*  *********************************************************************
38c2ecf20Sopenharmony_ci    *  SB1250 Board Support Package
48c2ecf20Sopenharmony_ci    *
58c2ecf20Sopenharmony_ci    *  UART Constants				File: sb1250_uart.h
68c2ecf20Sopenharmony_ci    *
78c2ecf20Sopenharmony_ci    *  This module contains constants and macros useful for
88c2ecf20Sopenharmony_ci    *  manipulating the SB1250's UARTs
98c2ecf20Sopenharmony_ci    *
108c2ecf20Sopenharmony_ci    *  SB1250 specification level:  User's manual 1/02/02
118c2ecf20Sopenharmony_ci    *
128c2ecf20Sopenharmony_ci    *********************************************************************
138c2ecf20Sopenharmony_ci    *
148c2ecf20Sopenharmony_ci    *  Copyright 2000,2001,2002,2003
158c2ecf20Sopenharmony_ci    *  Broadcom Corporation. All rights reserved.
168c2ecf20Sopenharmony_ci    *
178c2ecf20Sopenharmony_ci    ********************************************************************* */
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#ifndef _SB1250_UART_H
218c2ecf20Sopenharmony_ci#define _SB1250_UART_H
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#include <asm/sibyte/sb1250_defs.h>
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/* **********************************************************************
268c2ecf20Sopenharmony_ci   * DUART Registers
278c2ecf20Sopenharmony_ci   ********************************************************************** */
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci/*
308c2ecf20Sopenharmony_ci * DUART Mode Register #1 (Table 10-3)
318c2ecf20Sopenharmony_ci * Register: DUART_MODE_REG_1_A
328c2ecf20Sopenharmony_ci * Register: DUART_MODE_REG_1_B
338c2ecf20Sopenharmony_ci */
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#define S_DUART_BITS_PER_CHAR	    0
368c2ecf20Sopenharmony_ci#define M_DUART_BITS_PER_CHAR	    _SB_MAKEMASK(2, S_DUART_BITS_PER_CHAR)
378c2ecf20Sopenharmony_ci#define V_DUART_BITS_PER_CHAR(x)    _SB_MAKEVALUE(x, S_DUART_BITS_PER_CHAR)
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#define K_DUART_BITS_PER_CHAR_RSV0  0
408c2ecf20Sopenharmony_ci#define K_DUART_BITS_PER_CHAR_RSV1  1
418c2ecf20Sopenharmony_ci#define K_DUART_BITS_PER_CHAR_7	    2
428c2ecf20Sopenharmony_ci#define K_DUART_BITS_PER_CHAR_8	    3
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci#define V_DUART_BITS_PER_CHAR_RSV0  V_DUART_BITS_PER_CHAR(K_DUART_BITS_PER_CHAR_RSV0)
458c2ecf20Sopenharmony_ci#define V_DUART_BITS_PER_CHAR_RSV1  V_DUART_BITS_PER_CHAR(K_DUART_BITS_PER_CHAR_RSV1)
468c2ecf20Sopenharmony_ci#define V_DUART_BITS_PER_CHAR_7	    V_DUART_BITS_PER_CHAR(K_DUART_BITS_PER_CHAR_7)
478c2ecf20Sopenharmony_ci#define V_DUART_BITS_PER_CHAR_8	    V_DUART_BITS_PER_CHAR(K_DUART_BITS_PER_CHAR_8)
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci#define M_DUART_PARITY_TYPE_EVEN    0x00
518c2ecf20Sopenharmony_ci#define M_DUART_PARITY_TYPE_ODD	    _SB_MAKEMASK1(2)
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci#define S_DUART_PARITY_MODE	     3
548c2ecf20Sopenharmony_ci#define M_DUART_PARITY_MODE	    _SB_MAKEMASK(2, S_DUART_PARITY_MODE)
558c2ecf20Sopenharmony_ci#define V_DUART_PARITY_MODE(x)	    _SB_MAKEVALUE(x, S_DUART_PARITY_MODE)
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci#define K_DUART_PARITY_MODE_ADD	      0
588c2ecf20Sopenharmony_ci#define K_DUART_PARITY_MODE_ADD_FIXED 1
598c2ecf20Sopenharmony_ci#define K_DUART_PARITY_MODE_NONE      2
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci#define V_DUART_PARITY_MODE_ADD	      V_DUART_PARITY_MODE(K_DUART_PARITY_MODE_ADD)
628c2ecf20Sopenharmony_ci#define V_DUART_PARITY_MODE_ADD_FIXED V_DUART_PARITY_MODE(K_DUART_PARITY_MODE_ADD_FIXED)
638c2ecf20Sopenharmony_ci#define V_DUART_PARITY_MODE_NONE      V_DUART_PARITY_MODE(K_DUART_PARITY_MODE_NONE)
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci#define M_DUART_TX_IRQ_SEL_TXRDY    0
668c2ecf20Sopenharmony_ci#define M_DUART_TX_IRQ_SEL_TXEMPT   _SB_MAKEMASK1(5)
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci#define M_DUART_RX_IRQ_SEL_RXRDY    0
698c2ecf20Sopenharmony_ci#define M_DUART_RX_IRQ_SEL_RXFULL   _SB_MAKEMASK1(6)
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci#define M_DUART_RX_RTS_ENA	    _SB_MAKEMASK1(7)
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci/*
748c2ecf20Sopenharmony_ci * DUART Mode Register #2 (Table 10-4)
758c2ecf20Sopenharmony_ci * Register: DUART_MODE_REG_2_A
768c2ecf20Sopenharmony_ci * Register: DUART_MODE_REG_2_B
778c2ecf20Sopenharmony_ci */
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci#define M_DUART_MODE_RESERVED1	    _SB_MAKEMASK(3, 0)	 /* ignored */
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci#define M_DUART_STOP_BIT_LEN_2	    _SB_MAKEMASK1(3)
828c2ecf20Sopenharmony_ci#define M_DUART_STOP_BIT_LEN_1	    0
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci#define M_DUART_TX_CTS_ENA	    _SB_MAKEMASK1(4)
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci#define M_DUART_MODE_RESERVED2	    _SB_MAKEMASK1(5)	/* must be zero */
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci#define S_DUART_CHAN_MODE	    6
908c2ecf20Sopenharmony_ci#define M_DUART_CHAN_MODE	    _SB_MAKEMASK(2, S_DUART_CHAN_MODE)
918c2ecf20Sopenharmony_ci#define V_DUART_CHAN_MODE(x)	    _SB_MAKEVALUE(x, S_DUART_CHAN_MODE)
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci#define K_DUART_CHAN_MODE_NORMAL    0
948c2ecf20Sopenharmony_ci#define K_DUART_CHAN_MODE_LCL_LOOP  2
958c2ecf20Sopenharmony_ci#define K_DUART_CHAN_MODE_REM_LOOP  3
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci#define V_DUART_CHAN_MODE_NORMAL    V_DUART_CHAN_MODE(K_DUART_CHAN_MODE_NORMAL)
988c2ecf20Sopenharmony_ci#define V_DUART_CHAN_MODE_LCL_LOOP  V_DUART_CHAN_MODE(K_DUART_CHAN_MODE_LCL_LOOP)
998c2ecf20Sopenharmony_ci#define V_DUART_CHAN_MODE_REM_LOOP  V_DUART_CHAN_MODE(K_DUART_CHAN_MODE_REM_LOOP)
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci/*
1028c2ecf20Sopenharmony_ci * DUART Command Register (Table 10-5)
1038c2ecf20Sopenharmony_ci * Register: DUART_CMD_A
1048c2ecf20Sopenharmony_ci * Register: DUART_CMD_B
1058c2ecf20Sopenharmony_ci */
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci#define M_DUART_RX_EN		    _SB_MAKEMASK1(0)
1088c2ecf20Sopenharmony_ci#define M_DUART_RX_DIS		    _SB_MAKEMASK1(1)
1098c2ecf20Sopenharmony_ci#define M_DUART_TX_EN		    _SB_MAKEMASK1(2)
1108c2ecf20Sopenharmony_ci#define M_DUART_TX_DIS		    _SB_MAKEMASK1(3)
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci#define S_DUART_MISC_CMD	    4
1138c2ecf20Sopenharmony_ci#define M_DUART_MISC_CMD	    _SB_MAKEMASK(3, S_DUART_MISC_CMD)
1148c2ecf20Sopenharmony_ci#define V_DUART_MISC_CMD(x)	    _SB_MAKEVALUE(x, S_DUART_MISC_CMD)
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci#define K_DUART_MISC_CMD_NOACTION0	 0
1178c2ecf20Sopenharmony_ci#define K_DUART_MISC_CMD_NOACTION1	 1
1188c2ecf20Sopenharmony_ci#define K_DUART_MISC_CMD_RESET_RX	 2
1198c2ecf20Sopenharmony_ci#define K_DUART_MISC_CMD_RESET_TX	 3
1208c2ecf20Sopenharmony_ci#define K_DUART_MISC_CMD_NOACTION4	 4
1218c2ecf20Sopenharmony_ci#define K_DUART_MISC_CMD_RESET_BREAK_INT 5
1228c2ecf20Sopenharmony_ci#define K_DUART_MISC_CMD_START_BREAK	 6
1238c2ecf20Sopenharmony_ci#define K_DUART_MISC_CMD_STOP_BREAK	 7
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci#define V_DUART_MISC_CMD_NOACTION0	 V_DUART_MISC_CMD(K_DUART_MISC_CMD_NOACTION0)
1268c2ecf20Sopenharmony_ci#define V_DUART_MISC_CMD_NOACTION1	 V_DUART_MISC_CMD(K_DUART_MISC_CMD_NOACTION1)
1278c2ecf20Sopenharmony_ci#define V_DUART_MISC_CMD_RESET_RX	 V_DUART_MISC_CMD(K_DUART_MISC_CMD_RESET_RX)
1288c2ecf20Sopenharmony_ci#define V_DUART_MISC_CMD_RESET_TX	 V_DUART_MISC_CMD(K_DUART_MISC_CMD_RESET_TX)
1298c2ecf20Sopenharmony_ci#define V_DUART_MISC_CMD_NOACTION4	 V_DUART_MISC_CMD(K_DUART_MISC_CMD_NOACTION4)
1308c2ecf20Sopenharmony_ci#define V_DUART_MISC_CMD_RESET_BREAK_INT V_DUART_MISC_CMD(K_DUART_MISC_CMD_RESET_BREAK_INT)
1318c2ecf20Sopenharmony_ci#define V_DUART_MISC_CMD_START_BREAK	 V_DUART_MISC_CMD(K_DUART_MISC_CMD_START_BREAK)
1328c2ecf20Sopenharmony_ci#define V_DUART_MISC_CMD_STOP_BREAK	 V_DUART_MISC_CMD(K_DUART_MISC_CMD_STOP_BREAK)
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci#define M_DUART_CMD_RESERVED		 _SB_MAKEMASK1(7)
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ci/*
1378c2ecf20Sopenharmony_ci * DUART Status Register (Table 10-6)
1388c2ecf20Sopenharmony_ci * Register: DUART_STATUS_A
1398c2ecf20Sopenharmony_ci * Register: DUART_STATUS_B
1408c2ecf20Sopenharmony_ci * READ-ONLY
1418c2ecf20Sopenharmony_ci */
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ci#define M_DUART_RX_RDY		    _SB_MAKEMASK1(0)
1448c2ecf20Sopenharmony_ci#define M_DUART_RX_FFUL		    _SB_MAKEMASK1(1)
1458c2ecf20Sopenharmony_ci#define M_DUART_TX_RDY		    _SB_MAKEMASK1(2)
1468c2ecf20Sopenharmony_ci#define M_DUART_TX_EMT		    _SB_MAKEMASK1(3)
1478c2ecf20Sopenharmony_ci#define M_DUART_OVRUN_ERR	    _SB_MAKEMASK1(4)
1488c2ecf20Sopenharmony_ci#define M_DUART_PARITY_ERR	    _SB_MAKEMASK1(5)
1498c2ecf20Sopenharmony_ci#define M_DUART_FRM_ERR		    _SB_MAKEMASK1(6)
1508c2ecf20Sopenharmony_ci#define M_DUART_RCVD_BRK	    _SB_MAKEMASK1(7)
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci/*
1538c2ecf20Sopenharmony_ci * DUART Baud Rate Register (Table 10-7)
1548c2ecf20Sopenharmony_ci * Register: DUART_CLK_SEL_A
1558c2ecf20Sopenharmony_ci * Register: DUART_CLK_SEL_B
1568c2ecf20Sopenharmony_ci */
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci#define M_DUART_CLK_COUNTER	    _SB_MAKEMASK(12, 0)
1598c2ecf20Sopenharmony_ci#define V_DUART_BAUD_RATE(x)	    (100000000/((x)*20)-1)
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci/*
1628c2ecf20Sopenharmony_ci * DUART Data Registers (Table 10-8 and 10-9)
1638c2ecf20Sopenharmony_ci * Register: DUART_RX_HOLD_A
1648c2ecf20Sopenharmony_ci * Register: DUART_RX_HOLD_B
1658c2ecf20Sopenharmony_ci * Register: DUART_TX_HOLD_A
1668c2ecf20Sopenharmony_ci * Register: DUART_TX_HOLD_B
1678c2ecf20Sopenharmony_ci */
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ci#define M_DUART_RX_DATA		    _SB_MAKEMASK(8, 0)
1708c2ecf20Sopenharmony_ci#define M_DUART_TX_DATA		    _SB_MAKEMASK(8, 0)
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci/*
1738c2ecf20Sopenharmony_ci * DUART Input Port Register (Table 10-10)
1748c2ecf20Sopenharmony_ci * Register: DUART_IN_PORT
1758c2ecf20Sopenharmony_ci */
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci#define M_DUART_IN_PIN0_VAL	    _SB_MAKEMASK1(0)
1788c2ecf20Sopenharmony_ci#define M_DUART_IN_PIN1_VAL	    _SB_MAKEMASK1(1)
1798c2ecf20Sopenharmony_ci#define M_DUART_IN_PIN2_VAL	    _SB_MAKEMASK1(2)
1808c2ecf20Sopenharmony_ci#define M_DUART_IN_PIN3_VAL	    _SB_MAKEMASK1(3)
1818c2ecf20Sopenharmony_ci#define M_DUART_IN_PIN4_VAL	    _SB_MAKEMASK1(4)
1828c2ecf20Sopenharmony_ci#define M_DUART_IN_PIN5_VAL	    _SB_MAKEMASK1(5)
1838c2ecf20Sopenharmony_ci#define M_DUART_RIN0_PIN	    _SB_MAKEMASK1(6)
1848c2ecf20Sopenharmony_ci#define M_DUART_RIN1_PIN	    _SB_MAKEMASK1(7)
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci/*
1878c2ecf20Sopenharmony_ci * DUART Input Port Change Status Register (Tables 10-11, 10-12, and 10-13)
1888c2ecf20Sopenharmony_ci * Register: DUART_INPORT_CHNG
1898c2ecf20Sopenharmony_ci */
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_ci#define S_DUART_IN_PIN_VAL	    0
1928c2ecf20Sopenharmony_ci#define M_DUART_IN_PIN_VAL	    _SB_MAKEMASK(4, S_DUART_IN_PIN_VAL)
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_ci#define S_DUART_IN_PIN_CHNG	    4
1958c2ecf20Sopenharmony_ci#define M_DUART_IN_PIN_CHNG	    _SB_MAKEMASK(4, S_DUART_IN_PIN_CHNG)
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_ci/*
1998c2ecf20Sopenharmony_ci * DUART Output port control register (Table 10-14)
2008c2ecf20Sopenharmony_ci * Register: DUART_OPCR
2018c2ecf20Sopenharmony_ci */
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci#define M_DUART_OPCR_RESERVED0	    _SB_MAKEMASK1(0)   /* must be zero */
2048c2ecf20Sopenharmony_ci#define M_DUART_OPC2_SEL	    _SB_MAKEMASK1(1)
2058c2ecf20Sopenharmony_ci#define M_DUART_OPCR_RESERVED1	    _SB_MAKEMASK1(2)   /* must be zero */
2068c2ecf20Sopenharmony_ci#define M_DUART_OPC3_SEL	    _SB_MAKEMASK1(3)
2078c2ecf20Sopenharmony_ci#define M_DUART_OPCR_RESERVED2	    _SB_MAKEMASK(4, 4)	/* must be zero */
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci/*
2108c2ecf20Sopenharmony_ci * DUART Aux Control Register (Table 10-15)
2118c2ecf20Sopenharmony_ci * Register: DUART_AUX_CTRL
2128c2ecf20Sopenharmony_ci */
2138c2ecf20Sopenharmony_ci
2148c2ecf20Sopenharmony_ci#define M_DUART_IP0_CHNG_ENA	    _SB_MAKEMASK1(0)
2158c2ecf20Sopenharmony_ci#define M_DUART_IP1_CHNG_ENA	    _SB_MAKEMASK1(1)
2168c2ecf20Sopenharmony_ci#define M_DUART_IP2_CHNG_ENA	    _SB_MAKEMASK1(2)
2178c2ecf20Sopenharmony_ci#define M_DUART_IP3_CHNG_ENA	    _SB_MAKEMASK1(3)
2188c2ecf20Sopenharmony_ci#define M_DUART_ACR_RESERVED	    _SB_MAKEMASK(4, 4)
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_ci#define M_DUART_CTS_CHNG_ENA	    _SB_MAKEMASK1(0)
2218c2ecf20Sopenharmony_ci#define M_DUART_CIN_CHNG_ENA	    _SB_MAKEMASK1(2)
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_ci/*
2248c2ecf20Sopenharmony_ci * DUART Interrupt Status Register (Table 10-16)
2258c2ecf20Sopenharmony_ci * Register: DUART_ISR
2268c2ecf20Sopenharmony_ci */
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci#define M_DUART_ISR_TX_A	    _SB_MAKEMASK1(0)
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_ci#define S_DUART_ISR_RX_A	    1
2318c2ecf20Sopenharmony_ci#define M_DUART_ISR_RX_A	    _SB_MAKEMASK1(S_DUART_ISR_RX_A)
2328c2ecf20Sopenharmony_ci#define V_DUART_ISR_RX_A(x)	    _SB_MAKEVALUE(x, S_DUART_ISR_RX_A)
2338c2ecf20Sopenharmony_ci#define G_DUART_ISR_RX_A(x)	    _SB_GETVALUE(x, S_DUART_ISR_RX_A, M_DUART_ISR_RX_A)
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ci#define M_DUART_ISR_BRK_A	    _SB_MAKEMASK1(2)
2368c2ecf20Sopenharmony_ci#define M_DUART_ISR_IN_A	    _SB_MAKEMASK1(3)
2378c2ecf20Sopenharmony_ci#define M_DUART_ISR_ALL_A	    _SB_MAKEMASK(4, 0)
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_ci#define M_DUART_ISR_TX_B	    _SB_MAKEMASK1(4)
2408c2ecf20Sopenharmony_ci#define M_DUART_ISR_RX_B	    _SB_MAKEMASK1(5)
2418c2ecf20Sopenharmony_ci#define M_DUART_ISR_BRK_B	    _SB_MAKEMASK1(6)
2428c2ecf20Sopenharmony_ci#define M_DUART_ISR_IN_B	    _SB_MAKEMASK1(7)
2438c2ecf20Sopenharmony_ci#define M_DUART_ISR_ALL_B	    _SB_MAKEMASK(4, 4)
2448c2ecf20Sopenharmony_ci
2458c2ecf20Sopenharmony_ci/*
2468c2ecf20Sopenharmony_ci * DUART Channel A Interrupt Status Register (Table 10-17)
2478c2ecf20Sopenharmony_ci * DUART Channel B Interrupt Status Register (Table 10-18)
2488c2ecf20Sopenharmony_ci * Register: DUART_ISR_A
2498c2ecf20Sopenharmony_ci * Register: DUART_ISR_B
2508c2ecf20Sopenharmony_ci */
2518c2ecf20Sopenharmony_ci
2528c2ecf20Sopenharmony_ci#define M_DUART_ISR_TX		    _SB_MAKEMASK1(0)
2538c2ecf20Sopenharmony_ci#define M_DUART_ISR_RX		    _SB_MAKEMASK1(1)
2548c2ecf20Sopenharmony_ci#define M_DUART_ISR_BRK		    _SB_MAKEMASK1(2)
2558c2ecf20Sopenharmony_ci#define M_DUART_ISR_IN		    _SB_MAKEMASK1(3)
2568c2ecf20Sopenharmony_ci#define M_DUART_ISR_ALL		    _SB_MAKEMASK(4, 0)
2578c2ecf20Sopenharmony_ci#define M_DUART_ISR_RESERVED	    _SB_MAKEMASK(4, 4)
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_ci/*
2608c2ecf20Sopenharmony_ci * DUART Interrupt Mask Register (Table 10-19)
2618c2ecf20Sopenharmony_ci * Register: DUART_IMR
2628c2ecf20Sopenharmony_ci */
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_ci#define M_DUART_IMR_TX_A	    _SB_MAKEMASK1(0)
2658c2ecf20Sopenharmony_ci#define M_DUART_IMR_RX_A	    _SB_MAKEMASK1(1)
2668c2ecf20Sopenharmony_ci#define M_DUART_IMR_BRK_A	    _SB_MAKEMASK1(2)
2678c2ecf20Sopenharmony_ci#define M_DUART_IMR_IN_A	    _SB_MAKEMASK1(3)
2688c2ecf20Sopenharmony_ci#define M_DUART_IMR_ALL_A	    _SB_MAKEMASK(4, 0)
2698c2ecf20Sopenharmony_ci
2708c2ecf20Sopenharmony_ci#define M_DUART_IMR_TX_B	    _SB_MAKEMASK1(4)
2718c2ecf20Sopenharmony_ci#define M_DUART_IMR_RX_B	    _SB_MAKEMASK1(5)
2728c2ecf20Sopenharmony_ci#define M_DUART_IMR_BRK_B	    _SB_MAKEMASK1(6)
2738c2ecf20Sopenharmony_ci#define M_DUART_IMR_IN_B	    _SB_MAKEMASK1(7)
2748c2ecf20Sopenharmony_ci#define M_DUART_IMR_ALL_B	    _SB_MAKEMASK(4, 4)
2758c2ecf20Sopenharmony_ci
2768c2ecf20Sopenharmony_ci/*
2778c2ecf20Sopenharmony_ci * DUART Channel A Interrupt Mask Register (Table 10-20)
2788c2ecf20Sopenharmony_ci * DUART Channel B Interrupt Mask Register (Table 10-21)
2798c2ecf20Sopenharmony_ci * Register: DUART_IMR_A
2808c2ecf20Sopenharmony_ci * Register: DUART_IMR_B
2818c2ecf20Sopenharmony_ci */
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_ci#define M_DUART_IMR_TX		    _SB_MAKEMASK1(0)
2848c2ecf20Sopenharmony_ci#define M_DUART_IMR_RX		    _SB_MAKEMASK1(1)
2858c2ecf20Sopenharmony_ci#define M_DUART_IMR_BRK		    _SB_MAKEMASK1(2)
2868c2ecf20Sopenharmony_ci#define M_DUART_IMR_IN		    _SB_MAKEMASK1(3)
2878c2ecf20Sopenharmony_ci#define M_DUART_IMR_ALL		    _SB_MAKEMASK(4, 0)
2888c2ecf20Sopenharmony_ci#define M_DUART_IMR_RESERVED	    _SB_MAKEMASK(4, 4)
2898c2ecf20Sopenharmony_ci
2908c2ecf20Sopenharmony_ci
2918c2ecf20Sopenharmony_ci/*
2928c2ecf20Sopenharmony_ci * DUART Output Port Set Register (Table 10-22)
2938c2ecf20Sopenharmony_ci * Register: DUART_SET_OPR
2948c2ecf20Sopenharmony_ci */
2958c2ecf20Sopenharmony_ci
2968c2ecf20Sopenharmony_ci#define M_DUART_SET_OPR0	    _SB_MAKEMASK1(0)
2978c2ecf20Sopenharmony_ci#define M_DUART_SET_OPR1	    _SB_MAKEMASK1(1)
2988c2ecf20Sopenharmony_ci#define M_DUART_SET_OPR2	    _SB_MAKEMASK1(2)
2998c2ecf20Sopenharmony_ci#define M_DUART_SET_OPR3	    _SB_MAKEMASK1(3)
3008c2ecf20Sopenharmony_ci#define M_DUART_OPSR_RESERVED	    _SB_MAKEMASK(4, 4)
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_ci/*
3038c2ecf20Sopenharmony_ci * DUART Output Port Clear Register (Table 10-23)
3048c2ecf20Sopenharmony_ci * Register: DUART_CLEAR_OPR
3058c2ecf20Sopenharmony_ci */
3068c2ecf20Sopenharmony_ci
3078c2ecf20Sopenharmony_ci#define M_DUART_CLR_OPR0	    _SB_MAKEMASK1(0)
3088c2ecf20Sopenharmony_ci#define M_DUART_CLR_OPR1	    _SB_MAKEMASK1(1)
3098c2ecf20Sopenharmony_ci#define M_DUART_CLR_OPR2	    _SB_MAKEMASK1(2)
3108c2ecf20Sopenharmony_ci#define M_DUART_CLR_OPR3	    _SB_MAKEMASK1(3)
3118c2ecf20Sopenharmony_ci#define M_DUART_OPCR_RESERVED	    _SB_MAKEMASK(4, 4)
3128c2ecf20Sopenharmony_ci
3138c2ecf20Sopenharmony_ci/*
3148c2ecf20Sopenharmony_ci * DUART Output Port RTS Register (Table 10-24)
3158c2ecf20Sopenharmony_ci * Register: DUART_OUT_PORT
3168c2ecf20Sopenharmony_ci */
3178c2ecf20Sopenharmony_ci
3188c2ecf20Sopenharmony_ci#define M_DUART_OUT_PIN_SET0	    _SB_MAKEMASK1(0)
3198c2ecf20Sopenharmony_ci#define M_DUART_OUT_PIN_SET1	    _SB_MAKEMASK1(1)
3208c2ecf20Sopenharmony_ci#define M_DUART_OUT_PIN_CLR0	    _SB_MAKEMASK1(2)
3218c2ecf20Sopenharmony_ci#define M_DUART_OUT_PIN_CLR1	    _SB_MAKEMASK1(3)
3228c2ecf20Sopenharmony_ci#define M_DUART_OPRR_RESERVED	    _SB_MAKEMASK(4, 4)
3238c2ecf20Sopenharmony_ci
3248c2ecf20Sopenharmony_ci#define M_DUART_OUT_PIN_SET(chan) \
3258c2ecf20Sopenharmony_ci    (chan == 0 ? M_DUART_OUT_PIN_SET0 : M_DUART_OUT_PIN_SET1)
3268c2ecf20Sopenharmony_ci#define M_DUART_OUT_PIN_CLR(chan) \
3278c2ecf20Sopenharmony_ci    (chan == 0 ? M_DUART_OUT_PIN_CLR0 : M_DUART_OUT_PIN_CLR1)
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ci#if SIBYTE_HDR_FEATURE(1250, PASS2) || SIBYTE_HDR_FEATURE(112x, PASS1) || SIBYTE_HDR_FEATURE_CHIP(1480)
3308c2ecf20Sopenharmony_ci/*
3318c2ecf20Sopenharmony_ci * Full Interrupt Control Register
3328c2ecf20Sopenharmony_ci */
3338c2ecf20Sopenharmony_ci
3348c2ecf20Sopenharmony_ci#define S_DUART_SIG_FULL	   _SB_MAKE64(0)
3358c2ecf20Sopenharmony_ci#define M_DUART_SIG_FULL	   _SB_MAKEMASK(4, S_DUART_SIG_FULL)
3368c2ecf20Sopenharmony_ci#define V_DUART_SIG_FULL(x)	   _SB_MAKEVALUE(x, S_DUART_SIG_FULL)
3378c2ecf20Sopenharmony_ci#define G_DUART_SIG_FULL(x)	   _SB_GETVALUE(x, S_DUART_SIG_FULL, M_DUART_SIG_FULL)
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ci#define S_DUART_INT_TIME	   _SB_MAKE64(4)
3408c2ecf20Sopenharmony_ci#define M_DUART_INT_TIME	   _SB_MAKEMASK(4, S_DUART_INT_TIME)
3418c2ecf20Sopenharmony_ci#define V_DUART_INT_TIME(x)	   _SB_MAKEVALUE(x, S_DUART_INT_TIME)
3428c2ecf20Sopenharmony_ci#define G_DUART_INT_TIME(x)	   _SB_GETVALUE(x, S_DUART_INT_TIME, M_DUART_INT_TIME)
3438c2ecf20Sopenharmony_ci#endif /* 1250 PASS2 || 112x PASS1 || 1480 */
3448c2ecf20Sopenharmony_ci
3458c2ecf20Sopenharmony_ci
3468c2ecf20Sopenharmony_ci/* ********************************************************************** */
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_ci
3498c2ecf20Sopenharmony_ci#endif
350