?? mscan.h
字號:
/*******************************************************************************/
/**
Copyright (c) 2007 Freescale Semiconductor
\file MSCAN.h
\brief MSCAN definitions and function prototypes
\author Freescale Semiconductor
\author B05114
\version 0.1
\date January/ 2008
*/
/*******************************************************************************/
#ifndef _MSCAN_H
#define _MSCAN_H
/* Data types definitions */
typedef unsigned char UINT8; /*unsigned 8 bit definition */
typedef unsigned short UINT16; /*unsigned 16 bit definition*/
typedef unsigned long UINT32; /*unsigned 32 bit definition*/
/* MSCAN module configuration constants */
/* Baud rate = CANCLK/(Prescaler * time quantas) */
#define CAN_CLK 0 /* Clock source: 0 for external oscillator, 1 for bus clock */
#define TIME_SEGM1 4 /* Time Segment 1 = 5 */
#define TIME_SEGM2 1 /* Time Segment 2 = 2 */
/* TSEG1 + TSEG2 + SYNCH_SEG = 8 time quantas */
/* Prescaler = CANCLK/(Baud rate * time quantas) = 4MHz/(500kHz * 8) = 1 */
#define CAN_PRESC 0 /* Baud rate prescaler = 1 */
#define CAN_SYNJW 1 /* Sinchronization jump width = 2 clock cycles */
/* Identifiers */
#define CAN_TXID 0x085 /* Transmit message */
#define CAN_RXID 0x080 /* Receive message */
#define CAN_MASK 0x00F /* Four LSBs don't care for the filtering */
/* CAN ID definition: Standard Id formatted to be loaded in IDRx */
#define STD_ID ((UINT32)(CAN_TXID) << 21)
/* Acceptance Code Definitions */
#define ACC_CODE_ID (CAN_RXID << 5) /* Standard Id */
#define ACC_CODE_ID_HIGH ((ACC_CODE_ID&0xFF00)>>8)
#define ACC_CODE_ID_LOW (ACC_CODE_ID&0x00FF)
/* Mask Code Definitions */
#define MASK_CODE_ST_ID (CAN_MASK << 5)
#define MASK_CODE_ST_ID_HIGH ((MASK_CODE_ST_ID&0xFF00)>>8)
#define MASK_CODE_ST_ID_LOW (MASK_CODE_ST_ID&0xFF)
/* Error Flags Definition */
#define NO_ERR 0x00
#define ERR_BUFFER_FULL 0x80
/* Function Prototypes */
/* MSCAN module configuration */
void MSCAN_Init(void);
/* CAN frame transmission */
UINT8 MSCAN_SendFrame(UINT32 CAN_ID, UINT8 Msg_Prio, UINT8 Msg_Length, UINT8 *CANTxData);
/* CAN reception interupt routine */
interrupt void CANRx_ISR(void);
#endif /* _MSCAN_H */
/*******************************************************************************/
/*******************************************************************************/
/* */
/* All software, source code, included documentation, and any implied know-how */
/* are property of Freescale Semiconductor and therefore considered */
/* CONFIDENTIAL INFORMATION. */
/* */
/* This confidential information is disclosed FOR DEMONSTRATION PURPOSES ONLY. */
/* */
/* All Confidential Information remains the property of Freescale Semiconductor*/
/* and will not be copied or reproduced without the express written permission */
/* of the Discloser, except for copies that are absolutely necessary in order */
/* to fulfill the Purpose. */
/* */
/* Services performed by FREESCALE in this matter are performed AS IS and */
/* without any warranty. CUSTOMER retains the final decision relative to the */
/* total design and functionality of the end product. */
/* */
/* FREESCALE neither guarantees nor will be held liable by CUSTOMER for the */
/* success of this project. */
/* */
/* FREESCALE disclaims all warranties, express, implied or statutory including,*/
/* but not limited to, implied warranty of merchantability or fitness for a */
/* particular purpose on any hardware, software ore advise supplied to the */
/* project by FREESCALE, and or any product resulting from FREESCALE services. */
/* */
/* In no event shall FREESCALE be liable for incidental or consequential */
/* damages arising out of this agreement. CUSTOMER agrees to hold FREESCALE */
/* harmless against any and all claims demands or actions by anyone on account */
/* of any damage,or injury, whether commercial, contractual, or tortuous, */
/* rising directly or indirectly as a result of the advise or assistance */
/* supplied CUSTOMER in connectionwith product, services or goods supplied */
/* under this Agreement. */
/* */
/*******************************************************************************/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -