📄 sci.h
字号:
/* Description : head for SCI module functions.
*
* $Author: 王琢玉
* $Date: 2007/02/23
* $Name: SCI.h
*/
#ifndef _SCI_H
#define _SCI_H
#include "pub_def.h"
#include "TPM.h"
#ifdef SCI_GLOBALS
#define SCI_EXT
#else
#define SCI_EXT extern
#endif
/********************************************
Defines
********************************************/
#define SCI_PORT1 0x01
#define SCI_PORT2 0x02
/* Constants Initialization*/
#define INIT_SCI2C2 0b00101100
#define INIT_SCI1C2 0b00101100
#define SCI1_OVERTIME 1000
#define SCI2_OVERTIME 1000
#define SCI1_BuadRate 9600
//fc9600
#define SCI2_BuadRate 9600
//fc9600
#define SCI1_FIFO_SIZE 1
#define SCI2_FIFO_SIZE 127
/********************************************
Typedefs
********************************************/
typedef union
{
struct
{
UINT8 FifoIsFlow:1;
UINT8 RxOnePacket:1;
}bits;
UINT8 u8Val;
}SCI_INFO;
/********************************************
Globals
********************************************/
SCI_EXT UINT8 Sci1Fifo[SCI1_FIFO_SIZE];
#if(SCI1_FIFO_SIZE < 256)
SCI_EXT volatile UINT8 Sci1FifoWrite;
#else
SCI_EXT volatile UINT16 Sci1FifoWrite;
#endif
SCI_EXT UINT8 Sci2Fifo[SCI2_FIFO_SIZE];
#if(SCI2_FIFO_SIZE < 256)
SCI_EXT volatile UINT8 Sci2FifoWrite;
#else
SCI_EXT volatile UINT16 Sci2FifoWrite;
#endif
SCI_EXT SCI_INFO Sci1Info;
SCI_EXT SCI_INFO Sci2Info;
/********************************************
Prototypes
********************************************/
/************************************************************
Function: SCIInitGeneric (u32, u32, SCI_PORT)
Parameter: u32BusClock Bus Clock
u32BaudRate The BaudRate of SCI
u8ComNumber Select SCI1 or SCI2
Description: initializing the SCI to the requested baud rate
based on the supplied busclock in kilohertz on the com port
that is selected
************************************************************/
void SCIInitGeneric(UINT32 u32BusClock, UINT32 u32BaudRate, UINT8 u8ComNumber);
/************************************************************
Function: SCIStartTransmit(u8, u8)
Parameter: cData The data which will transmit by sci
u8ComNumber Com port select
Description: Transmit one 8-Bit data by SCI
************************************************************/
void SCIStartTransmit(UINT8 cData, UINT8 u8ComNumber);
/************************************************************
Function: SCITransmitArray(u8 *, u8, u8)
Parameter: *pStr the array which will transmit by sci
length the lengh of this array
u8ComNumber Com port select
Description: Transmit one array by SCI
************************************************************/
void SCITransmitArray(UINT8 *pStr, UINT8 length, UINT8 u8ComNumber);
/************************************************************
Function: SCITransmitStr(u8 *, u8)
Parameter: *pStr the character string which will transmit by sci
u8ComNumber Com port select
Description: Transmit one character string by SCI
************************************************************/
void SCITransmitStr(UINT8 *pStr, UINT8 u8ComNumber);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -