author | Christian Taedcke |
Wed, 10 Nov 2010 14:19:31 +0100 | |
changeset 650 | 58b07a7e695b |
parent 631 | 08b6b903f84a |
permissions | -rw-r--r-- |
391
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
1 |
/* |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
2 |
This file is part of CanFestival, a library implementing CanOpen Stack. |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
3 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
4 |
Copyright (C): Edouard TISSERANT and Francis DUPIN |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
5 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
6 |
See COPYING file for copyrights details. |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
7 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
8 |
This library is free software; you can redistribute it and/or |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
9 |
modify it under the terms of the GNU Lesser General Public |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
10 |
License as published by the Free Software Foundation; either |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
11 |
version 2.1 of the License, or (at your option) any later version. |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
12 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
13 |
This library is distributed in the hope that it will be useful, |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
16 |
Lesser General Public License for more details. |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
17 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
18 |
You should have received a copy of the GNU Lesser General Public |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
19 |
License along with this library; if not, write to the Free Software |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
20 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
21 |
*/ |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
22 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
23 |
/* |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
24 |
Virtual CAN driver. |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
25 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
26 |
Modification of drivers/can_virtual/can_virtual.c: |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
27 |
Rewritten from user-space library to kernel-space module with exported symbols |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
28 |
*/ |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
29 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
30 |
#include <linux/module.h> |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
31 |
#include <linux/err.h> |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
32 |
#include <linux/kfifo.h> |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
33 |
#include <linux/spinlock.h> |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
34 |
#include <linux/sched.h> |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
35 |
#include <linux/wait.h> |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
36 |
#include <linux/string.h> |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
37 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
38 |
#define NEED_PRINT_MESSAGE |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
39 |
#include "can_driver.h" |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
40 |
#include "def.h" |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
41 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
42 |
MODULE_LICENSE("GPL"); |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
43 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
44 |
#define MAX_NB_CAN_PIPES 16 |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
45 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
46 |
typedef struct { |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
47 |
char used; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
48 |
struct kfifo *pipe; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
49 |
spinlock_t lock; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
50 |
wait_queue_head_t w_queue; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
51 |
} CANPipe; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
52 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
53 |
CANPipe canpipes[MAX_NB_CAN_PIPES] = {{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},}; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
54 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
55 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
56 |
/*********functions which permit to communicate with the board****************/ |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
57 |
UNS8 canReceive_driver(CAN_HANDLE fd0, Message *m) |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
58 |
{ |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
59 |
long ret = wait_event_interruptible (((CANPipe*)fd0)->w_queue, |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
60 |
kfifo_len (((CANPipe*)fd0)->pipe) >= sizeof(Message)); |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
61 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
62 |
// interrupted by signal |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
63 |
if (ret == -ERESTARTSYS) |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
64 |
return 2; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
65 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
66 |
if (kfifo_get (((CANPipe*)fd0)->pipe, (unsigned char *)m, sizeof(Message)) != sizeof(Message)) |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
67 |
{ |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
68 |
printk(KERN_NOTICE "can_virtual: error receiving data from kernel fifo.\n"); |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
69 |
return 1; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
70 |
} |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
71 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
72 |
return 0; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
73 |
} |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
74 |
|
631 | 75 |
UNS8 canSend_driver(CAN_HANDLE fd0, Message const *m) |
391
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
76 |
{ |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
77 |
int i; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
78 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
79 |
printk(KERN_INFO "%x->[ ", (CANPipe*)fd0 - &canpipes[0]); |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
80 |
for(i=0; i < MAX_NB_CAN_PIPES; i++) |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
81 |
{ |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
82 |
if(canpipes[i].used && &canpipes[i] != (CANPipe*)fd0) |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
83 |
{ |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
84 |
printk("%x ",i); |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
85 |
} |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
86 |
} |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
87 |
printk(" ]"); |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
88 |
print_message(m); |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
89 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
90 |
// send to all readers, except myself |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
91 |
for(i=0; i < MAX_NB_CAN_PIPES; i++) |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
92 |
{ |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
93 |
if(canpipes[i].used && &canpipes[i] != (CANPipe*)fd0) |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
94 |
{ |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
95 |
unsigned int len; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
96 |
len = kfifo_put (canpipes[i].pipe, (unsigned char *)m, sizeof(Message)); |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
97 |
if (len != sizeof(Message)) { |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
98 |
printk(KERN_NOTICE "can_virtual: error sending data to kernel fifo.\n"); |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
99 |
return 1; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
100 |
} |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
101 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
102 |
// wake up canReceive_driver() |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
103 |
wake_up_interruptible (&canpipes[i].w_queue); |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
104 |
} |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
105 |
} |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
106 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
107 |
return 0; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
108 |
} |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
109 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
110 |
int TranslateBaudRate(char* optarg){ |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
111 |
if(!strcmp( optarg, "1M")) return (int)1000; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
112 |
if(!strcmp( optarg, "500K")) return (int)500; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
113 |
if(!strcmp( optarg, "250K")) return (int)250; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
114 |
if(!strcmp( optarg, "125K")) return (int)125; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
115 |
if(!strcmp( optarg, "100K")) return (int)100; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
116 |
if(!strcmp( optarg, "50K")) return (int)50; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
117 |
if(!strcmp( optarg, "20K")) return (int)20; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
118 |
if(!strcmp( optarg, "10K")) return (int)10; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
119 |
if(!strcmp( optarg, "5K")) return (int)5; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
120 |
if(!strcmp( optarg, "none")) return 0; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
121 |
return 0x0000; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
122 |
} |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
123 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
124 |
UNS8 canChangeBaudRate_driver( CAN_HANDLE fd0, char* baud) |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
125 |
{ |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
126 |
printk("%x-> changing to baud rate %s[%d]\n", (CANPipe*)fd0 - &canpipes[0],baud,TranslateBaudRate(baud)); |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
127 |
return 0; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
128 |
} |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
129 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
130 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
131 |
CAN_HANDLE canOpen_driver(s_BOARD *board) |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
132 |
{ |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
133 |
int i; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
134 |
for(i=0; i < MAX_NB_CAN_PIPES; i++) |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
135 |
{ |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
136 |
if(!canpipes[i].used) |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
137 |
break; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
138 |
} |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
139 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
140 |
// initialize CANPipe structure |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
141 |
init_waitqueue_head(&canpipes[i].w_queue); |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
142 |
canpipes[i].lock = SPIN_LOCK_UNLOCKED; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
143 |
canpipes[i].pipe = kfifo_alloc (10*sizeof(Message), GFP_KERNEL, &canpipes[i].lock); |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
144 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
145 |
if (i==MAX_NB_CAN_PIPES || (PTR_ERR(canpipes[i].pipe) == -ENOMEM)) |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
146 |
{ |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
147 |
printk (KERN_NOTICE "can_virtual: error initializing driver.\n"); |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
148 |
return (CAN_HANDLE)NULL; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
149 |
} |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
150 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
151 |
canpipes[i].used = 1; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
152 |
return (CAN_HANDLE) &canpipes[i]; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
153 |
} |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
154 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
155 |
int canClose_driver(CAN_HANDLE fd0) |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
156 |
{ |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
157 |
((CANPipe*)fd0)->used = 0; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
158 |
kfifo_free (((CANPipe*)fd0)->pipe); |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
159 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
160 |
return 0; |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
161 |
} |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
162 |
|
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
163 |
EXPORT_SYMBOL(canOpen_driver); |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
164 |
EXPORT_SYMBOL(canClose_driver); |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
165 |
EXPORT_SYMBOL(canSend_driver); |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
166 |
EXPORT_SYMBOL(canReceive_driver); |
7802a7d5584f
Accepted Vladimir Chren linux kernelspace port patch.
etisserant
parents:
diff
changeset
|
167 |
EXPORT_SYMBOL(canChangeBaudRate_driver); |