📄 c501uart.h
字号:
/* -*-C-*- * * $Revision: $ * $Author: $ * $Date: $ * * Copyright (c) 1996 Advanced RISC Machines Limited. * All Rights Reserved. * * Project: ANGEL * * Title: KS32C50100 UART register definitions */#ifndef c501uart_h#define c501uart_h/* A and B correspond to UART0 and UART1, but B is the default angel port. This affects most of the files in this target directory */#define C501UART_IDENT_A 1#define C501UART_IDENT_B 0/* * Layout of the Serial controller */typedef struct C501UARTReg{ volatile unsigned int ulcon; /* R/W */ volatile unsigned int ucon; /* R/W */ volatile unsigned int ustat; /* RO */ volatile unsigned int utxbuf; /* WO */ volatile unsigned int urxbuf; /* RO */ volatile unsigned int ubrdiv; /* R/W */} C501UARTReg;/* * the Interrupt Enables are shared with other control functions: * be careful when playing with them! *//* Note: the uart will not function (transmit or receive) if not enabled for interrupt or DMA */#define IER_set(u, f) ((u)->ucon |= (f))#define IER_clr(u, f) ((u)->ucon &= ~(f))#define IER_reset(u) ((u)->ucon &= ~(UCRRxSI | UCRTxM | UCRRxM))/* * macros to control Interrupt Enable Register in various sensible ways */#define c501uart_EnableTxInterrupt(u) (IER_set((u), UCRTxM))#define c501uart_DisableTxInterrupt(u) (IER_clr((u), UCRTxM))#define c501uart_EnableRxInterrupt(u) (IER_set((u), UCRRxM | UCRRxSI))#define c501uart_DisableRxInterrupt(u) (IER_clr((u), UCRRxM | UCRRxSI))/* * macros to get and put serial characters */#define c501uart_SerGetChar(u) ((u)->urxbuf)#define c501uart_SerPutChar(u, c) ((u)->utxbuf = (c))#define c501uart_GetStatus(u) ((u)->ustat)#define c501uart_GetControlReg(u) ((u)->ucon)#define c501uart_SetControlReg(u, v) ((u)->ucon = (v))#define c501uart_SetLineControl(u, v) ((u)->ulcon = (v))#define c501uart_GetInterruptStatus(u) (c501uart_GetStatus(u) & (~USRDTR))#define c501uart_GetLineStatus(u) (c501uart_GetStatus(u) & (USROverrun | USRFraming | USRBreak))#define c501uart_SetBaudRate(u, v) ((u)->ubrdiv = (v))#define c501uart_ClearIntStatus(u) (NOT_DEFINED)#define c501uart_ClearModemInterrupt(u) (NOT_DEFINED)#define c501uart_GetFlags(u) (NOT_DEFINED)#define C501_BAUD_1200 (1301 << 4)#define C501_BAUD_2400 (650 << 4)#define C501_BAUD_4800 (324 << 4)#define C501_BAUD_9600 BAUD_9600#define C501_BAUD_19200 (80 << 4)#define C501_BAUD_38400 (40 << 4)#define C501_BAUD_57600 (26 << 4)#define C501_BAUD_115200 (13 << 4)#endif /* c501uart_h */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -