linprot.h

来自「基于摩托罗拉(现在飞思卡尔)系列MC68HC908单片机开发车辆ECU系统!」· C头文件 代码 · 共 115 行

H
115
字号
#ifndef LINPROT_H
#define LINPROT_H
/******************************************************************************
*
*       Copyright (C) 2003 Motorola, Inc.
*       All Rights Reserved
*
* Filename:     $RCSfile: linprot.h,v $
* Author:       $Author: ttz778 $
* Locker:       $Locker:  $
* State:        $State: Exp $
* Revision:     $Revision: 1.0 $
*
* Functions:    LIN Protocol module. Master and Slave State Machine header file
*
* History:      Use the RCS command log to display revision history
*               information.
*
* Description:  
*
* Notes:        
*
******************************************************************************/

#define LIN_PROT_BUF_LEN 8u

/****************************************************************************
 * All extern declarations of common-purpose RAM variables shall be here.
 ***************************************************************************/
/****************************************************************************
 * Some of the variables (more often used) can be declared using LIN_ZPAGE
 * modifier.
 * It require to perform zero page RAM placement optimisation.
 ***************************************************************************/
#if defined(CW08) 
#pragma DATA_SEG SHORT ZeroSeg
#endif /* defined(CW08) */

extern LIN_ZPAGE LIN_BYTE LIN_StateFlags;            /* State machine status  */

extern LIN_ZPAGE LIN_BYTE LIN_ProtBuf[LIN_PROT_BUF_LEN];   /* Protocol buffer */
extern LIN_ZPAGE LIN_BYTE LIN_TmpSCIByte;                  /* byte to receive byte from SCI                   */
                                                           /* it shoud be used only under disabled interrupts */
extern LIN_ZPAGE LIN_BYTE LIN_BufCounter;                  /* ProtBuf counter point to sended byte for FLAG_DATA_SEND         */
                                                           /* or to first free byte for FLAG_DATA_RECEIVE or FLAG_DATA_IGNORE */
extern LIN_ZPAGE LIN_BYTE LIN_MsgLength;                   /* Message length 1..8   */

#if defined(MASTER)
extern LIN_ZPAGE LINMsgIdType   LIN_SaveIdentifier;        /* Message identifier */
#endif /* defined(MASTER) */

#if defined(CW08)
#pragma DATA_SEG DEFAULT
#endif /* defined(CW08) */

/****************************************************************************
 * End of common-purpose RAM variables extern declaration
 ***************************************************************************/

#if defined(MASTER)
                                        /* Master flags for states machine */
#define LIN_FLAG_SLEEP          0x01
#define LIN_FLAG_SEND_BREAK     0x02
#define LIN_FLAG_IGNORE         0x04
#define LIN_FLAG_SEND_HEADER    0x08
#define LIN_FLAG_SEND_DATA      0x10
#define LIN_FLAG_RECEIVE_DATA   0x20
#define LIN_FLAG_IGNORE_DATA    0x40
#define LIN_FLAG_WAKEUP_TIMEOUT 0x80

#endif /* defined(MASTER) */

#if defined(SLAVE)
                                        /* Slave flags for states machine */

#if defined(LINAPI_1_0)
#define LIN_FLAG_DISCONNECT     0x01    /* LIN API: disconnected state */
#define LIN_FLAG_NOINIT         0x02    /* interface not initialized */
#else /* !defined(LINAPI_1_0) */
#define LIN_FLAG_SLEEP          0x01    /* Motorola API: sleep mode */
#endif /* !defined(LINAPI_1_0) */
#define LIN_FLAG_IGNORE         0x04
#define LIN_FLAG_RECEIVE_SYNC   0x08
#define LIN_FLAG_SEND_DATA      0x10
#define LIN_FLAG_RECEIVE_DATA   0x20
#define LIN_FLAG_RECEIVE_ID     0x40
#define LIN_FLAG_WAKEUP_TIMEOUT 0x80

#endif /* defined(SLAVE) */

/****************************************************************************/
/***                            Functions                                 ***/
/****************************************************************************/

void LIN_RxCompleted    ( void );
#if defined(MASTER)
void LIN_TxCompleted    ( void );
#endif /* defined(MASTER) */

/* Extern -- only for unit testing */
void LIN_CopyToBuf      ( LIN_BYTE * src );
void LIN_CopyFromBuf    ( LIN_BYTE * dst );

#if defined(MASTER)
void LIN_FrameError     ( void );
void LIN_Timeout        ( void );
#endif /* defined(MASTER) */

#if defined(SLAVE)
#define     LIN_FRAMEERROR      0   /* frame error like break */
#define     LIN_NORMALBREAK     1u  /* normal break */
void LIN_FrameError     ( LIN_BYTE breakType );
#endif /* defined(SLAVE) */

#endif /* define (LINPROT_H) */

⌨️ 快捷键说明

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