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

📄 lintmr.h

📁 基于摩托罗拉(现在飞思卡尔)系列MC68HC908单片机开发车辆ECU系统!
💻 H
字号:
#ifndef LINTMR_H
#define LINTMR_H

/******************************************************************************
*
*       Copyright (C) 2003 Motorola, Inc.
*       All Rights Reserved
*
* Filename:     $RCSfile: lintmr.h,v $
* Author:       $Author: ttz778 $
* Locker:       $Locker:  $
* State:        $State: Exp $
* Revision:     $Revision: 1.0 $
*
* Functions:    Timer routins header file
*
* History:      Use the RCS command log to display revision history
*               information.
*
* Description:
*
* Notes:        Protocol timeouts -- only for Master node
*
******************************************************************************/


/******************************************************************************
    Idle timeout processing
******************************************************************************/

extern LIN_WORD LIN_IdleTimeout;          /* counter for idle timeout */

/* Set/reset Idle timeout */
extern void LIN_SetIdleTimeout( void );


#if defined(MASTER)

/******************************************************************************
    Protocol timeout processing
******************************************************************************/

/****************************************************************************/
/* Indexes for LIN_SetTimeout:                                              */

#define LIN_TO_WAKEUPDEL        0u  /* Wakeup timeout;                      */
/*                              1u  - MaxFrame timeout for 1 byte message;  */
/*                              2u  - MaxFrame timeout for 2 bytes message; */
/*                              3u  - MaxFrame timeout for 3 bytes message; */
/*                              4u  - MaxFrame timeout for 4 bytes message; */
/*                              5u  - MaxFrame timeout for 5 bytes message; */
/*                              6u  - MaxFrame timeout for 6 bytes message; */
/*                              7u  - MaxFrame timeout for 7 bytes message; */
/*                              8u  - MaxFrame timeout for 8 bytes message; */

#define LIN_TO_BREAK            9u  /* Break timeout                        */
#define LIN_TO_SYNCDEL          10u /* Sync Delimiter timeout               */
/****************************************************************************/

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

void            LIN_SetTimeout( LIN_BYTE timeoutIndex );
void            LIN_CancelTimeout( void );

/*****************************************************************************
 *                              Macros
 *****************************************************************************/

/**************************************************************************
 * Function :   LIN_TimerInit
 *
 * Description: Timer Module Initialization
 *
 * Returns:     none
 *
 * Notes:       none
 *
 **************************************************************************/
#define LIN_MAXMODULO   0xFFFFu

#define LIN_TimerInit()                                                                         \
    LIN_TASC &= ~LIN_TM_PR;                                     /* clear prescaler */           \
    LIN_TASC |= (LIN_TM_PR & LIN_CfgConst.LIN_TimerPrescaler);  /* set prescaler */             \
    LIN_TAMOD = LIN_MAXMODULO;                                  /* set maximum modulo value */  \
    /* clear interrupt flag and disable interrupt channel 0;                                    \
       channel 0 performs output compare with "1" set */                                        \
    LIN_TASC0 = (LIN_TASC0 & (~(LIN_TM_CHXF | LIN_TM_CHXIE | LIN_TM_MSXB | LIN_TM_TOVX))) |     \
                (LIN_TM_MSXA | LIN_TM_ELSXB | LIN_TM_ELSXA);                                    \
    /* enable timer */                                                                          \
    LIN_TASC &= ~LIN_TM_TSTOP

/*****************************************************************************/

#endif /* defined(MASTER) */

#endif /* !define (LINTMR_H) */

⌨️ 快捷键说明

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