?? canbuscore.c
字號:
/*
* canbuscore.c
* Copyright (c) 2001 J黵gen Eder <Juergen.Eder@gmx.de>
*
* A general canbus driver. To use this, you need also a
* hardware driver (for example: sja1000.o + can200par.o).
* Tested under Linux 2.4.20 on i386 PC architecture.
*
* installation:
*
* make all
* make install
*
* char-major numbers up to 240 are "LOCAL/EXPERIMENTAL" (see /usr/src/linux/Documentation/devices.txt)
* char-major 91 is reserved for CAN BUS
* insert following lines into /etc/modules.conf:
*
* only ELEKTOR CAN Card
* --------------------------------------------------
* alias char-major-91 elektor_canpar
*
*
* or only CAN200 Card
* --------------------------------------------------
* alias char-major-91 can200par
*
*
* or both CAN Cards (kernel < 2.4.0)
* --------------------------------------------------
* alias char-major-91 elektor_canpar
* post-install elektor_canpar /sbin/modprobe "-k" can200par
*
*
* or both CAN Cards (kernel >= 2.4.0, this also work with 2.2.x)
* --------------------------------------------------
* alias char-major-91 canbus
* probeall canbus elektor_canpar can200par
* --------------------------------------------------
*
* Also set the IRQ for the parport driver
* for example (IRQ 7 for LPT1):
* --------------------------------------------------
* options parport_pc io=0x378 irq=7,none
* --------------------------------------------------
*
* After changing "modules.conf" do a "depmod -a"
*
* Kernel > 2.5 need a "generate-modprobe.conf"
*
* Reload the parport driver:
* rmmod parport_pc
* modprobe parport_pc io=0x378 irq=7
*
*
* This program 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
* of the License, or (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#define EXPORT_SYMTAB
#define CANBUS4LINUX_CLEARTEXT_COMMANDS
#include <linux/version.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/parport.h>
#include <linux/ioctl.h>
#include <asm/uaccess.h>
#include <linux/poll.h>
#include <linux/proc_fs.h>
#include <linux/delay.h>
#include <linux/time.h>
#include <linux/fs.h>
#include <linux/kdev_t.h>
#include "trace.h"
#include "canbus4linux.h"
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
#define canbuscore_check_area(a,b,c) access_ok(a,b,c)
#define NUM_CANBUS_DEVICES 10
#define MAX_DEVICE_INFO (2*MAX_DEVICE_NAME_LENGTH)
#define NUMBER_OF_WRITE_BUFFER (100)
#define MAX_EVENTS (2*NUMBER_OF_WRITE_BUFFER)
int canbus4linux_fasync(int fd, struct file *file, int mode);
void *Allocate_Memory(unsigned long s);
void Free_Memory(void *p);
struct canbus_time GetTime(void);
struct canbus_intern_transmit
{
struct canbus_transmit_data data;
struct file *fa_file;
};
struct proc_registers
{
struct canbus_admin *pAdmin;
u16 register_nr;
};
struct canbus_file;
struct canbus_admin
{
/* W I C H T I G
* Bei 膎derungen mu
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -