Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:43

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  * @ingroup RTEMSBSPsLM32Shared lm32_uart
0006  * @brief LatticeMico32 UART definitions
0007  */
0008 
0009 /*
0010  *  This file contains definitions for LatticeMico32 UART
0011  *
0012  *  COPYRIGHT (c) 1989-1999.
0013  *  On-Line Applications Research Corporation (OAR).
0014  *
0015  * Redistribution and use in source and binary forms, with or without
0016  * modification, are permitted provided that the following conditions
0017  * are met:
0018  * 1. Redistributions of source code must retain the above copyright
0019  *    notice, this list of conditions and the following disclaimer.
0020  * 2. Redistributions in binary form must reproduce the above copyright
0021  *    notice, this list of conditions and the following disclaimer in the
0022  *    documentation and/or other materials provided with the distribution.
0023  *
0024  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0025  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0026  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0027  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0028  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0029  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0030  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0031  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0032  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0033  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0034  * POSSIBILITY OF SUCH DAMAGE.
0035  *
0036  *  Jukka Pietarinen <jukka.pietarinen@mrf.fi>, 2008,
0037  *  Micro-Research Finland Oy
0038  */
0039 
0040 /**
0041  * @defgroup lm32_uart LM32 UART
0042  * @ingroup RTEMSBSPsLM32Shared
0043  * @brief LatticeMico32 UART definitions
0044  * @{
0045  */
0046 
0047 #ifndef _BSPUART_H
0048 #define _BSPUART_H
0049 
0050 void BSP_uart_init(int baud);
0051 
0052 /* Receive buffer register / transmit holding register */
0053 
0054 #define LM32_UART_RBR      (0x0000)
0055 
0056 /* Interrupt enable register */
0057 
0058 #define LM32_UART_IER      (0x0004)
0059 #define LM32_UART_IER_RBRI (0x0001)
0060 #define LM32_UART_IER_THRI (0x0002)
0061 #define LM32_UART_IER_RLSI (0x0004)
0062 #define LM32_UART_IER_MSI  (0x0008)
0063 
0064 /* Interrupt identification register */
0065 
0066 #define LM32_UART_IIR      (0x0008)
0067 #define LM32_UART_IIR_STAT (0x0001)
0068 #define LM32_UART_IIR_ID0  (0x0002)
0069 #define LM32_UART_IIR_ID1  (0x0004)
0070 
0071 /* Line control register */
0072 
0073 #define LM32_UART_LCR      (0x000C)
0074 #define LM32_UART_LCR_WLS0 (0x0001)
0075 #define LM32_UART_LCR_WLS1 (0x0002)
0076 #define LM32_UART_LCR_STB  (0x0004)
0077 #define LM32_UART_LCR_PEN  (0x0008)
0078 #define LM32_UART_LCR_EPS  (0x0010)
0079 #define LM32_UART_LCR_SP   (0x0020)
0080 #define LM32_UART_LCR_SB   (0x0040)
0081 #define LM32_UART_LCR_5BIT (0)
0082 #define LM32_UART_LCR_6BIT (LM32_UART_LCR_WLS0)
0083 #define LM32_UART_LCR_7BIT (LM32_UART_LCR_WLS1)
0084 #define LM32_UART_LCR_8BIT (LM32_UART_LCR_WLS1 | LM32_UART_LCR_WLS0)
0085 
0086 /* Modem control register */
0087 
0088 #define LM32_UART_MCR      (0x0010)
0089 #define LM32_UART_MCR_DTR  (0x0001)
0090 #define LM32_UART_MCR_RTS  (0x0002)
0091 
0092 /* Line status register */
0093 
0094 #define LM32_UART_LSR      (0x0014)
0095 #define LM32_UART_LSR_DR   (0x0001)
0096 #define LM32_UART_LSR_OE   (0x0002)
0097 #define LM32_UART_LSR_PE   (0x0004)
0098 #define LM32_UART_LSR_FE   (0x0008)
0099 #define LM32_UART_LSR_BI   (0x0010)
0100 #define LM32_UART_LSR_THRE (0x0020)
0101 #define LM32_UART_LSR_TEMT (0x0040)
0102 
0103 /* Modem status register */
0104 
0105 #define LM32_UART_MSR      (0x0018)
0106 #define LM32_UART_MSR_DCTS (0x0001)
0107 #define LM32_UART_MSR_DDSR (0x0002)
0108 #define LM32_UART_MSR_TERI (0x0004)
0109 #define LM32_UART_MSR_DDCD (0x0008)
0110 #define LM32_UART_MSR_CTS  (0x0010)
0111 #define LM32_UART_MSR_DSR  (0x0020)
0112 #define LM32_UART_MSR_RI   (0x0040)
0113 #define LM32_UART_MSR_DCD  (0x0000)
0114 
0115 /* Baud-rate divisor register */
0116 
0117 #define LM32_UART_DIV      (0x001C)
0118 
0119 #endif /* _BSPUART_H */
0120 
0121 /** @} */