#ifndef COM_CAN_H
#define COM_CAN_H
#include "TYW_stdint.h"
void COM_CAN_Init(void);
void COM_RX_Process(void);
void COM_TX_Process(void);
void COM_NM_Process(void);

void Can_BusOff_Fun(void);
void Can_BusOffRecover(void);


/******************************************************************************
Bus-off״̬
******************************************************************************/
#define   RSCAN0_BUS_STABLE                 0x00U
#define   RSCAN0_BUS_OFF_LV1                0x01U
#define   RSCAN0_BUS_OFF_LV2                0x02U
#define   RSCAN00_BUS_LIMP                   0x03U
/******************************************************************************
Bus-off����
******************************************************************************/
#define   RSCAN0_BUS_OFF_AUTO_RECOVERY      0U               /* Bus-off�Զ��ָ�ʹ�� */

#define   RSCAN0_BUS_OFF_LV1_RECOVERY_TIME  90U             /* Bus-off�ָ�ʱ��,��λms */
#define   RSCAN0_BUS_OFF_LV2_RECOVERY_TIME  1000U            /* Bus-off�ָ�ʱ��,��λms */

#define   RSCAN0_BUS_LIMP_MODE_ENABLE       0U               /* ����ģʽʹ��     */
#define   RSCAN0_BUS_LIMP_MODE_THRESHOLD    11U              /* ��������ģʽ���� */


typedef struct
{
    uint8_t  Status;
    uint8_t  Timer;
    uint8_t  Cnt;
} RSCAN0BusoffMonitorStruct;

uint8_t getBUS_OFF_Status(void);


#endif
