www.pudn.com > writemac.rar > dm643_uart.h


/* 
 *  Copyright 2003 by Spectrum Digital Incorporated. 
 *  All rights reserved. Property of Spectrum Digital Incorporated. 
 */ 
  
/* 
 *  ======== dm643_uart.h ======== 
 * 
 *  UART interface on the DM643 
 */ 
#ifndef DM643_UART_ 
#define DM643_UART_ 
 
#ifdef __cplusplus 
extern "C" { 
#endif 
 
#include  
 
#define DM643_UART_CONFIGREGS      4 
#define DM643_UART_BASEADDR        0x9c00 
#define DM643_UART_RBR             0x00  // Read 
#define DM643_UART_THR             0x00  // Write 
#define DM643_UART_IER             0x01 
#define DM643_UART_IIR             0x02  // Read 
#define DM643_UART_FCR             0x02  // Write 
#define DM643_UART_LCR             0x03 
#define DM643_UART_MCR             0x04 
#define DM643_UART_LSR             0x05 
#define DM643_UART_SCR             0x07 
 
#define DM643_UART_DLL             0x08 
#define DM643_UART_DLH             0x09 
#define DM643_UART_EFR             0x0A 
#define DM643_UART_XON1            0x0C 
#define DM643_UART_XON2            0x0D 
#define DM643_UART_XOFF1           0x0E 
#define DM643_UART_XOFF2           0x0F 
 
#define DM643_UART_TCR             0x16 
#define DM643_UART_TLR             0x17 
 
#define DM643_UART_FIFORDY         0x1f 
 
#define DM643_UARTA                0 
#define DM643_UARTB                1 
 
#define DM643_UART_BAUD115200     0x010 
#define DM643_UART_BAUD57600      0x020 
#define DM643_UART_BAUD38400      0x030 
#define DM643_UART_BAUD19200      0x060 
#define DM643_UART_BAUD9600       0x0c0 
#define DM643_UART_BAUD4800       0x180 
#define DM643_UART_BAUD2400       0x300 
#define DM643_UART_BAUD1200       0x600 
 
/* UART handle */ 
typedef Int16 DM643_UART_Handle; 
 
/* Config structure for the DM643 UART */ 
typedef struct DM643_UART_Config { 
    int regs[DM643_UART_CONFIGREGS]; 
} DM643_UART_Config; 
 
/* Set a UART register */ 
extern void DM643_UART_rset(DM643_UART_Handle hUart, Int16 regnum, Int16 regval); 
 
/* Get the value of a UART register */ 
extern Int16 DM643_UART_rget(DM643_UART_Handle hUart, Int16 regnum); 
 
/* Initialize UART and return handle */ 
extern Int16 DM643_UART_open(Int16 devid, Int16 baudrate, DM643_UART_Config *Config); 
 
/* Get one character of data from the UART */ 
extern Int16 DM643_UART_getChar(DM643_UART_Handle hUart); 
 
/* Send one character of data to the UART */ 
extern void DM643_UART_putChar(DM643_UART_Handle hUart, Uint16 data); 
 
#ifdef __cplusplus 
} 
#endif 
 
#endif