1 // Copyright (C) 2022 Beken Corporation 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #pragma once 16 17 #ifdef __cplusplus 18 extern "C" { 19 #endif 20 21 #define UART1_R_BASE (SOC_UART0_REG_BASE) 22 #define UART2_R_BASE (SOC_UART1_REG_BASE) 23 #define UART3_R_BASE (SOC_UART2_REG_BASE) 24 25 #define UART_F_CLK_DIV (BIT(8)) 26 #define UART_F_CLK_DIV_M 0x1fff 27 #define UART_F_CLK_DIV_V 0x1fff 28 #define UART_F_CLK_DIV_S 0x8 29 30 #define UART_V_MODE_UART 0x0 31 #define UART_V_MODE_IRDA 0x1 32 33 #define UART_V_PARITY_ODD 0x0 34 #define UART_V_PARITY_EVEN 0x1 35 36 #define UART_R_FIFO_STATUS (UART_R_BASE + 4 * 0x2) 37 38 #define UART_F_FIFO_WR_READY (BIT(20)) 39 #define UART_F_FIFO_WR_READY_M (BIT(20)) 40 #define UART_F_FIFO_WR_READY_V (0x1) 41 #define UART_F_FIFO_WR_READY_S (20) 42 43 #define UART_F_RX_FIFO_NEED_READ (BIT(1)) 44 #define UART_F_RX_STOP_END (BIT(6)) 45 46 #ifdef __cplusplus 47 } 48 #endif 49 50