⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serial_ti16550_api.h

📁 MIPS下的boottloader yamon 的源代码
💻 H
字号:

/************************************************************************
 *
 *      SERIAL_TI16550_api.h
 *
 *      The 'SERIAL_TI16550_api' module defines the specific public
 *      interface for the TI16550 serial device driver. The
 *      generic serial device driver interface is defined in the
 *      'serial_api' module, which is supported by this driver.
 *
 *      The specific public interface comprise:
 *
 *        1) SERIAL_TI16550_install: installs the 'serial' device driver
 *           services into the 'io' system.
 *
 *
 *
 * ######################################################################
 *
 * Copyright (c) 1999-2000 MIPS Technologies, Inc. All rights reserved. 
 * 
 * Unpublished rights reserved under the Copyright Laws of the United States of 
 * America. 
 * 
 * This document contains information that is proprietary to MIPS Technologies, 
 * Inc. ("MIPS Technologies"). Any copying, modifying or use of this information 
 * (in whole or in part) which is not expressly permitted in writing by MIPS 
 * Technologies or a contractually-authorized third party is strictly 
 * prohibited. At a minimum, this information is protected under unfair 
 * competition laws and the expression of the information contained herein is 
 * protected under federal copyright laws. Violations thereof may result in 
 * criminal penalties and fines. 
 * MIPS Technologies or any contractually-authorized third party reserves the 
 * right to change the information contained in this document to improve 
 * function, design or otherwise. MIPS Technologies does not assume any 
 * liability arising out of the application or use of this information. Any 
 * license under patent rights or any other intellectual property rights owned 
 * by MIPS Technologies or third parties shall be conveyed by MIPS Technologies 
 * or any contractually-authorized third party in a separate license agreement 
 * between the parties. 
 * The information contained in this document constitutes one or more of the 
 * following: commercial computer software, commercial computer software 
 * documentation or other commercial items. If the user of this information, or 
 * any related documentation of any kind, including related technical data or 
 * manuals, is an agency, department, or other entity of the United States 
 * government ("Government"), the use, duplication, reproduction, release, 
 * modification, disclosure, or transfer of this information, or any related 
 * documentation of any kind, is restricted in accordance with Federal 
 * Acquisition Regulation 12.212 for civilian agencies and Defense Federal 
 * Acquisition Regulation Supplement 227.7202 for military agencies. The use of 
 * this information by the Government is further restricted in accordance with 
 * the terms of the license agreement(s) and/or applicable contract terms and 
 * conditions covering this information from MIPS Technologies or any 
 * contractually-authorized third party. 
 *
 ************************************************************************/

#ifndef SERIAL_TI16550_API_H
#define SERIAL_TI16550_API_H

/************************************************************************
 *    Include files
 ************************************************************************/

#include <sysdefs.h>


/************************************************************************
 *  Definitions
*************************************************************************/

/* Offset addresses for the TI16550 UART mapped into 8-bit access    */
#define SERIAL_TI16550_RBR_OFS   0    /* Receiver Buffer             */
#define SERIAL_TI16550_THR_OFS   1    /* Transmitter Holding         */
#define SERIAL_TI16550_IER_OFS   2    /* Interrupt enable            */
#define SERIAL_TI16550_IIR_OFS   3    /* Interrupt identification    */
#define SERIAL_TI16550_FCR_OFS   4    /* FIFO control                */
#define SERIAL_TI16550_LCR_OFS   5    /* Line control                */
#define SERIAL_TI16550_MCR_OFS   6    /* Modem control               */
#define SERIAL_TI16550_LSR_OFS   7    /* Line status                 */
#define SERIAL_TI16550_MSR_OFS   8    /* Modem status                */
#define SERIAL_TI16550_SCR_OFS   10    /* Scratch                     */
#define SERIAL_TI16550_DLL_OFS   10    /* Divisor latch LSB           */
#define SERIAL_TI16550_DLM_OFS   10    /* Divisor latch MSB           */

/* IER mask */
#define SERIAL_IER_RCVEN         0x01    /* receive interrupt enable    */

/* FCR control */
#define SERIAL_FCR_ENABLE        0x01    /* enable FIFO's               */
#define SERIAL_FCR_RCVR_RESET    0x02    /* reset receiver FIFO         */
#define SERIAL_FCR_TXMT_RESET    0x04    /* reset transmit FIFO         */
#define SERIAL_FCR_RCVFIFO_1     0x00    /* receive FIFO threshold 1    */
#define SERIAL_FCR_RCVFIFO_4     0x40    /* receive FIFO threshold 4    */
#define SERIAL_FCR_RCVFIFO_8     0x80    /* receive FIFO threshold 8    */
#define SERIAL_FCR_RCVFIFO_14    0xc0    /* receive FIFO threshold 14   */

/* LCR control */
#define SERIAL_LCR_DATA5         0x00    /* 5-bit character             */
#define SERIAL_LCR DATA6         0x01    /* 6-bit character             */
#define SERIAL_LCR_DATA7         0x02    /* 7-bit character             */
#define SERIAL_LCR_DATA8         0x03    /* 8-bit character             */
#define SERIAL_LCR_DATA_MSK      0x03    /* MASK for data field         */

#define SERIAL_LCR_STOP1         0x00    /* 1 stop bit                  */
#define SERIAL_LCR_STOP15        0x04    /* 1.5 stop bit, if data is 5-bit */
#define SERIAL_LCR_STOP2         0x04    /* 2 stop bit                  */
#define SERIAL_LCR_STOP_MSK      0x04    /* MASK for stop bit field     */

#define SERIAL_LCR_PARITYNONE    0x00    /* No parity                   */
#define SERIAL_LCR_PARITYODD     0x08    /* Odd parity                  */
#define SERIAL_LCR_PARITYEVEN    0x18    /* Even parity                 */
#define SERIAL_LCR_PARITYMARK    0x28    /* Mark parity                 */
#define SERIAL_LCR_PARITYSPACE   0x38    /* Space parity                */
#define SERIAL_LCR_PARITY_MASK   0x38    /* MASK for parity field       */

#define SERIAL_LCR_BREAK         0x40    /* request to send a 'break'   */
#define SERIAL_LCR_DLAB          0x80    /* enable divisor latch registers */

/* MCR control */
#define SERIAL_MCR_DTR           0x01    /* Data Terminal Ready         */
#define SERIAL_MCR_RTS           0x02    /* Request To Send             */
#define SERIAL_MCR_OUT1          0x04    /* General purpose output      */
#define SERIAL_MCR_OUT2          0x08    /* General purpose output      */

#define SERIAL_MCR_LOOP          0x10    /* Local loop back             */
#define SERIAL_MCR_AFE           0x20    /* Auto-flow control enable    */

/* LSR status */
#define SERIAL_LSR_DR            0x01    /* Character ready             */
#define SERIAL_LSR_OE            0x02    /* RX-ERROR: Overrun           */
#define SERIAL_LSR_PE            0x04    /* RX-ERROR: Parity            */
#define SERIAL_LSR_FE            0x08    /* RX-ERROR: Framing (stop bit)*/
#define SERIAL_LSR_BI            0x10    /* 'BREAK' detected            */
#define SERIAL_LSR_THRE          0x20    /* Transmit Holding empty      */
#define SERIAL_LSR_TEMT          0x40    /* Transmitter empty (IDLE)    */
#define SERIAL_LSR_FIFOERR       0x80    /* RX-ERROR: FIFO              */


/* MSR status */
#define SERIAL_MSR_DCTS          0x01    /* Delta clear to send         */
#define SERIAL_MSR_DDSR          0x02    /* Delta data set ready        */
#define SERIAL_MSR_TERI          0x04    /* Trailing edge ring ind.     */
#define SERIAL_MSR_DDCD          0x08    /* Delta data carrier detect   */
#define SERIAL_MSR_CTS           0x10    /* Clear to send               */
#define SERIAL_MSR_DSR           0x20    /* Data Set Ready              */
#define SERIAL_MSR_RI            0x40    /* Ring Indicator              */
#define SERIAL_MSR_DCD           0x80    /* Data carrier detect         */


/************************************************************************
 *   Public functions
 ************************************************************************/

/************************************************************************
 *
 *                          SERIAL_TI16550_install
 *  Description :
 *  -------------
 *
 *  Installs the serial TI16550 device drivers services in 
 *  the IO system at the reserved device slot, found in the
 *  'sys_dev.h' file, which defines all major device numbers.
 *
 *  Note:
 *  This service is the only public declared interface function; all
 *  provided device driver services are static declared, but this
 *  function installs the function pointers in the io-system to
 *  enable the provided public driver services.
 *
 *  Parameters :
 *  ------------
 *
 *  -
 *
 *
 *  Return values :
 *  ---------------
 *
 *  'OK'(=0)
 *  'ERROR_IO_ILLEGAL_MAJOR':  Illegal major device number
 *  'ERROR_IO_NO_SPACE':       Device slot already allocated
 *
 ************************************************************************/
INT32 SERIAL_TI16550_install( void );



#endif /* #ifndef SERIAL_TI16550_API_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -