📄 uart_funccom.h
字号:
/*
================================================================================
* @file UART_FuncCom.h
* @brief UART module common definitions
* @author 2006/03/29 Michiru Kagaya
* Copyright (C)SEIKO EPSON Corp. All Rights Reserved.
================================================================================
*/
#ifndef UART_FUNC_COMMON_H
#define UART_FUNC_COMMON_H
#ifdef __cplusplus
extern "C" {
#endif /* defined(__cplusplus) */
//=================================
// Include files
//=================================
#include "UART_FUNC.h"
#include "UART_UserConfig.h"
//=================================
// Type declaration
//=================================
#define MAX_START_CNT 10
#ifndef Inline
#define Inline __inline /* definations in C++ ect. */
/* Definition for GNU/GCC. */
#endif // Inline
#ifndef NULL
#ifdef _MSC_VER // Check compiler
#define NULL (void *)0
#else
#ifdef __cplusplus
#define NULL 0
#else
#define NULL (void *)0
#endif // __cpulsplus
#endif // _MSC_VER
#endif // NULL
#ifndef BOOL
#define BOOL unsigned char
#endif // BOOL
#ifndef TRUE
#define TRUE 1
#endif // TRUE
#ifndef FALSE
#define FALSE 0
#endif // FALSE
// Internal state
enum{
STATE_INIT, /* initialization */
STATE_READY, /* Possible to execute state */
};
// Transmit state
enum {
TRAN_STATE_READY, /* It is possible to execute */
TRAN_STATE_EXEC_BINASYNC, // binary tranmission(asynchronous)
TRAN_STATE_EXEC_TXTASYNC, // Text Transmission(asynchronous)
TRAN_STATE_EXEC_BINSYNC, // binary tranmission(synchronous)
TRAN_STATE_EXEC_TXTSYNC, // Text Transmission(synchronous)
TRAN_STATE_CMP, // transmission complete
TRAN_STATE_BUF_OVERFLOW, // Data overflow
};
//=================================
// structure declaration
//=================================
// Transmission management structure
//----------------------------
typedef struct tagTX_INFO{
unsigned char state; /* Possible to execute */
unsigned char* pReqAddr; // Start address
unsigned char* pPutAddr; // transmiting address
unsigned char* pTempBuf; // Sheltering buffer address
unsigned short wReqSize; // Request transmission size
unsigned short wActSize; // Number of data actually transmitted.
unsigned short wTempSize; // Sheltering buffer address
UART_FUNC_CALLBACK pfnCallback;
}TX_INFO, *PTX_INFO;
// Receiving managent structure
//----------------------------
typedef struct tagRX_INFO{
unsigned char state; /* State */
unsigned char* pReqAddr; // Start address
unsigned char* pPutAddr; // Transmission address
unsigned char* pTempBuf; // Sheltering buffer address
unsigned short wReqSize; // Request transmission size
unsigned short wActSize; // Number of data actually transmitted.
unsigned short wRcvdSize; // Received data size
unsigned short wTempSize; // Sheltering buffer address
UART_FUNC_CALLBACK pfnCallback;
UART_FUNC_CALLBACK pfnRcvdCallback;
}RX_INFO, *PRX_INFO;
// Channel management structure
//----------------------------
typedef struct tagCHANNEL_INFO{
unsigned char state;
TX_INFO txInfo;
RX_INFO rxInfo;
}CHANNEL_INFO, *PCHANNEL_INFO;
// Module management structure
//----------------------------
typedef struct tagMODULE_INFO{
CHANNEL_INFO sChInfo[MAX_UART_CHANNEL];
}MODULE_INFO, *PMODULE_INFO;
extern MODULE_INFO sModuleInfo;
#if defined(__cplusplus)
}
#endif /* defined(__cplusplus) */
#endif /* UART_FUNC_COMMON_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -