1 /* devcommon.c - common device code
2 * Linux CAN-bus device driver.
3 * New CAN queues by Pavel Pisa - OCERA team member
4 * email:pisa@cmp.felk.cvut.cz
5 * This software is released under the GPL-License.
6 * Version lincan-0.2 9 Jul 2003
10 #include <linux/module.h>
11 #include <linux/version.h>
12 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
13 #include <linux/malloc.h>
15 #include <linux/slab.h>
17 #include <linux/wait.h>
18 #include "../include/can.h"
19 #include "../include/can_queue.h"
20 #include "../include/main.h"
21 #include "../include/devcommon.h"
23 void canqueue_notify_chip(struct canque_ends_t *qends, struct canque_edge_t *qedge, int what)
25 struct chip_t *chip=qends->endinfo.chipinfo.chip;
26 struct msgobj_t *obj=qends->endinfo.chipinfo.msgobj;
28 DEBUGMSG("canqueue_notify_chip for edge %d and event %d\n",qedge->edge_num,what);
30 /*case CANQUEUE_NOTIFY_EMPTY:*/
31 /*case CANQUEUE_NOTIFY_SPACE:*/
32 /*case CANQUEUE_NOTIFY_NOUSR:
33 wake_up_interruptible(&qends->endinfo.chipinfo.daemonq);
35 case CANQUEUE_NOTIFY_PROC:
36 /*wake_up_interruptible(&qends->endinfo.chipinfo.daemonq);*/
37 chip->chipspecops->wakeup_tx(chip, obj);
39 case CANQUEUE_NOTIFY_DEAD:
40 if(atomic_read(&qedge->edge_used)>0)
41 atomic_dec(&qedge->edge_used);
43 case CANQUEUE_NOTIFY_ATACH:
44 atomic_inc(&qedge->edge_used);
50 int canqueue_ends_init_chip(struct canque_ends_t *qends, struct chip_t *chip, struct msgobj_t *obj)
53 ret=canqueue_ends_init_gen(qends);
57 init_waitqueue_head(&qends->endinfo.chipinfo.daemonq);
58 qends->endinfo.chipinfo.chip=chip;
59 qends->endinfo.chipinfo.msgobj=obj;
60 qends->notify=canqueue_notify_chip;
62 DEBUGMSG("canqueue_ends_init_chip\n");