]> rtime.felk.cvut.cz Git - lincan.git/blob - lincan/src/devcommon.c
dce205a620507805cf4ca1f3342041f820daeda8
[lincan.git] / lincan / src / devcommon.c
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
7  */
8
9 #include "../include/can.h"
10 #include "../include/can_sysdep.h"
11 #include "../include/can_queue.h"
12 #include "../include/main.h"
13 #include "../include/devcommon.h"
14
15 void canqueue_notify_chip(struct canque_ends_t *qends, struct canque_edge_t *qedge, int what)
16 {
17         struct chip_t *chip=qends->endinfo.chipinfo.chip;
18         struct msgobj_t *obj=qends->endinfo.chipinfo.msgobj;
19
20         DEBUGMSG("canqueue_notify_chip for edge %d and event %d\n",qedge->edge_num,what);
21         switch(what){
22                 /*case CANQUEUE_NOTIFY_EMPTY:*/
23                 /*case CANQUEUE_NOTIFY_SPACE:*/
24                 /*case CANQUEUE_NOTIFY_NOUSR:
25                         wake_up(&qends->endinfo.chipinfo.daemonq);
26                         break;*/
27                 case CANQUEUE_NOTIFY_PROC:
28                         /*wake_up(&qends->endinfo.chipinfo.daemonq);*/
29                         chip->chipspecops->wakeup_tx(chip, obj);
30                         break;
31                 case CANQUEUE_NOTIFY_DEAD_WANTED:
32                 case CANQUEUE_NOTIFY_DEAD:
33                         if(canque_fifo_test_and_clear_fl(&qedge->fifo, READY))
34                                 canque_edge_decref(qedge);
35                         break;
36                 case CANQUEUE_NOTIFY_ATTACH:
37                         break;
38         }
39 }
40
41
42 int canqueue_ends_init_chip(struct canque_ends_t *qends, struct chip_t *chip, struct msgobj_t *obj)
43 {
44         int ret;
45         ret=canqueue_ends_init_gen(qends);
46         if(ret<0) return ret;
47         
48         qends->context=NULL;
49         init_waitqueue_head(&qends->endinfo.chipinfo.daemonq);
50         qends->endinfo.chipinfo.chip=chip;
51         qends->endinfo.chipinfo.msgobj=obj;
52         qends->notify=canqueue_notify_chip;
53
54         DEBUGMSG("canqueue_ends_init_chip\n");
55         return 0;
56 }
57
58
59 int canqueue_ends_done_chip(struct canque_ends_t *qends)
60 {
61         return 0;
62 }