📄 lin_driver.h
字号:
//****************************************************************************
// @Module LIN
// @Filename LIN_driver.h
// @Project LIN_Protocol
//----------------------------------------------------------------------------
// @Controller Infineon C161CI, Evaluation Kit
//
// @Compiler Keil uVision2 V2.03
//
// @Version 0.1
//
// @Description Headerfile for declaration of registers and functions.
//
//----------------------------------------------------------------------------
// @Date 04/07/2000
//
//****************************************************************************
// USER CODE BEGIN
//----------------------------------------------------------------------------
// @Globals
// <name> <type (In/Out/InOut)> <description>
//
//----------------------------------------------------------------------------
// @Error
// <description of possible errors and error handling>
//
//----------------------------------------------------------------------------
// @AppNote
// <general description of the appnote specific user code within this module>
//
//----------------------------------------------------------------------------
// <else descriptions>
//
//----------------------------------------------------------------------------
// @Copyright (C) 2000 INFINEON TECHNOLOGIES AG. All rights reserved.
//
// Systems Engineering Automotive AI SM SEA
// Juergen Ketterer
//****************************************************************************
// USER CODE END
//****************************************************************************
// @Project Includes
//****************************************************************************
// USER CODE BEGIN (main,<position>)
//#include <REG164CI.H> /* register definitions C164 */
// USER CODE END
//****************************************************************************
// @Macros
//****************************************************************************
// USER CODE BEGIN (main,<position>)
// USER CODE END
//****************************************************************************
// @Defines
//****************************************************************************
// USER CODE BEGIN (<module>,<position>)
// USER CODE END
//****************************************************************************
// @Typedefs
//****************************************************************************
// USER CODE BEGIN (<module>,<position>)
typedef enum
{
l_bit_error = 0x01,
l_checksum_error = 0x02,
l_id_parity_error = 0x04,
l_slave_not_responding_error = 0x08,
l_inconsistent_synch_field_error = 0x10,
l_no_bus_activity_error = 0x20
}ERROR_STATUS;
typedef enum
{
l_sleep = 0x01,
l_ready_for_synchbreak = 0x02,
l_not_ready_for_synchbreak = 0x04,
l_disconnect = 0x08
}NODE_STATUS;
typedef enum
{
l_default_pending = 0x01,
l_wakeup_pending = 0x02,
l_sleep_pending = 0x04
}PENDING_STATUS;
typedef enum
{
l_default_status = 0x0001,
l_synchbreak_started = 0x0002,
l_syndel_started = 0x0003,
l_synchbreak_done = 0x0004,
l_synchfield_received = 0x0005,
l_i_am_transmitter = 0x0006,
l_i_am_receiver = 0x0007,
l_i_am_monitor = 0x0008,
l_checksum_ok = 0x0009
}TRANSCEIVER_STATUS;
typedef struct
{
unsigned char ucId;
unsigned char ucType;
}stLIN_ID_INFO;
typedef struct LIN_MESSAGE
{
unsigned char ucId;
unsigned char ucDataByte[8];
unsigned char ucNOD;
}stLIN_MESSAGE;
// USER CODE END
//****************************************************************************
// @Imported Global Variables
//****************************************************************************
// USER CODE BEGIN (LIN_function.c, Global Variables)
//****************************************************************************
// @External Prototypes
//****************************************************************************
// USER CODE BEGIN (<module>,<position>)
//<User external declarations of imported functions>
//****************************************************************************
// @Function void LIN_vInitNode(void)
//
//----------------------------------------------------------------------------
// @Description
// this function initializes the node
//----------------------------------------------------------------------------
// @Returnvalue void
//
//----------------------------------------------------------------------------
// @Parameters void
//
//----------------------------------------------------------------------------
// @Date 04/05/2000
//
//----------------------------------------------------------------------------
// @AppNote
//
// Place this function above main()
//
//****************************************************************************
extern void LIN_vInitNode(void);
//****************************************************************************
//****************************************************************************
// @Function void LIN_vSchedule(void)
//
//----------------------------------------------------------------------------
// @Description
// The Master-Node is responsible to send all needed IDs on the bus.
// This function sends all message-headers with the different IDs
// on the bus.
//----------------------------------------------------------------------------
// @Returnvalue void
//
//----------------------------------------------------------------------------
// @Parameters void
//
//----------------------------------------------------------------------------
// @Date 06/20/2000
//
//****************************************************************************
//----------------------------------------------------------------------------
// @Global Variables
//
// stLinIdInfo[]
// buffer should save ID infos and ID-Types.
// size of Id Information-buffer depends on number of send- and receive IDs
// spezified in the node (LIN_hLinNode.h).
// in the LinIdInfo buffer are a number of MAX_LIN_ID ID-Infos
// to save
//----------------------------------------------------------------------------
// @AppNote
//
// This is a scheduling table sending frame-header on the bus with
// different IDs.
// To get a desired order in which the IDs should be sent on the bus,
// the ID should have been defined in the header file in this
// desired order.
//****************************************************************************
extern void LIN_vSchedule(void);
//****************************************************************************
//****************************************************************************
// @Function void LIN_vRxd_Interrupt( void )
//
//----------------------------------------------------------------------------
// @Description
// this function will be called after receiving a character
// on the defined UART. RXD-Interrupt
//----------------------------------------------------------------------------
// @Returnvalue void
//
//----------------------------------------------------------------------------
// @Parameters void
//
//----------------------------------------------------------------------------
// @Date 05/16/2000
//----------------------------------------------------------------------------
// @AppNote
//
//****************************************************************************
extern void LIN_vRxd_Interrupt(void);
//****************************************************************************
//****************************************************************************
// @Function void LIN_vCapture_Interrupt(void)
//
//----------------------------------------------------------------------------
// @Description
// This function will be called after capture or compare interrupt.
//----------------------------------------------------------------------------
// @Returnvalue void
//
//----------------------------------------------------------------------------
// @Parameters void
//
//----------------------------------------------------------------------------
// @Date 05/16/2000
//
//****************************************************************************
//----------------------------------------------------------------------------
// @Global Variables
//
//----------------------------------------------------------------------------
// @AppNote
// This function should be called by the Capture/Compare Interrupt
// by the USER-Interrupt functions.
//
// Invoked by some time-out interrupts and...
//
// ...if defined as MASTER:
// the compare register will invoke this interrupt to create the Synchbreak
//
//****************************************************************************
extern void LIN_vCapCom_Interrupt(void);
//****************************************************************************
//****************************************************************************
// @Function void LIN_vGoSleep(void)
//
//----------------------------------------------------------------------------
// @Description
// this function sets a sleep-request-flag (pending) in the
// vNODE_STATUS byte
//----------------------------------------------------------------------------
// @Returnvalue void
//
//----------------------------------------------------------------------------
// @Parameters void
//
//----------------------------------------------------------------------------
// @Date 07/14/2000
//----------------------------------------------------------------------------
// @AppNote
// To recognize that a Sleep-Mode Header should be send. A Id-field with
// 0x80 will be sent.
// This sleep-pending flag will be detected in the LIN- Scheduling-
// Function and sends the sleep ID (ZERO = ID-Field 0x80) to the bus.
//****************************************************************************
extern void LIN_vGoSleep(void);
//****************************************************************************
//****************************************************************************
// @Function void LIN_vSendWakeUp(void)
//
//----------------------------------------------------------------------------
// @Description
// this function sends a wakeup signal on the bus
//----------------------------------------------------------------------------
// @Returnvalue none
//----------------------------------------------------------------------------
// @Parameters none
//----------------------------------------------------------------------------
// @Date 05/11/2000
//----------------------------------------------------------------------------
// @AppNote
//
// This sign can only be sent if the node is really in sleep-mode
// Sleep Signal is a 0x80 character
//****************************************************************************
extern void LIN_vSendWakeUp(void);
//****************************************************************************
//****************************************************************************
// @Function: void LIN_vCopy_ReceiveData(unsigned char* ucLocalData)
//
//----------------------------------------------------------------------------
// @Description
// this function copies all received data from the LIN-Transceiver-Buffer to
// the USER-LIN-BUFFER. The user application has to provide the address
// of the first byte in the USER-LIN-BUFFER.
//
//----------------------------------------------------------------------------
// @Returnvalue none
//----------------------------------------------------------------------------
// @Parameters address of the first data byte, where the data should be
// stored in the USER-LIN-BUFFER
//----------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -