📄 sc28l91.h
字号:
/*
* 文件名: SC28L91.H
* 功能: 扩展串行口驱动程序头文件
* 作者: Light Rain
* 时间: 2006-11-3
*
* 描述:
*
*/
#ifndef _SC28L91_HEADER_
#define _SC28L91_HEADER_
#include "config.h"
#include "Global.H"
/******************************************************************************************/
// 片内寄存器基地址
#define SC28L91_BASE_ADDR 0x83080000
// 模式寄存器 Mode Register
#define SC28L91_MR0 (*((volatile unsigned char *)(SC28L91_BASE_ADDR + 0)))
#define SC28L91_MR1 (*((volatile unsigned char *)(SC28L91_BASE_ADDR + 0)))
#define SC28L91_MR2 (*((volatile unsigned char *)(SC28L91_BASE_ADDR + 0)))
// 时钟选择寄存器 Clock Select Register
#define SC28L91_CSR (*((volatile unsigned char *)(SC28L91_BASE_ADDR + 0x10)))
// 状态寄存器 Status Register
#define SC28L91_SR (*((volatile unsigned char *)(SC28L91_BASE_ADDR + 0x10)))
// 命令寄存器 Command Register
#define SC28L91_CR (*((volatile unsigned char *)(SC28L91_BASE_ADDR + 0x20)))
//
#define SC28L91_RxFIFO (*((volatile unsigned char *)(SC28L91_BASE_ADDR + 0x30)))
#define SC28L91_TxFIFO (*((volatile unsigned char *)(SC28L91_BASE_ADDR + 0x30)))
// 输入端口改变寄存器
#define SC28L91_IPCR (*((volatile unsigned char *)(SC28L91_BASE_ADDR + 0x40)))
// 辅助控制寄存器 Auxiliary Control Register
#define SC28L91_ACR (*((volatile unsigned char *)(SC28L91_BASE_ADDR + 0x40)))
//
#define SC28L91_ISR (*((volatile unsigned char *)(SC28L91_BASE_ADDR + 0x50)))
#define SC28L91_IMR (*((volatile unsigned char *)(SC28L91_BASE_ADDR + 0x50)))
//
#define SC28L91_CTU (*((volatile unsigned char *)(SC28L91_BASE_ADDR + 0x60)))
#define SC28L91_CTPU (*((volatile unsigned char *)(SC28L91_BASE_ADDR + 0x60)))
//
#define SC28L91_CTL (*((volatile unsigned char *)(SC28L91_BASE_ADDR + 0x70)))
#define SC28L91_CTPL (*((volatile unsigned char *)(SC28L91_BASE_ADDR + 0x70)))
//
#define SC28L91_IPR (*((volatile unsigned char *)(SC28L91_BASE_ADDR + 0xD0)))
// 输出端口配置寄存器 Output Port Configuration Register
#define SC28L91_OPCR (*((volatile unsigned char *)(SC28L91_BASE_ADDR + 0xD0)))
//
#define SC28L91_StrtCT (*((volatile unsigned char *)(SC28L91_BASE_ADDR + 0xE0)))
// 输出端口位设置 Set the Output Port Bits
#define SC28L91_SOPR (*((volatile unsigned char *)(SC28L91_BASE_ADDR + 0xE0)))
//
#define SC28L91_StpCT (*((volatile unsigned char *)(SC28L91_BASE_ADDR + 0xF0)))
// 输出端口位复位 Reset Output Port Bits
#define SC28L91_ROPR (*((volatile unsigned char *)(SC28L91_BASE_ADDR + 0xF0)))
#define SCUART_NO_COMMAND 0x00
#define SCUART_RES_MR1 0x10
//#define SCUART_RES_RX 0x20 //lzg
//#define SCUART_RES_TX 0x30 //lzg
#define SCUART_RES_ERRFLAG 0x40
#define SCUART_RES_BREAK 0x50
#define SCUART_START_BREAK 0x60
#define SCUART_STOP_BREAK 0x70
#define SCUART_START_RTS 0x80
#define SCUART_STOP_RTS 0x90
#define SCUART_SET_TIMEOUT 0xA0
#define SCUART_RES_MR0 0xB0
#define SCUART_CLR_TIMEOUT 0xC0
//
#define SCUART_ON_PWD 0xE0
#define SCUART_OFF_PWD 0xF0
#define SCUART_RX_BREAK 0x80
#define SCUART_FRAM_ERR 0x40
#define SCUART_PARITY_ERR 0x20
#define SCUART_OVER_ERR 0x10
#define SCUART_TX_EMPTY 0x08
#define SCUART_TX_RDY 0x04
#define SCUART_RX_FULL 0x02
#define SCUART_RX_RDY 0x01
//#define SCTX_MAX_FIFO_SIZE 16 //lzg
//#define SCTX_HALF_FIFO_SIZE 8
#define SCUART_RX_ERR 0xF0
#define SCUART_RX_INT_BIT 0x02 //isr
#define SCUART_TX_INT_BIT 0x01
/******************************************************************************************/
BOOLEAN SC28L91_Init( void );
void SC28L91_SetBaudRate( INT32U baudrate );
BOOLEAN SC28L91_Open( INT32U baudrate, INT8U databit, INT8U checkbit, INT8U stopbit, INT32U timeout );
BOOLEAN SC28L91_Close( void );
BOOLEAN SC28L91_Write( const INT8U *buffer, INT32U len );
INT32S SC28L91_Read( INT8U* buffer, INT32U buffersize, INT32U timeout );
INT32S SC28L91_Read_Ms( INT8U* buffer, INT32U buffersize, INT32U interval, INT32U timeout );
void SC28L91_Exception( void );
void SC28L91_EnableRx( void );
void SC28L91_DisableRx( void );
void SC28L91_EnableTx( void );
void SC28L91_DisableTx( void );
void SC28L91_CommFlush( void );
INT32S SC28L91_CommPending( void );
INT32S SC28L91_CommFull( void );
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -