#ifndef TP_15765_2_H #define TP_15765_2_H /*! * @file tp_15765_2.h * @brief TP layer file according to the 15765-2. * */ #include "uds_types.h" #define FRAME_TYPE_MASK 0xF0 /*!< FRAME TYPE MASK */ #define FLOW_STATUS_MASK 0x0F /*!< FLOW STATUS MASK */ #define SEQUENCE_NUMBER_MASK 0x0F /*!< SEQUENCE NUMBER MASK */ #define SINGLE_FRAME_DATA_LENGTH_MASK 0x0F /*!< SINGLE FRAME DATA LENGTH MASK */ #define FIRST_FRAME_DATA_LENGTH_MSB_NIBBLE_MASK 0x0F /*!< FIRST FRAME DATA LENGTH MSB NIBBLE MASK */ #define SEQUENCE_NUMBER_MAX 0x10 /*!< SEQUENCE NUMBER MAX */ #define CAN_FRAME_BYTES_UPPER_RANGE 7 /*!< CAN FRAME BYTES UPPER RANGEK */ #define ZERO_LOOP_COUNT 0 /*!< SEQUENCE NUMBER MASK */ #define ONE_LOOP_COUNT 1 /*!< SEQUENCE NUMBER MASK */ #define TWO_LOOP_COUNT 2 /*!< SEQUENCE NUMBER MASK */ #ifdef RX_MULTI_BUFFER_SUPPORT #define RECEIVE_MULTI_BUFFER_SUPPORT TRUE #else #define RECEIVE_MULTI_BUFFER_SUPPORT FALSE #endif /*! * Enum Type. TP Layer State */ typedef enum TPState_Tag { TP_Idle_State = 0, /*!< Idle State */ TP_Wait_For_SFORFF_TxConf_State, /*!< Wait for TXConf State */ TP_Wait_For_FCFrame_Rx_State, /*!< Wait for Flow Control State */ TP_Transmit_CF_State, /*!< Transmit CF State */ TP_Wait_For_CF_TxConf_State, /*!< Wait For CF TxConf State */ TP_Wait_For_STmin_State, /*!< Wait For STmin State */ TP_Wait_For_FC_TXconf_State, /*!< Wait For FC_TXconf State */ TP_Rx_CF_State, /*!< Receive CF State */ TP_Wait_For_DataRead_State /*!< Wait For DataRead State */ }TPState_T; /*! * Enum Type. Parameters */ typedef enum TPParameters_Tag { N_BLOCKSIZE = 0, N_SEPERATIONTIME }TPParameters_T; /*! * Enum Type. Result for change parameter */ typedef enum TPResultChangePara_Tag { N_OK_R = 0, N_RX_ON, N_WRONG_PARAMETER, N_WRONG_VALUE }TPResultChangePara_T; /*! * Enum Type. Transmit sub state */ typedef enum TPTransmitSubState_Tag { TP_TX_LOAD_CF_DATA = 0, TP_TX_LOAD_REMAINING_BYTES_OF_CF, TP_TX_LOAD_REMAINING_BYTES_OF_LAST_CF }TPTransmitSubState_T; /*! * Enum Type. Receive sub state */ typedef enum TPReceiveSubState_Tag { TP_RX_UNLOAD_CF_DATA = 0, TP_RX_UNLOAD_REMAINING_BYTES_OF_CF, TP_RX_UNLOAD_REMAINING_BYTES_OF_LAST_CF }TPReceiveSubState_T; /*! * Enum Type. Transmit Status */ typedef enum TPTransmitStatus_Tag { TP_TRANSMIT_IDLE = 0, TP_TRANSMIT_START, WAITINGFORFLOWCONTROL }TPTransmitStatus_T; /*! * Enum Type. Receive Status */ typedef enum TPReceiveStatus_Tag { TP_RECEIVE_IDLE = 0, TP_RECEIVE_START }TPReceiveStatus_T; /*! * Enum Type. Timer control */ typedef enum TPTimerControl_Tag { TIMER_STOP = 0, TIMER_RUN }TPTimerControl_T; /*! * Enum Type. Flow control */ typedef enum TPFlowControlStatus_Tag { CLEAR_TO_SEND = 0, WAIT, OVERFLOW, RESERVED }TPFlowControlStatus_T; /*! * Enum Type. Buffer Status */ typedef enum TPBufferStatus_Tag { EMPTY = 0, FILLED }TPBufferStatus_T; #endif