www.pudn.com > 422.rar > serial.h


/*serial.h
 * Header file for the Linux serial-bus driver.
 * Written by wang songyue--bupt   email: wsy5228@sina.com
 * This software is released under the GPL-License.
 * Version 0.1  28 oct 2005
*/

#include 
#include 

#ifndef PACKED
#define PACKED __attribute__((packed))
#endif

#define CAN_MSG_LENGTH 8

struct serialmsg_t {
	unsigned int	length;
	char		data[16];
} PACKED;

/* Definitions to use for serialmsg_t flags */
#define MSG_RTR (1<<0)
#define MSG_OVR (1<<1)
#define MSG_EXT (1<<2)

/* CAN ioctl magic number */
#define SERIAL_IOC_MAGIC 'd'

unsigned long bittiming;
unsigned short channel;

/* CAN ioctl functions */
#define CMD_START _IOW(SERIAL_IOC_MAGIC, 1, channel)
#define CMD_STOP _IOW(SERIAL_IOC_MAGIC, 2, channel)
//#define CMD_RESET 3

#define CONF_BAUD _IOW(SERIAL_IOC_MAGIC, 4, bittiming)
//#define CONF_ACCM
//#define CONF_XTDACCM
//#define CONF_TIMING
//#define CONF_OMODE
#define CONF_FILTER _IOW(SERIAL_IOC_MAGIC, 8, unsigned char)
//#define CONF_FENABLE
//#define CONF_FDISABLE


#define STATE _IO(SERIAL_IOC_MAGIC, 9)