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

📄 davincihd_uart.h

📁 用于dm6467 开发平台的uboot源码
💻 H
字号:
/*
 *  Copyright 2007 by Spectrum Digital Incorporated.
 *  All rights reserved. Property of Spectrum Digital Incorporated.
 */

/*
 *  UART Header file
 *
 */

#ifndef UART_
#define UART_

#ifdef __cplusplus
extern "C" {
#endif

#include "davincihd.h"

/* ------------------------------------------------------------------------ *
 *  UART IDs                                                                *
 * ------------------------------------------------------------------------ */
#define UART_0                  ( 0 )
#define UART_1                  ( 1 )
#define UART_2                  ( 2 )

/* ------------------------------------------------------------------------ *
 *  UART Controller                                                         *
 * ------------------------------------------------------------------------ */
#define UART0_BASE              0x01c20000
#define UART1_BASE              0x01c20400
#define UART2_BASE              0x01c20800

/* ------------------------------------------------------------------------ *
 *  UART regs                                                               *
 * ------------------------------------------------------------------------ */
#define RHR                     0x0  // Read only
#define THR                     0x0  // Write only
#define IER                     0x4  // To Access: EFR[4]=1
#define IIR                     0x8  // Read only
#define FCR                     0x8  // Write only - To Access: EFR[4]=1
#define LCR                     0xc
#define MCR                     0x10 // To Access: EFR[4]=1
#define LSR                     0x14 // Read only
#define MSR                     0x18 // Read only
#define TCR                     0x18 // To Access: EFR[4]=1 & MCR[6]=1
#define TLR                     0x1c // To Access: EFR[4]=1 & MCR[6]=1
#define SPR                     0x1c
#define MDR1                    0x20
#define MDR2                    0x24
#define SFLSR                   0x28 // Read only
#define TXFLL                   0x28 // Write only
#define RESUME                  0x2c // Read only
#define TXFLH                   0x2c // Write only
#define SFREGL                  0x30 // Read only
#define RXFLL                   0x30 // Write only
#define SFREGH                  0x34 // Read only
#define RXFLH                   0x34 // Write only
#define BLR                     0x38
#define ACREG                   0x3c
#define SCR                     0x40
#define SSR                     0x44 // Read only
#define EBLR                    0x48
#define MVR                     0x4c // Read only
#define SYSC                    0x50
#define SYSS                    0x54
#define WER                     0x58
#define CFPS                    0x5c

/* ------------------------------------------------------------------------ *
 *  Control Registers for: UART Registers minus Base Address (  )           *
 *  These Registers are available with "LCR[bit 7] = 1"                     *
 * ------------------------------------------------------------------------ */
#define USE_LCR_80              ( 0x100 )
#define DLL                     ( USE_LCR_80 + 0x0 )
#define DLH                     ( USE_LCR_80 + 0x4 )
#define UASR                    ( USE_LCR_80 + 0x38 )

/* ------------------------------------------------------------------------ *
 *  Control Registers for: UART Registers minus Base Address (  )           *
 * These Registers are available with "LCR = 0xBF"                          *
 * ------------------------------------------------------------------------ */
#define USE_LCR_BF              ( 0x200 )
#define EFR                     ( USE_LCR_BF + 0x8 )
#define XON1                    ( USE_LCR_BF + 0x10 )
#define XON2                    ( USE_LCR_BF + 0x14 )
#define XOFF1                   ( USE_LCR_BF + 0x18 )
#define XOFF2                   ( USE_LCR_BF + 0x1c )

/* ------------------------------------------------------------------------ *
 *  UART Handle                                                             *
 * ------------------------------------------------------------------------ */
typedef Uint32 UART_Handle;

/* ------------------------------------------------------------------------ *
 *  Prototypes                                                              *
 * ------------------------------------------------------------------------ */
UART_Handle DAVINCIHD_UART_open( Uint16 id, Uint32 baudrate );
Int16       DAVINCIHD_UART_close( UART_Handle uart );

Int16 DAVINCIHD_UART_xmtReady( UART_Handle uart );
Int16 DAVINCIHD_UART_rcvReady( UART_Handle uart );

Int16 DAVINCIHD_UART_putChar( UART_Handle uart, Uint8 data );
Int16 DAVINCIHD_UART_getChar( UART_Handle uart, Uint8* data );

Uint32 _UART_rget( UART_Handle uart, Uint32 reg );
void _UART_rset( UART_Handle uart, Uint32 reg, Uint32 reg_value );

#ifdef __cplusplus
}
#endif

#endif

⌨️ 快捷键说明

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