📄 uart.h
字号:
/* $Header: O:\pvcs\IBS_Software\06_Opel\src\uart.h_v 1.1 Mar 09 2005 18:49:46 Brunken_Guido $ */
/*******************************************************************************
Copyright 2003 Delphi Technologies, Inc., All Rights Reserved.
********************************************************************************
********************************************************************************
Title : UART.H
Module Description : This file has all of the standard global
defines for module UART
Author : Long Lee
Created : March 24, 1999
*******************************************************************************/
#ifndef UART_H
#define UART_H
/******************************************************************************/
/* Constant and Macro Definitions using #define */
/******************************************************************************/
#define SEPARATOR 0x1C // Separator
#define ESCAPE 0x1B // Escape character
/******************************************************************************/
/* Include files */
/******************************************************************************/
#include "uart.hu" // include application specific header definitions
/******************************************************************************/
/* Enumerations and Structures and Typedefs */
/******************************************************************************/
typedef Uart_Rx_Func_Ret_T (*UART_Rx_Func_Ptr) (uint8_t data, uint8_t err);
// Information for each UART channel is stored in variables of this type:
typedef struct uart_chan_tag
{
uint16_t rx_in; // Rx buffer input index
uint16_t rx_out; // Rx buffer output index
uint16_t rx_count; // Rx buffer byte count
uint16_t rx_buf_size;
UART_Rx_Func_Ptr rx_func; // Rx callback function pointer
uint8_t *rx_buf; // Rx ring buffer
uint16_t tx_in; // Tx buffer input index
uint16_t tx_out; // Tx buffer output index
uint16_t tx_count; // Tx buffer byte counter
uint16_t tx_buf_size;
uint8_t *tx_buf; // Tx ring buffer
volatile uart_reg_t* ptr_reg; // Pointer to hardware registers
bool tx_progress; // Tx in progress
} uart_chan_t;
typedef struct uart_chan_init_data_tag
{
uint32_t channel; // channel index
uint8_t *ptr_rx_buf; // Rx ring buffer
uint8_t *ptr_tx_buf; // Tx ring buffer
uint16_t rx_size; // Rx buffer byte count
uint16_t tx_size; // Tx buffer byte counter
uart_reg_init_data_t reg_init_data; // init values for hardware registers
UART_Rx_Func_Ptr rx_func; // Rx callback function pointer
} uart_chan_init_data_t;
/******************************************************************************/
/* Function Prototypes */
/******************************************************************************/
extern Uart_Ret_T UART_Start ( Uart_Devices_Enum_T device, Uart_Isr_State_T isr_state );
extern Uart_Ret_T UART_Stop ( Uart_Devices_Enum_T device );
extern Uart_Devices_Enum_T UART_Initialize(Uart_Device_Config_T config_index);
#if UART_CONF_USE_UNBUFFERED_WRITE_IS
extern void UART_Put_Char_Unbuf( Uart_Devices_Enum_T device, uint8_t data );
#endif // #if UART_CONF_USE_UNBUFFERED_WRITE_IS
#if UART_CONF_USE_BUFFERED_IO_IS
extern bool UART_Put_Char (Uart_Devices_Enum_T device, uint8_t data);
extern bool UART_Get_Char (Uart_Devices_Enum_T device, uint8_t* ptr);
#endif
#if UART_CONF_USE_TX_INT_0_IS
extern void UART0_TX_ISR(void);
#endif
#if UART_CONF_USE_RX_INT_0_IS
extern void UART0_RX_ISR(void);
#endif
#if UART_CONF_USE_TX_INT_1_IS
extern void UART1_TX_ISR(void);
#endif
#if UART_CONF_USE_RX_INT_1_IS
extern void UART1_RX_ISR(void);
#endif
#if UART_CONF_USE_TX_INT_2_IS
extern void UART2_TX_ISR(void);
#endif
#if UART_CONF_USE_RX_INT_2_IS
extern void UART2_RX_ISR(void);
#endif
#if UART_CONF_USE_TX_INT_3_IS
extern void UART3_TX_ISR(void);
#endif
#if UART_CONF_USE_RX_INT_3_IS
extern void UART3_RX_ISR(void);
#endif
/*******************************************************************************
* REVISION RECORDS *
*******************************************************************************/
/******************************************************************************/
/* $Log: O:\pvcs\IBS_Software\06_Opel\src\uart.h_v $
*
* Rev 1.1 Mar 09 2005 18:49:46 Brunken_Guido
* + reworked module
* + added configuration switches for code size optimization
*
* Rev 1.0 Sep 30 2004 21:10:36 Brunken_Guido
* Initial revision.
*
* Rev 0.9 24 Sep 2004 12:00:00 Brunken_Guido
* Basic revision copied from Speicher_Jeff
* O:\Pvcs\IBS_Software\vib\src\uart.h_v Rev. 1.6
*
******************************************************************************/
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -