⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lin_driver.h

📁 LIN_InitNode_C161xx.h preconfiguration for C161xx LIN_InitNode_C164xx.h preconfiguration for C164
💻 H
📖 第 1 页 / 共 3 页
字号:
// @Date          05/22/2000
//----------------------------------------------------------------------------
// @AppNote
//    This function should be called from within the User-Call-Back-Function:
//    USER_vUCB_RxdId_Received(...)
//    The ID is already standing in an internal Buffer got by 
//    the message header (ID-Field receiving) before this function has been
//    called.
//****************************************************************************
extern void LIN_vCopy_ReceiveData(unsigned char*);           
//****************************************************************************



//****************************************************************************
// @Function: void LIN_vCopy_SendData(unsigned char* pucLocalData)  
//
//----------------------------------------------------------------------------
// @Description   
//    this function copies all requested data-bytes from the given start 
//    address to the LIN-Transceiver-Buffer and sends the first byte 
//    instantly
//    
//----------------------------------------------------------------------------
// @Returnvalue   void
//----------------------------------------------------------------------------
// @Parameters    address of the first data byte to send
//----------------------------------------------------------------------------
// @Date          05/19/2000
//----------------------------------------------------------------------------
// @AppNote
//    This function should be called from within the User-Call-Back-Function:
//    USER_vUCB_TxdId_Received(...)
//    This function copies all data which should be sent in the LIN-Trans-
//    ceiver Buffer and sends the first byte instantly.
//    The ID is already standing in an internal Buffer got by 
//    the message header before this function has been called.
//****************************************************************************
extern void LIN_vCopy_SendData(unsigned char*);   
//****************************************************************************




//****************************************************************************
// @Function      void LIN_vDefineUCBFunctionRxd( (*LocFncAddr)() )  
//
//----------------------------------------------------------------------------
// @Description   
//    this function defines the User Call Back Function which will be called
//    when a LIN Message with Receive-ID has been received.
//    It's up to the user that he provide a UCB-function for the LIN-Layer.
//    This function makes the definition very easy and flexible for the user.
//----------------------------------------------------------------------------
// @Returnvalue   none
//----------------------------------------------------------------------------
// @Parameters    Address of the User Call Back Function
//----------------------------------------------------------------------------
// @Date          05/19/2000
//----------------------------------------------------------------------------
// @AppNote
//
//    Note: Knowledge of "pointer on function" is needed
//
//    How to use this function ?
//
//    Example: 
//    The user calls the LIN function
//    LIN_vDefineUCBFunctionRxd(USER_vUCB_RxdId_Received);
//    with the user-function as parameter
//    the user-function byself must have void as return-value
//    and a unsigned char as "call-by-value"-parameter for the ID 
//
//    now the address of the UCB-Function "USER_vUCB_RxdId_Received" will be
//    saved in the variable "pvfUcbRxdId".
//    then the LIN-Programm can use this variable to call the UCB for excample
//    (*pvfUcbRxdId)(stLinTransceiveBuffer[BUFFER_1].ucId);
//    It has the same effect like 
//    USER_vUCB_RxdId_Received(stLinTransceiveBuffer[BUFFER_1].ucId);
//
//    Advantage:
//    If the LIN receives a message, the data-bytes should be saved or the 
//    user-program should handle on it.
//    But what handle is whished by the user? Normaly, now the user
//    would implement his code in the LIN-Programm to handle on the data. And
//    this is not a very nice solution.
//    On the other hand the LIN-Program could save all the LIN Data but this
//    would have the disadvantage of wasting a second memory space or that
//    the user would have permission on variables of the LIN-Programm which is
//    not wished.
//
//    So, the  user calls a function with a Call Back Function as Parameter,
//    The LIN-Protocoll is using the pointer-variable to call the UCB-Function
//    and in this UCB-Function (with ID as Parameter) the user is able to
//    handle on reception of receive-ID. For example to save the bytes from
//    the transceiver-buffer in to the responsible user-buffer.
//****************************************************************************
extern void LIN_vDefineUCBFunctionRxd( void(*)(unsigned char) );
//****************************************************************************




//****************************************************************************
// @Function      void LIN_vDefineUCBFunctionTxd( (*LocFncAddr)() )  
//
//----------------------------------------------------------------------------
// @Description   
//    this function defines the User Call Back Function which will be called
//    when a LIN Message with Send-ID has been received.
//    It's up to the user that he provide a UCB-function for the LIN-Layer.
//    This function makes the definition of the UCB very easy and flexible 
//    for the user.
//----------------------------------------------------------------------------
// @Returnvalue   none
//----------------------------------------------------------------------------
// @Parameters    Address of the User Call Back Function
//----------------------------------------------------------------------------
// @Date          05/19/2000
//----------------------------------------------------------------------------
// @AppNote
//
//    knowledge of "pointer on function" is needed
//
//    How to use this function ?
//
//    Example: 
//    The user calls the LIN function
//    LIN_vDefineUCBFunctionTxd(USER_vUCB_TxdId_Received);
//    with the user-function as parameter
//    the user-function byself must have void as return-value
//    and a unsigned char as "call-by-value"-parameter for the ID 
//
//    now the address of the UCB-Function "USER_vUCB_TxdId_Received" will be
//    saved in the variable "pvfUcbTxdId".
//    then the LIN-Programm can use this variable to call the UCB for excample
//    (*pvfUcbTxdId)(stLinTransceiveBuffer[BUFFER_1].ucId);
//    It has the same effect like 
//    USER_vUCB_TxdId_Received(stLinTransceiveBuffer[BUFFER_1].ucId);
//
//    Advantage:
//    If the LIN receives a LIN-Header, the data-bytes should be sent or the 
//    user-programm should handle else.
//    But what handle is whished by the user? Normally, now the user
//    would implement his code in the LIN-Programm to handle on the data. And
//    this is not a very nice solution.
//    On the other hand the LIN-Programm could save all the LIN Data but this
//    would have the disadvantage of wasting a second memory space or that
//    the user would have permission on Variables of the LIN-Program which is
//    not wished.
//
//    So, the  user calls a function with a Call Back Function as Parameter,
//    The LIN-Protocoll is using the pointer-variable to call the UCB-Function
//    and in this UCB-Function (with ID as Parameter) the user is able to
//    handle on reception of Transmit-ID. For example to load the responsible
//    bytes in the transceiver-buffer which will then be sent by the LIN-
//    Driver.
//    
//****************************************************************************
extern void LIN_vDefineUCBFunctionTxd( void(*)(unsigned char) );     
//****************************************************************************




//****************************************************************************
// @Function      unsigned char LIN_ucGetID(unsigned char ucLocalReceivedByte)  
//
//----------------------------------------------------------------------------
// @Description   
//                this function separates the ID-number 
//                from the ID-field.
//----------------------------------------------------------------------------
// @Returnvalue   unsigned char: the id-number and lenghtcontrol 
//                without parity bits
//
//----------------------------------------------------------------------------
// @Parameters    unsigned char cLocalReceivedByte:  the idfield
//
//----------------------------------------------------------------------------
// @Date          06/19/2000
//----------------------------------------------------------------------------
// @AppNote
//    Example:
//
//    test = LIN_ucGetID(0x80)
//
//    test == 0     rsp.    test == 0x00
//****************************************************************************
extern unsigned char LIN_ucGetID(unsigned char);
//****************************************************************************




//****************************************************************************
// @Function  unsigned char LIN_ucGetNOD(unsigned char ucLocalReceivedByte)  
//
//----------------------------------------------------------------------------
// @Description   
//                this function separates "Number of Data"  from the ID-field.
//----------------------------------------------------------------------------
// @Returnvalue   unsigned char: the lenghtcontrol without Id-bits and parity 
//                bits
//                possible values: 2,4 or 8
//
//----------------------------------------------------------------------------
// @Parameters    unsigned char ucLocalReceivedByte:  the idfield
//
//----------------------------------------------------------------------------
// @Date          06/19/2000
//----------------------------------------------------------------------------
// @AppNote
//    Example:
//
//    test = LIN_ucGetNOD(0x80)
//
//    test == 2
//
//****************************************************************************
extern unsigned char LIN_ucGetNOD(unsigned char);
//****************************************************************************



//****************************************************************************
// @Function      unsigned char LIN_ucReadFlag_Sleep(void)  
//
//----------------------------------------------------------------------------
// @Description   
//    this function returns the status of the sleep bit in the NODE_STATUS 
//    Register
//----------------------------------------------------------------------------
// @Returnvalue   bit-status: 1 bit is set: Node is in sleep-mode
//                            0 bit is reset: Node is awake
//----------------------------------------------------------------------------
// @Parameters    none
//----------------------------------------------------------------------------
// @Date          05/23/2000
//----------------------------------------------------------------------------
// @AppNote
//    
//    Example:
//    if(LIN_ucReadFlag_Sleep())
//    {
//       ...some code which should be handled in sleep-mode...
//    }
//----------------------------------------------------------------------------
//****************************************************************************
extern unsigned char LIN_ucReadFlag_Sleep(void);
//****************************************************************************





//****************************************************************************
// @Function      unsigned char LIN_ucReadFlag_ReadyForSynchbreak(void)  
//
//----------------------------------------------------------------------------
// @Description   
//    this function returns the status of the sleep bit in the NODE_STATUS 
//    Register
//----------------------------------------------------------------------------
// @Returnvalue   bit-status: 0x02 bit is set:  ready for synchbreak
//                            0 bit is reset: not ready for synchbreak
//----------------------------------------------------------------------------
// @Parameters    none
//----------------------------------------------------------------------------
// @Date          05/23/2000
//----------------------------------------------------------------------------
// @AppNote
//   
//    Example:
//    if(LIN_ucReadFlag_ReadyForSynchbreak())
//    {
//       ...set sleep-mode...
//    } 
//----------------------------------------------------------------------------
//****************************************************************************
extern unsigned char LIN_ucReadFlag_ReadyForSynchbreak(void);
//****************************************************************************







//****************************************************************************
// @Function      unsigned char LIN_ucReadFlag_SleepPending(void)  
//
//----------------------------------------------------------------------------
// @Description   
//    this function returns the status of the sleep bit in the PENDING_STATUS 
//    Register
//----------------------------------------------------------------------------
// @Returnvalue   bit-status: 0x04 bit is set:  sleep is pending
//                            0 bit is reset: sleep is not pending
//----------------------------------------------------------------------------
// @Parameters    none
//----------------------------------------------------------------------------
// @Date          07/20/2000
//----------------------------------------------------------------------------
// @AppNote
//    
//    Example:
//    if(LIN_ucReadFlag_SleepPending())
//    {
//       ...some code before going in sleep-mode...
//    } 
//
//****************************************************************************
extern unsigned char LIN_ucReadFlag_SleepPending(void);
//****************************************************************************





//****************************************************************************
// @Function      unsigned char LIN_ucReadFlag_WakeupPending(void)  
//
//----------------------------------------------------------------------------
// @Description   
//    this function returns the status of the wakeup bit in the PENDING_STATUS 
//    Register
//----------------------------------------------------------------------------
// @Returnvalue   bit-status: 0x02 bit is set:  wakeup is pending
//                            0 bit is reset: wakeup is not pending
//----------------------------------------------------------------------------
// @Parameters    none
//----------------------------------------------------------------------------
// @Date          07/20/2000
//----------------------------------------------------------------------------
// @AppNote
//    
//    Example:
//    if(LIN_ucReadFlag_WakeUpPending())

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -