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

📄 mscandrv.h

📁 freescale最新的16位单片机
💻 H
字号:
/******************************************************************************
Copyright (c) Motorola 2000
File Name          :    $RCSfile: msCANdrv.h,v $

Engineer           :    $Author: r52458 $

Location           :    EKB

Date Created       :    25/05/98

Current Revision :      $Revision: 1.0 $

Notes            :  General header file for msCAN driver.

*******************************************************************************
Motorola reserves the right to make changes without further notice to any
product herein to improve reliability, function or design. Motorola does
not assume any liability arising out ot the application or use of any
product, circuit, or software described herein; neither does it convey any
license under its patent rights nor the rights of others. Motorola products
are not designed, intended, or authorized for use as components in systems
intended for surgical implant into the body, or other applications intended
to support life, or for any other application in which the failure of the
Motorola product could create a situation where personal injury or death may
occur. Should Buyer purchase or use Motorola products for any such unintended
or unauthorized application, Buyer shall idemnify and hold Motorola and its
officers, employees, subsidiaries, affiliates, and distributors harmless
against all claims costs, damages, and expenses, and reasonable attorney fees
arising out of, directly or indirectly, any claim of personal injury or death
associated with such unintended or unathorized use, even if such claim alleges
that Motorola was negligent regarding the design or manufacture of the part.
Motorola and the Motorola logo* are registered trademarks of Motorola Ltd.
******************************************************************************/


#ifndef MSCANDRV_H
#define MSCANDRV_H           /* This header file */

#include "msCANstd.h"

/******************************************************************************
Identifier types
******************************************************************************/
#define STANDARD  0                                 /* IDE clear */
#define EXTENDED  0x18                                /* set SRR and IDE */
#define IDE       0x08                                /* IDE bit */
#define ERTR      0x01                                /* RTR bit for Extended ID */
#define SRTR      0x10                                /* RTR bit for Standard ID */

#define DATAFRAME 0                                 /* RTR clear */

/******************************************************************************
Clock source specifiers
******************************************************************************/
#define XTAL     0                                  /* bit values for CLKSRC */
#define ECLKX2   1
#define CLK      1

/******************************************************************************
MSCAN Enable
******************************************************************************/
#define MSCAN_ENABLE 1


/******************************************************************************
Transmit Buffer specifiers
******************************************************************************
#define TX_BUFF0 0x01
#define TX_BUFF1 0x02
#define TX_BUFF2 0x04         */

/******************************************************************************
Acceptance filter size: CANIDAC value
******************************************************************************/
#define AF32BIT  0x00
#define AF16BIT  0x10
#define AF8BIT   0x20
#define AFCLOSED 0x30

/******************************************************************************
word typedef
******************************************************************************/
typedef union
{
      UINT16 word;
      struct
      {
            UINT8 upper;
            UINT8 lower;
      }byte;
}wordType;

/******************************************************************************
Enumerations
******************************************************************************/
enum CAN_Num   { CAN0,         /* 0 */
                 CAN1,         /* 1 */
                 CAN2,         /* 2 */
                 CAN3          /* 3 */
               };

enum ResetMode { CMPTX,        /* 0 */
                 FAST          /* 1 */
               };

enum ErrorCode { ERR_OK,       /* 0 */
                 ERR_MODE,     /* 1 */
                 ERR_CAN,      /* 2 */
                 ERR_INIT,     /* 3 */
                 ERR_BOFF,     /* 4 */
                 ERR_NSLP,     /* 5 */
                 ERR_ID,       /* 6 */
                 ERR_MB,       /* 7 */
                 ERR_DLC,      /* 8 */
                 ERR_CONFIG,   /* 9 */
                 ERR_QED,      /* 10 */
                 ERR_NOTQED,   /* 11 */
                 ERR_NODATA,   /* 12 */
                 ERR_SYNCH,    /* 13 */
                 ERR_TS        /* 14 */
               };

enum MB_Mode   { CLOSED,       /* 0 */
                 RXDF,         /* 1 */
                 TXDF,         /* 2 */
                 TXRF,         /* 3 */
                 AUTOTXDF,     /* 4 */
                 INVALID
               };

enum MB_Status { NODATA,          /* 0 */
                 VALIDDATA,       /* 1 */
                 QUEUED,          /* 2 */
                 QUEUED2,         /* 3 */
                 ABORTREQ,        /* 4 */
                 ABORTED,         /* 5 */
                 TRANSMITTED,     /* 6 */        /* this value onwards valid status for ReadTimeMB */
                 NEWDATA,         /* 7 */
                 READDATA,        /* 8 */
                 OVERRUN          /* 9 */
               };

enum Version   { MSCAN08_L_01,
                 MSCAN12_L_01,
                 MSCAN12_2_01,
                 MSCAN12_3_01,
                 MSCAN12_4_01
               };

/******************************************************************************
Prototypes
******************************************************************************/
#ifdef  BANKED
#ifdef  COSMIC
@far UINT8 CAN_Init                       (UINT8, UINT8);
@far UINT8 CAN_Reset                      (UINT8, UINT8);
@far UINT8 CAN_Sleep                      (UINT8, UINT8);
@far UINT8 CAN_Wakeup                     (UINT8);
@far UINT8 CAN_CheckStatus                (UINT16 *, UINT8);
@far UINT8 CAN_ClearStatus                (UINT8);
@far UINT8 CAN_ConfigMB                   (UINT8, UINT8, UINT8, UINT8);
@far UINT8 CAN_CheckStatusMB              (UINT8, UINT8 *, UINT8);
@far UINT8 CAN_LoadMB                     (UINT8, UINT8 *, UINT8);
@far UINT8 CAN_TransmitMB                 (UINT8, UINT8);
@far UINT8 CAN_AbortMB                    (UINT8, UINT8);
@far UINT8 CAN_ReadDataMB                 (UINT8, UINT8 *, UINT8);
@far UINT8 CAN_ReadTimeMB                 (UINT8, UINT16 *, UINT8);
@far UINT8 CAN_ReadMB                     (UINT8, UINT8 *, UINT8);
@far UINT8 CAN_GetVersion                 (void);
#else /* not COSMIC */
UINT8 CAN_Init                            (UINT8, UINT8);
UINT8 CAN_Reset                           (UINT8, UINT8);
UINT8 CAN_Sleep                           (UINT8, UINT8);
UINT8 CAN_Wakeup                          (UINT8);
UINT8 CAN_CheckStatus                     (UINT16 *, UINT8);
UINT8 CAN_ClearStatus                     (UINT8);
UINT8 CAN_ConfigMB                        (UINT8, UINT8, UINT8, UINT8);
UINT8 CAN_CheckStatusMB                   (UINT8, UINT8 *, UINT8);
UINT8 CAN_LoadMB                          (UINT8, UINT8 *, UINT8);
UINT8 CAN_TransmitMB                      (UINT8, UINT8);
UINT8 CAN_AbortMB                         (UINT8, UINT8);
UINT8 CAN_ReadDataMB                      (UINT8, UINT8 *, UINT8);
UINT8 CAN_ReadTimeMB                      (UINT8, UINT16 *, UINT8);
UINT8 CAN_ReadMB                          (UINT8, UINT8 *, UINT8);
UINT8 CAN_GetVersion                      (void);
#endif  /* COSMIC */
#else /* not BANKED (lite) */

#define CAN_Init(a, b)              CAN_L_Init(a)
#define CAN_Reset(a, b)             CAN_L_Reset(a)
#define CAN_Sleep(a, b)             CAN_L_Sleep(a)
#define CAN_Wakeup(a)               CAN_L_Wakeup()
#define CAN_CheckStatus(a, b)       CAN_L_CheckStatus(a)
#define CAN_ClearStatus(a)          CAN_L_ClearStatus()
#define CAN_ConfigMB(a, b, c, d)    CAN_L_ConfigMB(a, b, c)
#define CAN_CheckStatusMB(a, b, c)  CAN_L_CheckStatusMB(a, b)
#define CAN_LoadMB(a, b, c)         CAN_L_LoadMB(a, b)
#define CAN_TransmitMB(a, b)        CAN_L_TransmitMB(a)
#define CAN_AbortMB(a, b)           CAN_L_AbortMB(a)
#define CAN_ReadDataMB(a, b, c)     CAN_L_ReadDataMB(a, b)
#define CAN_ReadTimeMB(a, b, c)     CAN_L_ReadTimeMB(a, b)
#define CAN_ReadMB(a, b, c)         CAN_L_ReadMB(a, b)

UINT8 CAN_L_Init                          (UINT8);
UINT8 CAN_L_Reset                         (UINT8);
UINT8 CAN_L_Sleep                         (UINT8);
UINT8 CAN_L_Wakeup                        (void);
UINT8 CAN_L_CheckStatus                   (UINT16 *);
UINT8 CAN_L_ClearStatus                   (void);
UINT8 CAN_L_ConfigMB                      (UINT8, UINT8, UINT8);
UINT8 CAN_L_CheckStatusMB                 (UINT8, UINT8 *);
UINT8 CAN_L_LoadMB                        (UINT8, UINT8 *);
UINT8 CAN_L_TransmitMB                    (UINT8);
UINT8 CAN_L_AbortMB                       (UINT8);
UINT8 CAN_L_ReadDataMB                    (UINT8, UINT8 *);
UINT8 CAN_L_ReadTimeMB                    (UINT8, UINT16 *);
UINT8 CAN_L_ReadMB                        (UINT8, UINT8 *);
UINT8 CAN_GetVersion                      (void);
#endif  /* BANKED */

/*****************************************************************************/
#endif        /* end msCANdrv.h */

⌨️ 快捷键说明

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