2 * Linux CAN-bus device driver.
3 * Written by Arnaud Westenberg email:arnaud@wanadoo.nl
4 * Rewritten for new CAN queues by Pavel Pisa - OCERA team member
5 * email:pisa@cmp.felk.cvut.cz
6 * This software is released under the GPL-License.
7 * Version lincan-0.3 17 Jun 2004
12 #include "../include/can.h"
13 #include "../include/can_sysdep.h"
14 #include "../include/main.h"
16 #include <rtl_posixio.h>
17 #include "../include/ioctl.h"
18 #include "../include/can_iortl.h"
21 int can_ioctl_rtl_posix(struct rtl_file *fptr, unsigned int cmd, unsigned long arg)
23 struct canuser_t *canuser =
24 (struct canuser_t *)can_get_rtl_file_private_data(fptr);
26 unsigned short channel=0;
27 unsigned btr0=0, btr1=0;
30 struct canque_ends_t *qends;
32 if(!canuser || (canuser->magic != CAN_USER_MAGIC)){
33 CANMSG("can_ioctl_: bad canuser magic\n");
37 obj = canuser->msgobj;
39 CANMSG("Could not assign buffer structure\n");
43 qends = canuser->qends;
46 CANMSG("Device is not correctly configured.\n");
47 CANMSG("Please reload the driver.\n");
53 return can_ioctl_query(canuser, arg);
56 for (i=0x0; i<0x100; i++)
57 CANMSG("0x%x is 0x%x\n",i,can_read_reg(chip,i));
61 if (chip->chipspecops->start_chip(chip))
66 if (chip->chipspecops->stop_chip(chip))
71 canque_flush(canuser->rx_edge0);
75 if(canuser->rx_edge0){
76 canque_set_filt(canuser->rx_edge0, arg, ~0, 0);
83 struct canfilt_t canfilt=*(struct canfilt_t *)arg;
84 if(canuser->rx_edge0){
85 canque_set_filt(canuser->rx_edge0, canfilt.id, canfilt.mask, canfilt.flags);
92 btr0 = (arg >> 8) & 0xff;
93 btr1 = (arg >> 16) & 0xff;
95 if (chip->chipspecops->set_btregs(chip, btr0, btr1)) {
96 CANMSG("Error setting bit timing registers\n");
102 CANMSG("Not a valid ioctl command\n");
111 #endif /*CAN_WITH_RTL*/