📄 uart_func.h
字号:
/*
================================================================================
* @file UART_Func.h
* @brief user defined definitions
* @author 2006/03/29 Michiru Kagaya
* Copyright (C)SEIKO EPSON Corp. All Rights Reserved.
================================================================================
*/
#ifndef UART_FUNC_H
#define UART_FUNC_H
#ifdef __cplusplus
extern "C" {
#endif /* defined(__cplusplus) */
//=================================
// include files
//=================================
#include "UART_UserConfig.h"
// Type declaration
//=================================
typedef short (*UART_FUNC_CALLBACK )
( unsigned short wMsg, unsigned short wParam0, void *pParam1 );
//=================================
// Type declaration
//=================================
// --- Status ---
#ifdef _MSC_VER
#define STATUS_SUCCESS 1
#define STATUS_UNSUCCESSFUL -1
#define STATUS_INVALID_PARAMETER -2
#endif // _MSC_VER
#define UART_FUNC_STATUS_HW_ERROR -2 // Hardware error
#define UART_FUNC_STATUS_BUF_OVERFLOW -3 // Buffer overflow
// --- Messages ---
#define UART_FUNCM_RCVD_DATA 1
#define UART_FUNCM_SND_DATA_CMP 2
#define UART_FUNCM_RCV_DATA_CMP 3
#define UART_FUNCM_SND_TEXT_CMP 4
#define UART_FUNCM_RCV_TEXT_CMP 5
//=================================
// Structures declaration
//=================================
// --- Transfer result ---
typedef struct tagUART_FUNC_XFER_RESULT{
unsigned char bChannel;
unsigned short wReqSize;
unsigned short wActSize;
unsigned char *pBufAddr;
}UART_FUNC_XFER_RESULT, PUART_FUNC_XFER_RESULT;
// --- UART operation information ---
typedef struct tagUART_FUNC_PARAM {
unsigned char bChannel; // The used channel number
unsigned char bBaudRate; // Baud rate
unsigned char bDataBit; // Data bit
unsigned char bParity; // Parity
unsigned char bStopBit; // Stop Bit
unsigned char bFlowControl; // control flow
}UART_FUNC_PARAM, *PUART_FUNC_PARAM;
// --- UART construct information ---
// Used in UART_FuncStart
typedef struct tagUART_CONFIG {
UART_FUNC_PARAM sParam; // Operation information
unsigned short wSndBufSize; // Size of buffer for sheltering transmission data
unsigned short wRcvBufSize; // Size of buffer for sheltering receiving data
unsigned char *pSndBufAddr; // Pointer of buffer for sheltering transmission data
unsigned char *pRcvBufAddr; // Pointer of buffer for sheltering receiving data
UART_FUNC_CALLBACK pfnRcvdEvent; // The notification function when received data before the API is called.
}UART_FUNC_CONFIG, *PUART_FUNC_CONFIG;
//=================================
// Function declaration
//=================================
// --- UART_FuncStart : Start UART operation ---
short UART_FuncStart( const PUART_FUNC_CONFIG psConfig );
// --- UART_FuncStop : Stop UART operation ---
short UART_FuncStop( unsigned char bChannel );
// --- UART_FuncSendDataA : Tranmist data ---
short UART_FuncSendDataA ( unsigned char bChannel, unsigned short wSize,
unsigned char *pData, UART_FUNC_CALLBACK pfnCallbackProc );
// // --- UART_FuncSendData : Transmit dataa ---
short UART_FuncSendData ( unsigned char bChannel, unsigned short wSize, unsigned char *pData );
// --- UART_FuncReceiveDataA: Receiv data ---
short UART_FuncReceiveDataA ( unsigned char bChannel, unsigned short wSize,
unsigned char *pData, UART_FUNC_CALLBACK pfnCallbackProc );
// --- UART_FuncReceiveData : Receiv data ---
short UART_FuncReceiveData ( unsigned char bChannel, unsigned short wSize, unsigned char *pData );
// --- UART_FuncSendTextA : Transmit string ---
short UART_FuncSendTextA ( unsigned char bChannel, unsigned char *pString, UART_FUNC_CALLBACK pfnCallbackProc );
// --- UART_FuncSendData : Transmit string ---
short UART_FuncSendText ( unsigned char bChannel, unsigned char *pString );
// --- UART_FuncReceiveTextA: Receive string ---
short UART_FuncReceiveTextA ( unsigned char bChannel, unsigned short wSize,
unsigned char *pString, UART_FUNC_CALLBACK pfnCallbackProc );
// --- UART_FuncReceiveText : Receive string ---
short UART_FuncReceiveText ( unsigned char bChannel, unsigned short wSize,
unsigned char *pString, unsigned short *pwRcvdSize );
#if defined(__cplusplus)
}
#endif // defined(__cplusplus)
#endif // UART_FUNC_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -