
/**********************************************************************************************************************
 *  COPYRIGHT
 *  -------------------------------------------------------------------------------------------------------------------
 *  \verbatim
 *  Copyright (c) 2007-2014 by Vector Informatik GmbH.                                             All rights reserved.
 *
 *                This software is copyright protected and proprietary to Vector Informatik GmbH.
 *                Vector Informatik GmbH grants to you only those rights as set out in the license conditions.
 *                All other rights remain with Vector Informatik GmbH.
 *  \endverbatim
 *  -------------------------------------------------------------------------------------------------------------------
 *  FILE DESCRIPTION
 *  -------------------------------------------------------------------------------------------------------------------
 *         File:  CanNm.h
 *    Component:  AUTOSAR CAN Network Management
 *       Module:  AUTOSAR Network Management
 *    Generator:  -
 *
 *  Description:  Header of AUTOSAR CAN Network Management
 *                AUTOSAR Release 3.0
 *  
 *********************************************************************************************************************/
#ifndef CAN_BUS_OFF_H
#define CAN_BUS_OFF_H

#include "mf_config.h"
#include "fm33lg0xx_fl.h"
#include "Can_BusOffCfg.h"

#define CAN_BUSOFF_PRIVATE_CODE
#define CAN_BUSOFF_PRIVATE_DATA


#define nmStatusNMBusOffFlag           BusOffFlagAry[CurChannel]
#define nubNmBusOffCnt                 nubNmBusOffCntAry[CurChannel]
#define nmStatusErrRestoring           nmStatusErrRestoringAry[CurChannel]
#define NM_BUSOFF_FAST_RECOVERY_TIMES     nmBusOffFastRecoveryAry[CurChannel]  
#define nmStatusSlowRecovery            nmStatusSlowRecoveryAry[CurChannel]
#define nmTimerCntTbusoff               nmTimerCntTbusoffAry[CurChannel]
#define NM_BUSOFF_SLOW_RECOVERY_TIMES     nmBusOffSlowRecoveryAry[CurChannel]
#define nmStatusNMBusError              NMBusErrorAry[CurChannel]

#define NM_COUNT_FAST_TBUSOFF   \
    (nmCountBusoffFastTimerAry[CurChannel]/NM_MAINFUNCTION_PERIOD)
#define NM_COUNT_SLOW_TBUSOFF   \
    (nmCountBusoffSlowTimerAry[CurChannel]/NM_MAINFUNCTION_PERIOD)  

extern FUNC(void, CAN_BUSOFF_PRIVATE_CODE) Can_BusOff(const uint16_t CanControllerId);
extern FUNC(void, CAN_BUSOFF_PRIVATE_CODE) CanBusOffMainFunction(void);
extern void ApplNmBusOffRecoverySuccess(const uint16_t nmChannelHandle);
extern void CAN_BusOff_Init(void);
#endif
