54 lines
1.5 KiB
C
54 lines
1.5 KiB
C
//
|
|
// Created by cfif on 17.11.22.
|
|
//
|
|
|
|
#ifndef MODULE_LINIO_H
|
|
#define MODULE_LINIO_H
|
|
|
|
#include "stdint.h"
|
|
#include "cmsis_os2.h"
|
|
|
|
typedef enum
|
|
{
|
|
LIN_NO_EVENT = 0x00U, /*!< No event occurred. */
|
|
LIN_WAKEUP_SIGNAL, /*!< Wakeup signal */
|
|
LIN_BAUDRATE_ADJUSTED, /*!< Baudrate was adjusted in slave autobaud mode. */
|
|
LIN_RECV_BREAK_FIELD_OK, /*!< Break Field was received */
|
|
LIN_SYNC_OK, /*!< Sync field is correct */
|
|
LIN_SYNC_ERROR, /*!< Sync field is incorrect */
|
|
LIN_PID_OK, /*!< PID receive correct */
|
|
LIN_PID_ERROR, /*!< PID receive incorrect */
|
|
LIN_FRAME_ERROR, /*!< Frame receive error */
|
|
LIN_READBACK_ERROR, /*!< Readback words are incorrect */
|
|
LIN_CHECKSUM_ERROR, /*!< Checksum byte error */
|
|
LIN_TX_COMPLETED, /*!< TX data completed */
|
|
LIN_RX_COMPLETED, /*!< rx data completed */
|
|
LIN_RX_OVERRUN, /*!< RX overflow occurred */
|
|
LIN_TIMEOUT, /*!< RX overflow occurred */
|
|
} lin_event_id_t;
|
|
|
|
typedef enum {
|
|
LIN_DIRECTION_GET = 0,
|
|
LIN_DIRECTION_SET = 1
|
|
} eDirection;
|
|
|
|
typedef struct {
|
|
osMessageQueueId_t rxDataQueue;
|
|
eDirection direction;
|
|
uint8_t g_aTxBufferLen;
|
|
uint8_t g_aTxBuffer[8];
|
|
uint8_t g_aRxBufferLen;
|
|
uint8_t g_aRxBuffer[8];
|
|
} tLinData;
|
|
|
|
typedef uint8_t (* LinIOTransaction )(void *env, uint32_t timeout);
|
|
|
|
typedef struct {
|
|
void *env;
|
|
LinIOTransaction runCommand;
|
|
LinIOTransaction getCommand;
|
|
} tLinIO;
|
|
|
|
|
|
#endif //MODULE_LINIO_H
|