📄 sci2407.h
字号:
/*--------------------------------------------------------*/
/* WQ21ST SOFTWARE STUDIO. */
/*--------------------------------------------------------*/
/*
* Onchip UART test include file
*
* This test requires a loopback connector
*
* filename: uart1.h
* original: 08/20/2001 by: WQ
* last update: 08/28/2001 by: WQ
*/
/*
* Baud Rate Calculations/Definitions
*/
/* #define BAUD_9600 0x0103 */
#define BAUD_9600 383
/* 29.4912 MHz SYSCLK */
/* baud = 29,491,200 /[383 + 1] * 8 */
/* baud = 29,491,200 / 384 * 8 */
/* baud = 29,491,200 / 3072 */
/* baud = 9600.000 */
/* % error = [9600-9600] /9600 */
/* % error = 0.0 */
/*----------for reference ------------*/
/* 20 MHz = 20 MHz SYSCLK */
/* baud = 20,000,000 /[259 + 1] * 8 */
/* baud = 20,000,000 / 260 * 8 */
/* baud = 20,000,000 / 2080 */
/* baud = 9615.384 */
/* % error = [9615-9600] /9600 */
/* % error = 15 / 9600 */
/* % error = 0.0015625 */
/********************************************************************/
/* Serial Communications Interface Module for C24X,243,2407 */
/********************************************************************/
struct sci
{
unsigned int ccr; /* 0x7050 in data space */
unsigned int ctl1; /* 0x7051 in data space */
unsigned int baud_hi; /* 0x7052 in data space */
unsigned int baud_lo; /* 0x7053 in data space */
unsigned int ctl2; /* 0x7054 in data space */
unsigned int rxst; /* 0x7055 in data space */
unsigned int rxemu; /* 0x7056 in data space */
unsigned int rxbuf; /* 0x7057 in data space */
unsigned int res1; /* 0x7058 in data space */
unsigned int txbuf; /* 0x7059 in data space */
unsigned int res2; /* 0x705a in data space */
unsigned int res3; /* 0x705b in data space */
unsigned int res4; /* 0x705c in data space */
unsigned int res5; /* 0x705d in data space */
unsigned int res6; /* 0x705e in data space */
unsigned int pri; /* 0x705f in data space */
};
/*
This module defines the bit positions in various sci registers. For other
registers more definitions are needed.
*/
/*
SCInCCR
*/
#define STOP_BITS 0x80
#define PARITY 0x40
#define PARITY_EN 0x20
#define LOOP_BACK 0x10
#define ADDR_IDLE 0x08
#define SCI_CHAR2 0x04
#define SCI_CHAR1 0x02
#define SCI_CHAR0 0x01
/*
SCInCTL1
*/
#define CRL1_RES1 0x80
#define RXERR 0x40
#define SW_RESET 0x20
#define CRL1_RES2 0x10
#define TXWAKE 0x08
#define SLEEP 0x04
#define TX_ENA 0x02
#define RX_ENA 0x01
/*
SCInCTL2
*/
#define TX_RDY 0x80
#define TX_EMPTY 0x40
#define CRL2_RES3 0x20
#define CRL2_RES2 0x10
#define CRL2_RES1 0x08
#define CRL2_RES0 0x04
#define RX_INT_EN 0x02
#define TX_INT_EN 0x01
/*
SCInRXST
*/
#define RXERROR 0x80
#define RXRDY 0x40
#define BRKDT 0x20
#define FE 0x10
#define OE 0x08
#define PE 0x04
#define RXWAKE 0x02
#define RXST_RES1 0x01
/*
SCInPRI
*/
#define PRI_RES0 0x80
#define PRI_TXPRI 0x40
#define PRI_RXPRI 0x20
#define PRI_SOFT 0x10
#define PRI_FREE 0x08
#define PRI_RES2 0x04
#define PRI_RES3 0x02
#define PRI_RES4 0x01
/********************************************************************/
/* Define pointers to memory mapped peripherals */
/********************************************************************/
#define SCI ((volatile struct sci *) 0x07050)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -