📄 drv_can.h
字号:
/**********************************************************************/
/* */
/* File name: drv_can.h */
/* */
/* Since: 2005-Jan-19 */
/* */
/* Version: PICos18 v2.00 */
/* Copyright (C) 2003, 2004, 2005 Pragmatec. */
/* CAN driver v1.00 (initial release) */
/* */
/* Author: Designed by Pragmatec S.A.R.L. www.pragmatec.net */
/* MONTAGNE Xavier [XM] xavier.montagne@pragmatec.net */
/* */
/* Purpose: PIC18 CAN peripheral management. */
/* It allows task tosend data at the send time through a */
/* dedicated FIFO, and to wait for a certain CAN frame. */
/* */
/* Distribution: This file is part of PICos18. */
/* PICos18 is free software; you can redistribute it */
/* and/or modify it under the terms of the GNU General */
/* Public License as published by the Free Software */
/* Foundation; either version 2, or (at your option) */
/* any later version. */
/* */
/* PICos18 is distributed in the hope that it will be */
/* useful, but WITHOUT ANY WARRANTY; without even the */
/* implied warranty of MERCHANTABILITY or FITNESS FOR A */
/* PARTICULAR PURPOSE. See the GNU General Public */
/* License for more details. */
/* */
/* You should have received a copy of the GNU General */
/* Public License along with gpsim; see the file */
/* COPYING.txt. If not, write to the Free Software */
/* Foundation, 59 Temple Place - Suite 330, */
/* Boston, MA 02111-1307, USA. */
/* */
/* > A special exception to the GPL can be applied should */
/* you wish to distribute a combined work that includes */
/* PICos18, without being obliged to provide the source */
/* code for any proprietary components. */
/* */
/* History: */
/* 2005/01/19 [XM] Create this file. */
/* */
/**********************************************************************/
#ifndef _CAN_DRV_H_
#define _CAN_DRV_H_
#include "pro_man.h"
#include "even_man.h"
#include "alarm.h"
#ifndef NULL
#define NULL 0
#endif
/*****************************************************
* Definition dedicated to the local functions.
****************************************************/
#define CAN_MSG_SENT 0x02
#define CAN_FREE 0x00
#define CAN_FULL 0x01
#define CAN_EMPTY 0x00
#define TRUE 0x01
#define FALSE 0x00
#define TX_MESSAGE 0x01
#define RX_MESSAGE 0x00
struct _CAN_frame {
unsigned char SIDH;
unsigned char SIDL;
unsigned char length;
unsigned char data[8];
unsigned char CallerID;
unsigned char state;
struct _CAN_frame *next;
};
typedef struct _CAN_frame CAN_message_t, *CAN_message_tRef;
#define CAN_freeMsg(x) x.state = CAN_FREE;
StatusType CAN_enqMsg(CAN_message_tRef toEnqueue);
CAN_message_tRef CAN_deqMsg(void);
StatusType CopyHard2FrameBuffer(void);
StatusType CopyFrameBuffer2Hard(void);
StatusType WriteCANBuffer(void);
StatusType ReadCANBuffer(void);
StatusType CAN_RCV_Register(CAN_message_tRef toEnqueue);
void CAN_config(void);
#endif /* _CAN_DRV_H_ */
/* End of File : drv_can.h */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -