📄 canop.h
字号:
/***************************************************************************
canop.h - description
-------------------
begin : Fri May 17 2002
copyright : (C) 2002 by Raphael Zulliger
email : zulli@hsr.ch
***************************************************************************/
/***************************************************************************
* *
* This library is Copyright (c) Raphael Zulliger <zulli@gmx.net>. *
* It is licensed under the GNU Library General Public License (LGPL). *
* *
***************************************************************************/
/***************************************************************************
* *
* *
***************************************************************************/
#ifndef __canop_h__
#define __canop_h__
#include <def.h>
#include <general.h>
#include <init.h>
/** Sends a CAN-Message to the bus
* \return 1 if the message has been sent, 0 if sending of the message failed.
*/
BYTE canSend( BYTE, Message*);
/** Reads a CAN-Message from the CAN-buffer of the PIC microcontroller
* \return 0 if a new message has received, 1 if no new message arrived.
*/
BYTE canReceive( BYTE, Message*);
/** Sets up the CAN-Interface of the PIC microcontroller
*/
void setupCanInterface( sInitParameter* );
/** This function does nothing, because it isn't useful for microcontrollers, isn't it?
*/
void closeCanInterface( void );
typedef struct td_s_rx_buffer_message
{
BOOL valid; // if set to true, the message is valid: so it has been written
// but not yet read. if false, the message has not been written
// yet, or is neither valid.
Message m; // contains the message itself
} s_rx_buffer_message;
// this is the buffer, where all incoming can/canopen messages are stored
// a valid flag indicates wheter an entry is valid or not. if someone/thing
// reads/processes a message it must! set the valid flag to false!
extern s_rx_buffer_message RAM canMessageRxBuffer[RX_CAN_BUFFER_SIZE];
#ifdef ARBRACAN
// taken from arbracan
#define MESS_BUFF_SIZE 256
#define PRIORITY_LEVELS 8
/* ioctl's for canboard. */
#define SCHAR_MAJOR 91
#define CANBOARD_IOCTL_BASE 0x7a
#define CANBOARD_READ _IOR(CANBOARD_IOCTL_BASE, 0, unsigned long)
#define CANBOARD_WRITE _IOW(CANBOARD_IOCTL_BASE, 2, unsigned long)
#define CANBOARD_STATUS _IOR(CANBOARD_IOCTL_BASE, 4, unsigned long)
/* No blocking access in RealTime OS*/
#define CANBOARD_READ_BLOCK _IOR(CANBOARD_IOCTL_BASE, 1, unsigned long)
#define CANBOARD_WRITE_BLOCK _IOW(CANBOARD_IOCTL_BASE, 3, unsigned long)
#define Rx 0
#define Tx 1
#endif // ARBRACAN
#endif // #define __canop_h__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -