Commit b7b4d7a4666454b40b45a853bd1d296af37a85f0
Committed by
Linus Torvalds
1 parent
2a10e0b28b
Exists in
master
and in
7 other branches
[PATCH] drivers/isdn/: "extern inline" -> "static inline"
"extern inline" -> "static inline" Since there's no pullphone() function this patch removes the dead prototype. Signed-off-by: Adrian Bunk <bunk@stusta.de> Acked-by: Karsten Keil <kkeil@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 3 changed files with 4 additions and 5 deletions Inline Diff
drivers/isdn/act2000/act2000.h
1 | /* $Id: act2000.h,v 1.8.6.3 2001/09/23 22:24:32 kai Exp $ | 1 | /* $Id: act2000.h,v 1.8.6.3 2001/09/23 22:24:32 kai Exp $ |
2 | * | 2 | * |
3 | * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000. | 3 | * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000. |
4 | * | 4 | * |
5 | * Author Fritz Elfert | 5 | * Author Fritz Elfert |
6 | * Copyright by Fritz Elfert <fritz@isdn4linux.de> | 6 | * Copyright by Fritz Elfert <fritz@isdn4linux.de> |
7 | * | 7 | * |
8 | * This software may be used and distributed according to the terms | 8 | * This software may be used and distributed according to the terms |
9 | * of the GNU General Public License, incorporated herein by reference. | 9 | * of the GNU General Public License, incorporated herein by reference. |
10 | * | 10 | * |
11 | * Thanks to Friedemann Baitinger and IBM Germany | 11 | * Thanks to Friedemann Baitinger and IBM Germany |
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #ifndef act2000_h | 15 | #ifndef act2000_h |
16 | #define act2000_h | 16 | #define act2000_h |
17 | 17 | ||
18 | #include <linux/compiler.h> | 18 | #include <linux/compiler.h> |
19 | 19 | ||
20 | #define ACT2000_IOCTL_SETPORT 1 | 20 | #define ACT2000_IOCTL_SETPORT 1 |
21 | #define ACT2000_IOCTL_GETPORT 2 | 21 | #define ACT2000_IOCTL_GETPORT 2 |
22 | #define ACT2000_IOCTL_SETIRQ 3 | 22 | #define ACT2000_IOCTL_SETIRQ 3 |
23 | #define ACT2000_IOCTL_GETIRQ 4 | 23 | #define ACT2000_IOCTL_GETIRQ 4 |
24 | #define ACT2000_IOCTL_SETBUS 5 | 24 | #define ACT2000_IOCTL_SETBUS 5 |
25 | #define ACT2000_IOCTL_GETBUS 6 | 25 | #define ACT2000_IOCTL_GETBUS 6 |
26 | #define ACT2000_IOCTL_SETPROTO 7 | 26 | #define ACT2000_IOCTL_SETPROTO 7 |
27 | #define ACT2000_IOCTL_GETPROTO 8 | 27 | #define ACT2000_IOCTL_GETPROTO 8 |
28 | #define ACT2000_IOCTL_SETMSN 9 | 28 | #define ACT2000_IOCTL_SETMSN 9 |
29 | #define ACT2000_IOCTL_GETMSN 10 | 29 | #define ACT2000_IOCTL_GETMSN 10 |
30 | #define ACT2000_IOCTL_LOADBOOT 11 | 30 | #define ACT2000_IOCTL_LOADBOOT 11 |
31 | #define ACT2000_IOCTL_ADDCARD 12 | 31 | #define ACT2000_IOCTL_ADDCARD 12 |
32 | 32 | ||
33 | #define ACT2000_IOCTL_TEST 98 | 33 | #define ACT2000_IOCTL_TEST 98 |
34 | #define ACT2000_IOCTL_DEBUGVAR 99 | 34 | #define ACT2000_IOCTL_DEBUGVAR 99 |
35 | 35 | ||
36 | #define ACT2000_BUS_ISA 1 | 36 | #define ACT2000_BUS_ISA 1 |
37 | #define ACT2000_BUS_MCA 2 | 37 | #define ACT2000_BUS_MCA 2 |
38 | #define ACT2000_BUS_PCMCIA 3 | 38 | #define ACT2000_BUS_PCMCIA 3 |
39 | 39 | ||
40 | /* Struct for adding new cards */ | 40 | /* Struct for adding new cards */ |
41 | typedef struct act2000_cdef { | 41 | typedef struct act2000_cdef { |
42 | int bus; | 42 | int bus; |
43 | int port; | 43 | int port; |
44 | int irq; | 44 | int irq; |
45 | char id[10]; | 45 | char id[10]; |
46 | } act2000_cdef; | 46 | } act2000_cdef; |
47 | 47 | ||
48 | /* Struct for downloading firmware */ | 48 | /* Struct for downloading firmware */ |
49 | typedef struct act2000_ddef { | 49 | typedef struct act2000_ddef { |
50 | int length; /* Length of code */ | 50 | int length; /* Length of code */ |
51 | char __user *buffer; /* Ptr. to code */ | 51 | char __user *buffer; /* Ptr. to code */ |
52 | } act2000_ddef; | 52 | } act2000_ddef; |
53 | 53 | ||
54 | typedef struct act2000_fwid { | 54 | typedef struct act2000_fwid { |
55 | char isdn[4]; | 55 | char isdn[4]; |
56 | char revlen[2]; | 56 | char revlen[2]; |
57 | char revision[504]; | 57 | char revision[504]; |
58 | } act2000_fwid; | 58 | } act2000_fwid; |
59 | 59 | ||
60 | #if defined(__KERNEL__) || defined(__DEBUGVAR__) | 60 | #if defined(__KERNEL__) || defined(__DEBUGVAR__) |
61 | 61 | ||
62 | #ifdef __KERNEL__ | 62 | #ifdef __KERNEL__ |
63 | /* Kernel includes */ | 63 | /* Kernel includes */ |
64 | 64 | ||
65 | #include <linux/sched.h> | 65 | #include <linux/sched.h> |
66 | #include <linux/string.h> | 66 | #include <linux/string.h> |
67 | #include <linux/workqueue.h> | 67 | #include <linux/workqueue.h> |
68 | #include <linux/interrupt.h> | 68 | #include <linux/interrupt.h> |
69 | #include <linux/skbuff.h> | 69 | #include <linux/skbuff.h> |
70 | #include <linux/errno.h> | 70 | #include <linux/errno.h> |
71 | #include <linux/fs.h> | 71 | #include <linux/fs.h> |
72 | #include <linux/major.h> | 72 | #include <linux/major.h> |
73 | #include <asm/io.h> | 73 | #include <asm/io.h> |
74 | #include <linux/kernel.h> | 74 | #include <linux/kernel.h> |
75 | #include <linux/signal.h> | 75 | #include <linux/signal.h> |
76 | #include <linux/slab.h> | 76 | #include <linux/slab.h> |
77 | #include <linux/mm.h> | 77 | #include <linux/mm.h> |
78 | #include <linux/mman.h> | 78 | #include <linux/mman.h> |
79 | #include <linux/ioport.h> | 79 | #include <linux/ioport.h> |
80 | #include <linux/timer.h> | 80 | #include <linux/timer.h> |
81 | #include <linux/wait.h> | 81 | #include <linux/wait.h> |
82 | #include <linux/delay.h> | 82 | #include <linux/delay.h> |
83 | #include <linux/ctype.h> | 83 | #include <linux/ctype.h> |
84 | #include <linux/isdnif.h> | 84 | #include <linux/isdnif.h> |
85 | 85 | ||
86 | #endif /* __KERNEL__ */ | 86 | #endif /* __KERNEL__ */ |
87 | 87 | ||
88 | #define ACT2000_PORTLEN 8 | 88 | #define ACT2000_PORTLEN 8 |
89 | 89 | ||
90 | #define ACT2000_FLAGS_RUNNING 1 /* Cards driver activated */ | 90 | #define ACT2000_FLAGS_RUNNING 1 /* Cards driver activated */ |
91 | #define ACT2000_FLAGS_PVALID 2 /* Cards port is valid */ | 91 | #define ACT2000_FLAGS_PVALID 2 /* Cards port is valid */ |
92 | #define ACT2000_FLAGS_IVALID 4 /* Cards irq is valid */ | 92 | #define ACT2000_FLAGS_IVALID 4 /* Cards irq is valid */ |
93 | #define ACT2000_FLAGS_LOADED 8 /* Firmware loaded */ | 93 | #define ACT2000_FLAGS_LOADED 8 /* Firmware loaded */ |
94 | 94 | ||
95 | #define ACT2000_BCH 2 /* # of channels per card */ | 95 | #define ACT2000_BCH 2 /* # of channels per card */ |
96 | 96 | ||
97 | /* D-Channel states */ | 97 | /* D-Channel states */ |
98 | #define ACT2000_STATE_NULL 0 | 98 | #define ACT2000_STATE_NULL 0 |
99 | #define ACT2000_STATE_ICALL 1 | 99 | #define ACT2000_STATE_ICALL 1 |
100 | #define ACT2000_STATE_OCALL 2 | 100 | #define ACT2000_STATE_OCALL 2 |
101 | #define ACT2000_STATE_IWAIT 3 | 101 | #define ACT2000_STATE_IWAIT 3 |
102 | #define ACT2000_STATE_OWAIT 4 | 102 | #define ACT2000_STATE_OWAIT 4 |
103 | #define ACT2000_STATE_IBWAIT 5 | 103 | #define ACT2000_STATE_IBWAIT 5 |
104 | #define ACT2000_STATE_OBWAIT 6 | 104 | #define ACT2000_STATE_OBWAIT 6 |
105 | #define ACT2000_STATE_BWAIT 7 | 105 | #define ACT2000_STATE_BWAIT 7 |
106 | #define ACT2000_STATE_BHWAIT 8 | 106 | #define ACT2000_STATE_BHWAIT 8 |
107 | #define ACT2000_STATE_BHWAIT2 9 | 107 | #define ACT2000_STATE_BHWAIT2 9 |
108 | #define ACT2000_STATE_DHWAIT 10 | 108 | #define ACT2000_STATE_DHWAIT 10 |
109 | #define ACT2000_STATE_DHWAIT2 11 | 109 | #define ACT2000_STATE_DHWAIT2 11 |
110 | #define ACT2000_STATE_BSETUP 12 | 110 | #define ACT2000_STATE_BSETUP 12 |
111 | #define ACT2000_STATE_ACTIVE 13 | 111 | #define ACT2000_STATE_ACTIVE 13 |
112 | 112 | ||
113 | #define ACT2000_MAX_QUEUED 8000 /* 2 * maxbuff */ | 113 | #define ACT2000_MAX_QUEUED 8000 /* 2 * maxbuff */ |
114 | 114 | ||
115 | #define ACT2000_LOCK_TX 0 | 115 | #define ACT2000_LOCK_TX 0 |
116 | #define ACT2000_LOCK_RX 1 | 116 | #define ACT2000_LOCK_RX 1 |
117 | 117 | ||
118 | typedef struct act2000_chan { | 118 | typedef struct act2000_chan { |
119 | unsigned short callref; /* Call Reference */ | 119 | unsigned short callref; /* Call Reference */ |
120 | unsigned short fsm_state; /* Current D-Channel state */ | 120 | unsigned short fsm_state; /* Current D-Channel state */ |
121 | unsigned short eazmask; /* EAZ-Mask for this Channel */ | 121 | unsigned short eazmask; /* EAZ-Mask for this Channel */ |
122 | short queued; /* User-Data Bytes in TX queue */ | 122 | short queued; /* User-Data Bytes in TX queue */ |
123 | unsigned short plci; | 123 | unsigned short plci; |
124 | unsigned short ncci; | 124 | unsigned short ncci; |
125 | unsigned char l2prot; /* Layer 2 protocol */ | 125 | unsigned char l2prot; /* Layer 2 protocol */ |
126 | unsigned char l3prot; /* Layer 3 protocol */ | 126 | unsigned char l3prot; /* Layer 3 protocol */ |
127 | } act2000_chan; | 127 | } act2000_chan; |
128 | 128 | ||
129 | typedef struct msn_entry { | 129 | typedef struct msn_entry { |
130 | char eaz; | 130 | char eaz; |
131 | char msn[16]; | 131 | char msn[16]; |
132 | struct msn_entry * next; | 132 | struct msn_entry * next; |
133 | } msn_entry; | 133 | } msn_entry; |
134 | 134 | ||
135 | typedef struct irq_data_isa { | 135 | typedef struct irq_data_isa { |
136 | __u8 *rcvptr; | 136 | __u8 *rcvptr; |
137 | __u16 rcvidx; | 137 | __u16 rcvidx; |
138 | __u16 rcvlen; | 138 | __u16 rcvlen; |
139 | struct sk_buff *rcvskb; | 139 | struct sk_buff *rcvskb; |
140 | __u8 rcvignore; | 140 | __u8 rcvignore; |
141 | __u8 rcvhdr[8]; | 141 | __u8 rcvhdr[8]; |
142 | } irq_data_isa; | 142 | } irq_data_isa; |
143 | 143 | ||
144 | typedef union irq_data { | 144 | typedef union irq_data { |
145 | irq_data_isa isa; | 145 | irq_data_isa isa; |
146 | } irq_data; | 146 | } irq_data; |
147 | 147 | ||
148 | /* | 148 | /* |
149 | * Per card driver data | 149 | * Per card driver data |
150 | */ | 150 | */ |
151 | typedef struct act2000_card { | 151 | typedef struct act2000_card { |
152 | unsigned short port; /* Base-port-address */ | 152 | unsigned short port; /* Base-port-address */ |
153 | unsigned short irq; /* Interrupt */ | 153 | unsigned short irq; /* Interrupt */ |
154 | u_char ptype; /* Protocol type (1TR6 or Euro) */ | 154 | u_char ptype; /* Protocol type (1TR6 or Euro) */ |
155 | u_char bus; /* Cardtype (ISA, MCA, PCMCIA) */ | 155 | u_char bus; /* Cardtype (ISA, MCA, PCMCIA) */ |
156 | struct act2000_card *next; /* Pointer to next device struct */ | 156 | struct act2000_card *next; /* Pointer to next device struct */ |
157 | spinlock_t lock; /* protect critical operations */ | 157 | spinlock_t lock; /* protect critical operations */ |
158 | int myid; /* Driver-Nr. assigned by linklevel */ | 158 | int myid; /* Driver-Nr. assigned by linklevel */ |
159 | unsigned long flags; /* Statusflags */ | 159 | unsigned long flags; /* Statusflags */ |
160 | unsigned long ilock; /* Semaphores for IRQ-Routines */ | 160 | unsigned long ilock; /* Semaphores for IRQ-Routines */ |
161 | struct sk_buff_head rcvq; /* Receive-Message queue */ | 161 | struct sk_buff_head rcvq; /* Receive-Message queue */ |
162 | struct sk_buff_head sndq; /* Send-Message queue */ | 162 | struct sk_buff_head sndq; /* Send-Message queue */ |
163 | struct sk_buff_head ackq; /* Data-Ack-Message queue */ | 163 | struct sk_buff_head ackq; /* Data-Ack-Message queue */ |
164 | u_char *ack_msg; /* Ptr to User Data in User skb */ | 164 | u_char *ack_msg; /* Ptr to User Data in User skb */ |
165 | __u16 need_b3ack; /* Flag: Need ACK for current skb */ | 165 | __u16 need_b3ack; /* Flag: Need ACK for current skb */ |
166 | struct sk_buff *sbuf; /* skb which is currently sent */ | 166 | struct sk_buff *sbuf; /* skb which is currently sent */ |
167 | struct timer_list ptimer; /* Poll timer */ | 167 | struct timer_list ptimer; /* Poll timer */ |
168 | struct work_struct snd_tq; /* Task struct for xmit bh */ | 168 | struct work_struct snd_tq; /* Task struct for xmit bh */ |
169 | struct work_struct rcv_tq; /* Task struct for rcv bh */ | 169 | struct work_struct rcv_tq; /* Task struct for rcv bh */ |
170 | struct work_struct poll_tq; /* Task struct for polled rcv bh */ | 170 | struct work_struct poll_tq; /* Task struct for polled rcv bh */ |
171 | msn_entry *msn_list; | 171 | msn_entry *msn_list; |
172 | unsigned short msgnum; /* Message number for sending */ | 172 | unsigned short msgnum; /* Message number for sending */ |
173 | spinlock_t mnlock; /* lock for msgnum */ | 173 | spinlock_t mnlock; /* lock for msgnum */ |
174 | act2000_chan bch[ACT2000_BCH]; /* B-Channel status/control */ | 174 | act2000_chan bch[ACT2000_BCH]; /* B-Channel status/control */ |
175 | char status_buf[256]; /* Buffer for status messages */ | 175 | char status_buf[256]; /* Buffer for status messages */ |
176 | char *status_buf_read; | 176 | char *status_buf_read; |
177 | char *status_buf_write; | 177 | char *status_buf_write; |
178 | char *status_buf_end; | 178 | char *status_buf_end; |
179 | irq_data idat; /* Data used for IRQ handler */ | 179 | irq_data idat; /* Data used for IRQ handler */ |
180 | isdn_if interface; /* Interface to upper layer */ | 180 | isdn_if interface; /* Interface to upper layer */ |
181 | char regname[35]; /* Name used for request_region */ | 181 | char regname[35]; /* Name used for request_region */ |
182 | } act2000_card; | 182 | } act2000_card; |
183 | 183 | ||
184 | extern __inline__ void act2000_schedule_tx(act2000_card *card) | 184 | static inline void act2000_schedule_tx(act2000_card *card) |
185 | { | 185 | { |
186 | schedule_work(&card->snd_tq); | 186 | schedule_work(&card->snd_tq); |
187 | } | 187 | } |
188 | 188 | ||
189 | extern __inline__ void act2000_schedule_rx(act2000_card *card) | 189 | static inline void act2000_schedule_rx(act2000_card *card) |
190 | { | 190 | { |
191 | schedule_work(&card->rcv_tq); | 191 | schedule_work(&card->rcv_tq); |
192 | } | 192 | } |
193 | 193 | ||
194 | extern __inline__ void act2000_schedule_poll(act2000_card *card) | 194 | static inline void act2000_schedule_poll(act2000_card *card) |
195 | { | 195 | { |
196 | schedule_work(&card->poll_tq); | 196 | schedule_work(&card->poll_tq); |
197 | } | 197 | } |
198 | 198 | ||
199 | extern char *act2000_find_eaz(act2000_card *, char); | 199 | extern char *act2000_find_eaz(act2000_card *, char); |
200 | 200 | ||
201 | #endif /* defined(__KERNEL__) || defined(__DEBUGVAR__) */ | 201 | #endif /* defined(__KERNEL__) || defined(__DEBUGVAR__) */ |
202 | #endif /* act2000_h */ | 202 | #endif /* act2000_h */ |
203 | 203 |
drivers/isdn/act2000/capi.h
1 | /* $Id: capi.h,v 1.6.6.2 2001/09/23 22:24:32 kai Exp $ | 1 | /* $Id: capi.h,v 1.6.6.2 2001/09/23 22:24:32 kai Exp $ |
2 | * | 2 | * |
3 | * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000. | 3 | * ISDN lowlevel-module for the IBM ISDN-S0 Active 2000. |
4 | * | 4 | * |
5 | * Author Fritz Elfert | 5 | * Author Fritz Elfert |
6 | * Copyright by Fritz Elfert <fritz@isdn4linux.de> | 6 | * Copyright by Fritz Elfert <fritz@isdn4linux.de> |
7 | * | 7 | * |
8 | * This software may be used and distributed according to the terms | 8 | * This software may be used and distributed according to the terms |
9 | * of the GNU General Public License, incorporated herein by reference. | 9 | * of the GNU General Public License, incorporated herein by reference. |
10 | * | 10 | * |
11 | * Thanks to Friedemann Baitinger and IBM Germany | 11 | * Thanks to Friedemann Baitinger and IBM Germany |
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #ifndef CAPI_H | 15 | #ifndef CAPI_H |
16 | #define CAPI_H | 16 | #define CAPI_H |
17 | 17 | ||
18 | /* Command-part of a CAPI message */ | 18 | /* Command-part of a CAPI message */ |
19 | typedef struct actcapi_msgcmd { | 19 | typedef struct actcapi_msgcmd { |
20 | __u8 cmd; | 20 | __u8 cmd; |
21 | __u8 subcmd; | 21 | __u8 subcmd; |
22 | } actcapi_msgcmd; | 22 | } actcapi_msgcmd; |
23 | 23 | ||
24 | /* CAPI message header */ | 24 | /* CAPI message header */ |
25 | typedef struct actcapi_msghdr { | 25 | typedef struct actcapi_msghdr { |
26 | __u16 len; | 26 | __u16 len; |
27 | __u16 applicationID; | 27 | __u16 applicationID; |
28 | actcapi_msgcmd cmd; | 28 | actcapi_msgcmd cmd; |
29 | __u16 msgnum; | 29 | __u16 msgnum; |
30 | } actcapi_msghdr; | 30 | } actcapi_msghdr; |
31 | 31 | ||
32 | /* CAPI message description (for debugging) */ | 32 | /* CAPI message description (for debugging) */ |
33 | typedef struct actcapi_msgdsc { | 33 | typedef struct actcapi_msgdsc { |
34 | actcapi_msgcmd cmd; | 34 | actcapi_msgcmd cmd; |
35 | char *description; | 35 | char *description; |
36 | } actcapi_msgdsc; | 36 | } actcapi_msgdsc; |
37 | 37 | ||
38 | /* CAPI Address */ | 38 | /* CAPI Address */ |
39 | typedef struct actcapi_addr { | 39 | typedef struct actcapi_addr { |
40 | __u8 len; /* Length of element */ | 40 | __u8 len; /* Length of element */ |
41 | __u8 tnp; /* Type/Numbering Plan */ | 41 | __u8 tnp; /* Type/Numbering Plan */ |
42 | __u8 num[20]; /* Caller ID */ | 42 | __u8 num[20]; /* Caller ID */ |
43 | } actcapi_addr; | 43 | } actcapi_addr; |
44 | 44 | ||
45 | /* CAPI INFO element mask */ | 45 | /* CAPI INFO element mask */ |
46 | typedef union actcapi_infonr { /* info number */ | 46 | typedef union actcapi_infonr { /* info number */ |
47 | __u16 mask; /* info-mask field */ | 47 | __u16 mask; /* info-mask field */ |
48 | struct bmask { /* bit definitions */ | 48 | struct bmask { /* bit definitions */ |
49 | unsigned codes : 3; /* code set */ | 49 | unsigned codes : 3; /* code set */ |
50 | unsigned rsvd : 5; /* reserved */ | 50 | unsigned rsvd : 5; /* reserved */ |
51 | unsigned svind : 1; /* single, variable length ind. */ | 51 | unsigned svind : 1; /* single, variable length ind. */ |
52 | unsigned wtype : 7; /* W-element type */ | 52 | unsigned wtype : 7; /* W-element type */ |
53 | } bmask; | 53 | } bmask; |
54 | } actcapi_infonr; | 54 | } actcapi_infonr; |
55 | 55 | ||
56 | /* CAPI INFO element */ | 56 | /* CAPI INFO element */ |
57 | typedef union actcapi_infoel { /* info element */ | 57 | typedef union actcapi_infoel { /* info element */ |
58 | __u8 len; /* length of info element */ | 58 | __u8 len; /* length of info element */ |
59 | __u8 display[40]; /* display contents */ | 59 | __u8 display[40]; /* display contents */ |
60 | __u8 uuinfo[40]; /* User-user info field */ | 60 | __u8 uuinfo[40]; /* User-user info field */ |
61 | struct cause { /* Cause information */ | 61 | struct cause { /* Cause information */ |
62 | unsigned ext2 : 1; /* extension */ | 62 | unsigned ext2 : 1; /* extension */ |
63 | unsigned cod : 2; /* coding standard */ | 63 | unsigned cod : 2; /* coding standard */ |
64 | unsigned spare : 1; /* spare */ | 64 | unsigned spare : 1; /* spare */ |
65 | unsigned loc : 4; /* location */ | 65 | unsigned loc : 4; /* location */ |
66 | unsigned ext1 : 1; /* extension */ | 66 | unsigned ext1 : 1; /* extension */ |
67 | unsigned cval : 7; /* Cause value */ | 67 | unsigned cval : 7; /* Cause value */ |
68 | } cause; | 68 | } cause; |
69 | struct charge { /* Charging information */ | 69 | struct charge { /* Charging information */ |
70 | __u8 toc; /* type of charging info */ | 70 | __u8 toc; /* type of charging info */ |
71 | __u8 unit[10]; /* charging units */ | 71 | __u8 unit[10]; /* charging units */ |
72 | } charge; | 72 | } charge; |
73 | __u8 date[20]; /* date fields */ | 73 | __u8 date[20]; /* date fields */ |
74 | __u8 stat; /* state of remote party */ | 74 | __u8 stat; /* state of remote party */ |
75 | } actcapi_infoel; | 75 | } actcapi_infoel; |
76 | 76 | ||
77 | /* Message for EAZ<->MSN Mapping */ | 77 | /* Message for EAZ<->MSN Mapping */ |
78 | typedef struct actcapi_msn { | 78 | typedef struct actcapi_msn { |
79 | __u8 eaz; | 79 | __u8 eaz; |
80 | __u8 len; /* Length of MSN */ | 80 | __u8 len; /* Length of MSN */ |
81 | __u8 msn[15] __attribute__ ((packed)); | 81 | __u8 msn[15] __attribute__ ((packed)); |
82 | } actcapi_msn; | 82 | } actcapi_msn; |
83 | 83 | ||
84 | typedef struct actcapi_dlpd { | 84 | typedef struct actcapi_dlpd { |
85 | __u8 len; /* Length of structure */ | 85 | __u8 len; /* Length of structure */ |
86 | __u16 dlen __attribute__ ((packed)); /* Data Length */ | 86 | __u16 dlen __attribute__ ((packed)); /* Data Length */ |
87 | __u8 laa __attribute__ ((packed)); /* Link Address A */ | 87 | __u8 laa __attribute__ ((packed)); /* Link Address A */ |
88 | __u8 lab; /* Link Address B */ | 88 | __u8 lab; /* Link Address B */ |
89 | __u8 modulo; /* Modulo Mode */ | 89 | __u8 modulo; /* Modulo Mode */ |
90 | __u8 win; /* Window size */ | 90 | __u8 win; /* Window size */ |
91 | __u8 xid[100]; /* XID Information */ | 91 | __u8 xid[100]; /* XID Information */ |
92 | } actcapi_dlpd; | 92 | } actcapi_dlpd; |
93 | 93 | ||
94 | typedef struct actcapi_ncpd { | 94 | typedef struct actcapi_ncpd { |
95 | __u8 len; /* Length of structure */ | 95 | __u8 len; /* Length of structure */ |
96 | __u16 lic __attribute__ ((packed)); | 96 | __u16 lic __attribute__ ((packed)); |
97 | __u16 hic __attribute__ ((packed)); | 97 | __u16 hic __attribute__ ((packed)); |
98 | __u16 ltc __attribute__ ((packed)); | 98 | __u16 ltc __attribute__ ((packed)); |
99 | __u16 htc __attribute__ ((packed)); | 99 | __u16 htc __attribute__ ((packed)); |
100 | __u16 loc __attribute__ ((packed)); | 100 | __u16 loc __attribute__ ((packed)); |
101 | __u16 hoc __attribute__ ((packed)); | 101 | __u16 hoc __attribute__ ((packed)); |
102 | __u8 modulo __attribute__ ((packed)); | 102 | __u8 modulo __attribute__ ((packed)); |
103 | } actcapi_ncpd; | 103 | } actcapi_ncpd; |
104 | #define actcapi_ncpi actcapi_ncpd | 104 | #define actcapi_ncpi actcapi_ncpd |
105 | 105 | ||
106 | /* | 106 | /* |
107 | * Layout of NCCI field in a B3 DATA CAPI message is different from | 107 | * Layout of NCCI field in a B3 DATA CAPI message is different from |
108 | * standard at act2000: | 108 | * standard at act2000: |
109 | * | 109 | * |
110 | * Bit 0-4 = PLCI | 110 | * Bit 0-4 = PLCI |
111 | * Bit 5-7 = Controller | 111 | * Bit 5-7 = Controller |
112 | * Bit 8-15 = NCCI | 112 | * Bit 8-15 = NCCI |
113 | */ | 113 | */ |
114 | #define MAKE_NCCI(plci,contr,ncci) \ | 114 | #define MAKE_NCCI(plci,contr,ncci) \ |
115 | ((plci & 0x1f) | ((contr & 0x7) << 5) | ((ncci & 0xff) << 8)) | 115 | ((plci & 0x1f) | ((contr & 0x7) << 5) | ((ncci & 0xff) << 8)) |
116 | 116 | ||
117 | #define EVAL_NCCI(fakencci,plci,contr,ncci) { \ | 117 | #define EVAL_NCCI(fakencci,plci,contr,ncci) { \ |
118 | plci = fakencci & 0x1f; \ | 118 | plci = fakencci & 0x1f; \ |
119 | contr = (fakencci >> 5) & 0x7; \ | 119 | contr = (fakencci >> 5) & 0x7; \ |
120 | ncci = (fakencci >> 8) & 0xff; \ | 120 | ncci = (fakencci >> 8) & 0xff; \ |
121 | } | 121 | } |
122 | 122 | ||
123 | /* | 123 | /* |
124 | * Layout of PLCI field in a B3 DATA CAPI message is different from | 124 | * Layout of PLCI field in a B3 DATA CAPI message is different from |
125 | * standard at act2000: | 125 | * standard at act2000: |
126 | * | 126 | * |
127 | * Bit 0-4 = PLCI | 127 | * Bit 0-4 = PLCI |
128 | * Bit 5-7 = Controller | 128 | * Bit 5-7 = Controller |
129 | * Bit 8-15 = reserved (must be 0) | 129 | * Bit 8-15 = reserved (must be 0) |
130 | */ | 130 | */ |
131 | #define MAKE_PLCI(plci,contr) \ | 131 | #define MAKE_PLCI(plci,contr) \ |
132 | ((plci & 0x1f) | ((contr & 0x7) << 5)) | 132 | ((plci & 0x1f) | ((contr & 0x7) << 5)) |
133 | 133 | ||
134 | #define EVAL_PLCI(fakeplci,plci,contr) { \ | 134 | #define EVAL_PLCI(fakeplci,plci,contr) { \ |
135 | plci = fakeplci & 0x1f; \ | 135 | plci = fakeplci & 0x1f; \ |
136 | contr = (fakeplci >> 5) & 0x7; \ | 136 | contr = (fakeplci >> 5) & 0x7; \ |
137 | } | 137 | } |
138 | 138 | ||
139 | typedef struct actcapi_msg { | 139 | typedef struct actcapi_msg { |
140 | actcapi_msghdr hdr; | 140 | actcapi_msghdr hdr; |
141 | union { | 141 | union { |
142 | __u16 manuf_msg; | 142 | __u16 manuf_msg; |
143 | struct manufacturer_req_net { | 143 | struct manufacturer_req_net { |
144 | __u16 manuf_msg; | 144 | __u16 manuf_msg; |
145 | __u16 controller; | 145 | __u16 controller; |
146 | __u8 nettype; | 146 | __u8 nettype; |
147 | } manufacturer_req_net; | 147 | } manufacturer_req_net; |
148 | struct manufacturer_req_v42 { | 148 | struct manufacturer_req_v42 { |
149 | __u16 manuf_msg; | 149 | __u16 manuf_msg; |
150 | __u16 controller; | 150 | __u16 controller; |
151 | __u32 v42control; | 151 | __u32 v42control; |
152 | } manufacturer_req_v42; | 152 | } manufacturer_req_v42; |
153 | struct manufacturer_conf_v42 { | 153 | struct manufacturer_conf_v42 { |
154 | __u16 manuf_msg; | 154 | __u16 manuf_msg; |
155 | __u16 controller; | 155 | __u16 controller; |
156 | } manufacturer_conf_v42; | 156 | } manufacturer_conf_v42; |
157 | struct manufacturer_req_err { | 157 | struct manufacturer_req_err { |
158 | __u16 manuf_msg; | 158 | __u16 manuf_msg; |
159 | __u16 controller; | 159 | __u16 controller; |
160 | } manufacturer_req_err; | 160 | } manufacturer_req_err; |
161 | struct manufacturer_ind_err { | 161 | struct manufacturer_ind_err { |
162 | __u16 manuf_msg; | 162 | __u16 manuf_msg; |
163 | __u16 controller; | 163 | __u16 controller; |
164 | __u32 errcode; | 164 | __u32 errcode; |
165 | __u8 errstring; /* actually up to 160 */ | 165 | __u8 errstring; /* actually up to 160 */ |
166 | } manufacturer_ind_err; | 166 | } manufacturer_ind_err; |
167 | struct manufacturer_req_msn { | 167 | struct manufacturer_req_msn { |
168 | __u16 manuf_msg; | 168 | __u16 manuf_msg; |
169 | __u16 controller; | 169 | __u16 controller; |
170 | actcapi_msn msnmap; | 170 | actcapi_msn msnmap; |
171 | } manufacturer_req_msn; | 171 | } manufacturer_req_msn; |
172 | /* TODO: TraceInit-req/conf/ind/resp and | 172 | /* TODO: TraceInit-req/conf/ind/resp and |
173 | * TraceDump-req/conf/ind/resp | 173 | * TraceDump-req/conf/ind/resp |
174 | */ | 174 | */ |
175 | struct connect_req { | 175 | struct connect_req { |
176 | __u8 controller; | 176 | __u8 controller; |
177 | __u8 bchan; | 177 | __u8 bchan; |
178 | __u32 infomask __attribute__ ((packed)); | 178 | __u32 infomask __attribute__ ((packed)); |
179 | __u8 si1; | 179 | __u8 si1; |
180 | __u8 si2; | 180 | __u8 si2; |
181 | __u8 eaz; | 181 | __u8 eaz; |
182 | actcapi_addr addr; | 182 | actcapi_addr addr; |
183 | } connect_req; | 183 | } connect_req; |
184 | struct connect_conf { | 184 | struct connect_conf { |
185 | __u16 plci; | 185 | __u16 plci; |
186 | __u16 info; | 186 | __u16 info; |
187 | } connect_conf; | 187 | } connect_conf; |
188 | struct connect_ind { | 188 | struct connect_ind { |
189 | __u16 plci; | 189 | __u16 plci; |
190 | __u8 controller; | 190 | __u8 controller; |
191 | __u8 si1; | 191 | __u8 si1; |
192 | __u8 si2; | 192 | __u8 si2; |
193 | __u8 eaz; | 193 | __u8 eaz; |
194 | actcapi_addr addr; | 194 | actcapi_addr addr; |
195 | } connect_ind; | 195 | } connect_ind; |
196 | struct connect_resp { | 196 | struct connect_resp { |
197 | __u16 plci; | 197 | __u16 plci; |
198 | __u8 rejectcause; | 198 | __u8 rejectcause; |
199 | } connect_resp; | 199 | } connect_resp; |
200 | struct connect_active_ind { | 200 | struct connect_active_ind { |
201 | __u16 plci; | 201 | __u16 plci; |
202 | actcapi_addr addr; | 202 | actcapi_addr addr; |
203 | } connect_active_ind; | 203 | } connect_active_ind; |
204 | struct connect_active_resp { | 204 | struct connect_active_resp { |
205 | __u16 plci; | 205 | __u16 plci; |
206 | } connect_active_resp; | 206 | } connect_active_resp; |
207 | struct connect_b3_req { | 207 | struct connect_b3_req { |
208 | __u16 plci; | 208 | __u16 plci; |
209 | actcapi_ncpi ncpi; | 209 | actcapi_ncpi ncpi; |
210 | } connect_b3_req; | 210 | } connect_b3_req; |
211 | struct connect_b3_conf { | 211 | struct connect_b3_conf { |
212 | __u16 plci; | 212 | __u16 plci; |
213 | __u16 ncci; | 213 | __u16 ncci; |
214 | __u16 info; | 214 | __u16 info; |
215 | } connect_b3_conf; | 215 | } connect_b3_conf; |
216 | struct connect_b3_ind { | 216 | struct connect_b3_ind { |
217 | __u16 ncci; | 217 | __u16 ncci; |
218 | __u16 plci; | 218 | __u16 plci; |
219 | actcapi_ncpi ncpi; | 219 | actcapi_ncpi ncpi; |
220 | } connect_b3_ind; | 220 | } connect_b3_ind; |
221 | struct connect_b3_resp { | 221 | struct connect_b3_resp { |
222 | __u16 ncci; | 222 | __u16 ncci; |
223 | __u8 rejectcause; | 223 | __u8 rejectcause; |
224 | actcapi_ncpi ncpi __attribute__ ((packed)); | 224 | actcapi_ncpi ncpi __attribute__ ((packed)); |
225 | } connect_b3_resp; | 225 | } connect_b3_resp; |
226 | struct disconnect_req { | 226 | struct disconnect_req { |
227 | __u16 plci; | 227 | __u16 plci; |
228 | __u8 cause; | 228 | __u8 cause; |
229 | } disconnect_req; | 229 | } disconnect_req; |
230 | struct disconnect_conf { | 230 | struct disconnect_conf { |
231 | __u16 plci; | 231 | __u16 plci; |
232 | __u16 info; | 232 | __u16 info; |
233 | } disconnect_conf; | 233 | } disconnect_conf; |
234 | struct disconnect_ind { | 234 | struct disconnect_ind { |
235 | __u16 plci; | 235 | __u16 plci; |
236 | __u16 info; | 236 | __u16 info; |
237 | } disconnect_ind; | 237 | } disconnect_ind; |
238 | struct disconnect_resp { | 238 | struct disconnect_resp { |
239 | __u16 plci; | 239 | __u16 plci; |
240 | } disconnect_resp; | 240 | } disconnect_resp; |
241 | struct connect_b3_active_ind { | 241 | struct connect_b3_active_ind { |
242 | __u16 ncci; | 242 | __u16 ncci; |
243 | actcapi_ncpi ncpi; | 243 | actcapi_ncpi ncpi; |
244 | } connect_b3_active_ind; | 244 | } connect_b3_active_ind; |
245 | struct connect_b3_active_resp { | 245 | struct connect_b3_active_resp { |
246 | __u16 ncci; | 246 | __u16 ncci; |
247 | } connect_b3_active_resp; | 247 | } connect_b3_active_resp; |
248 | struct disconnect_b3_req { | 248 | struct disconnect_b3_req { |
249 | __u16 ncci; | 249 | __u16 ncci; |
250 | actcapi_ncpi ncpi; | 250 | actcapi_ncpi ncpi; |
251 | } disconnect_b3_req; | 251 | } disconnect_b3_req; |
252 | struct disconnect_b3_conf { | 252 | struct disconnect_b3_conf { |
253 | __u16 ncci; | 253 | __u16 ncci; |
254 | __u16 info; | 254 | __u16 info; |
255 | } disconnect_b3_conf; | 255 | } disconnect_b3_conf; |
256 | struct disconnect_b3_ind { | 256 | struct disconnect_b3_ind { |
257 | __u16 ncci; | 257 | __u16 ncci; |
258 | __u16 info; | 258 | __u16 info; |
259 | actcapi_ncpi ncpi; | 259 | actcapi_ncpi ncpi; |
260 | } disconnect_b3_ind; | 260 | } disconnect_b3_ind; |
261 | struct disconnect_b3_resp { | 261 | struct disconnect_b3_resp { |
262 | __u16 ncci; | 262 | __u16 ncci; |
263 | } disconnect_b3_resp; | 263 | } disconnect_b3_resp; |
264 | struct info_ind { | 264 | struct info_ind { |
265 | __u16 plci; | 265 | __u16 plci; |
266 | actcapi_infonr nr; | 266 | actcapi_infonr nr; |
267 | actcapi_infoel el; | 267 | actcapi_infoel el; |
268 | } info_ind; | 268 | } info_ind; |
269 | struct info_resp { | 269 | struct info_resp { |
270 | __u16 plci; | 270 | __u16 plci; |
271 | } info_resp; | 271 | } info_resp; |
272 | struct listen_b3_req { | 272 | struct listen_b3_req { |
273 | __u16 plci; | 273 | __u16 plci; |
274 | } listen_b3_req; | 274 | } listen_b3_req; |
275 | struct listen_b3_conf { | 275 | struct listen_b3_conf { |
276 | __u16 plci; | 276 | __u16 plci; |
277 | __u16 info; | 277 | __u16 info; |
278 | } listen_b3_conf; | 278 | } listen_b3_conf; |
279 | struct select_b2_protocol_req { | 279 | struct select_b2_protocol_req { |
280 | __u16 plci; | 280 | __u16 plci; |
281 | __u8 protocol; | 281 | __u8 protocol; |
282 | actcapi_dlpd dlpd __attribute__ ((packed)); | 282 | actcapi_dlpd dlpd __attribute__ ((packed)); |
283 | } select_b2_protocol_req; | 283 | } select_b2_protocol_req; |
284 | struct select_b2_protocol_conf { | 284 | struct select_b2_protocol_conf { |
285 | __u16 plci; | 285 | __u16 plci; |
286 | __u16 info; | 286 | __u16 info; |
287 | } select_b2_protocol_conf; | 287 | } select_b2_protocol_conf; |
288 | struct select_b3_protocol_req { | 288 | struct select_b3_protocol_req { |
289 | __u16 plci; | 289 | __u16 plci; |
290 | __u8 protocol; | 290 | __u8 protocol; |
291 | actcapi_ncpd ncpd __attribute__ ((packed)); | 291 | actcapi_ncpd ncpd __attribute__ ((packed)); |
292 | } select_b3_protocol_req; | 292 | } select_b3_protocol_req; |
293 | struct select_b3_protocol_conf { | 293 | struct select_b3_protocol_conf { |
294 | __u16 plci; | 294 | __u16 plci; |
295 | __u16 info; | 295 | __u16 info; |
296 | } select_b3_protocol_conf; | 296 | } select_b3_protocol_conf; |
297 | struct listen_req { | 297 | struct listen_req { |
298 | __u8 controller; | 298 | __u8 controller; |
299 | __u32 infomask __attribute__ ((packed)); | 299 | __u32 infomask __attribute__ ((packed)); |
300 | __u16 eazmask __attribute__ ((packed)); | 300 | __u16 eazmask __attribute__ ((packed)); |
301 | __u16 simask __attribute__ ((packed)); | 301 | __u16 simask __attribute__ ((packed)); |
302 | } listen_req; | 302 | } listen_req; |
303 | struct listen_conf { | 303 | struct listen_conf { |
304 | __u8 controller; | 304 | __u8 controller; |
305 | __u16 info __attribute__ ((packed)); | 305 | __u16 info __attribute__ ((packed)); |
306 | } listen_conf; | 306 | } listen_conf; |
307 | struct data_b3_req { | 307 | struct data_b3_req { |
308 | __u16 fakencci; | 308 | __u16 fakencci; |
309 | __u16 datalen; | 309 | __u16 datalen; |
310 | __u32 unused; | 310 | __u32 unused; |
311 | __u8 blocknr; | 311 | __u8 blocknr; |
312 | __u16 flags __attribute__ ((packed)); | 312 | __u16 flags __attribute__ ((packed)); |
313 | } data_b3_req; | 313 | } data_b3_req; |
314 | struct data_b3_ind { | 314 | struct data_b3_ind { |
315 | __u16 fakencci; | 315 | __u16 fakencci; |
316 | __u16 datalen; | 316 | __u16 datalen; |
317 | __u32 unused; | 317 | __u32 unused; |
318 | __u8 blocknr; | 318 | __u8 blocknr; |
319 | __u16 flags __attribute__ ((packed)); | 319 | __u16 flags __attribute__ ((packed)); |
320 | } data_b3_ind; | 320 | } data_b3_ind; |
321 | struct data_b3_resp { | 321 | struct data_b3_resp { |
322 | __u16 ncci; | 322 | __u16 ncci; |
323 | __u8 blocknr; | 323 | __u8 blocknr; |
324 | } data_b3_resp; | 324 | } data_b3_resp; |
325 | struct data_b3_conf { | 325 | struct data_b3_conf { |
326 | __u16 ncci; | 326 | __u16 ncci; |
327 | __u8 blocknr; | 327 | __u8 blocknr; |
328 | __u16 info __attribute__ ((packed)); | 328 | __u16 info __attribute__ ((packed)); |
329 | } data_b3_conf; | 329 | } data_b3_conf; |
330 | } msg; | 330 | } msg; |
331 | } actcapi_msg; | 331 | } actcapi_msg; |
332 | 332 | ||
333 | extern __inline__ unsigned short | 333 | static inline unsigned short |
334 | actcapi_nextsmsg(act2000_card *card) | 334 | actcapi_nextsmsg(act2000_card *card) |
335 | { | 335 | { |
336 | unsigned long flags; | 336 | unsigned long flags; |
337 | unsigned short n; | 337 | unsigned short n; |
338 | 338 | ||
339 | spin_lock_irqsave(&card->mnlock, flags); | 339 | spin_lock_irqsave(&card->mnlock, flags); |
340 | n = card->msgnum; | 340 | n = card->msgnum; |
341 | card->msgnum++; | 341 | card->msgnum++; |
342 | card->msgnum &= 0x7fff; | 342 | card->msgnum &= 0x7fff; |
343 | spin_unlock_irqrestore(&card->mnlock, flags); | 343 | spin_unlock_irqrestore(&card->mnlock, flags); |
344 | return n; | 344 | return n; |
345 | } | 345 | } |
346 | #define DEBUG_MSG | 346 | #define DEBUG_MSG |
347 | #undef DEBUG_DATA_MSG | 347 | #undef DEBUG_DATA_MSG |
348 | #undef DEBUG_DUMP_SKB | 348 | #undef DEBUG_DUMP_SKB |
349 | 349 | ||
350 | extern int actcapi_chkhdr(act2000_card *, actcapi_msghdr *); | 350 | extern int actcapi_chkhdr(act2000_card *, actcapi_msghdr *); |
351 | extern int actcapi_listen_req(act2000_card *); | 351 | extern int actcapi_listen_req(act2000_card *); |
352 | extern int actcapi_manufacturer_req_net(act2000_card *); | 352 | extern int actcapi_manufacturer_req_net(act2000_card *); |
353 | extern int actcapi_manufacturer_req_errh(act2000_card *); | 353 | extern int actcapi_manufacturer_req_errh(act2000_card *); |
354 | extern int actcapi_manufacturer_req_msn(act2000_card *); | 354 | extern int actcapi_manufacturer_req_msn(act2000_card *); |
355 | extern int actcapi_connect_req(act2000_card *, act2000_chan *, char *, char, int, int); | 355 | extern int actcapi_connect_req(act2000_card *, act2000_chan *, char *, char, int, int); |
356 | extern void actcapi_select_b2_protocol_req(act2000_card *, act2000_chan *); | 356 | extern void actcapi_select_b2_protocol_req(act2000_card *, act2000_chan *); |
357 | extern void actcapi_disconnect_b3_req(act2000_card *, act2000_chan *); | 357 | extern void actcapi_disconnect_b3_req(act2000_card *, act2000_chan *); |
358 | extern void actcapi_connect_resp(act2000_card *, act2000_chan *, __u8); | 358 | extern void actcapi_connect_resp(act2000_card *, act2000_chan *, __u8); |
359 | extern void actcapi_dispatch(act2000_card *); | 359 | extern void actcapi_dispatch(act2000_card *); |
360 | #ifdef DEBUG_MSG | 360 | #ifdef DEBUG_MSG |
361 | extern void actcapi_debug_msg(struct sk_buff *skb, int); | 361 | extern void actcapi_debug_msg(struct sk_buff *skb, int); |
362 | #else | 362 | #else |
363 | #define actcapi_debug_msg(skb, len) | 363 | #define actcapi_debug_msg(skb, len) |
364 | #endif | 364 | #endif |
365 | #endif | 365 | #endif |
366 | 366 |
drivers/isdn/sc/command.c
1 | /* $Id: command.c,v 1.4.10.1 2001/09/23 22:24:59 kai Exp $ | 1 | /* $Id: command.c,v 1.4.10.1 2001/09/23 22:24:59 kai Exp $ |
2 | * | 2 | * |
3 | * Copyright (C) 1996 SpellCaster Telecommunications Inc. | 3 | * Copyright (C) 1996 SpellCaster Telecommunications Inc. |
4 | * | 4 | * |
5 | * This software may be used and distributed according to the terms | 5 | * This software may be used and distributed according to the terms |
6 | * of the GNU General Public License, incorporated herein by reference. | 6 | * of the GNU General Public License, incorporated herein by reference. |
7 | * | 7 | * |
8 | * For more information, please contact gpl-info@spellcast.com or write: | 8 | * For more information, please contact gpl-info@spellcast.com or write: |
9 | * | 9 | * |
10 | * SpellCaster Telecommunications Inc. | 10 | * SpellCaster Telecommunications Inc. |
11 | * 5621 Finch Avenue East, Unit #3 | 11 | * 5621 Finch Avenue East, Unit #3 |
12 | * Scarborough, Ontario Canada | 12 | * Scarborough, Ontario Canada |
13 | * M1B 2T9 | 13 | * M1B 2T9 |
14 | * +1 (416) 297-8565 | 14 | * +1 (416) 297-8565 |
15 | * +1 (416) 297-6433 Facsimile | 15 | * +1 (416) 297-6433 Facsimile |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include "includes.h" /* This must be first */ | 19 | #include "includes.h" /* This must be first */ |
20 | #include "hardware.h" | 20 | #include "hardware.h" |
21 | #include "message.h" | 21 | #include "message.h" |
22 | #include "card.h" | 22 | #include "card.h" |
23 | #include "scioc.h" | 23 | #include "scioc.h" |
24 | 24 | ||
25 | static int dial(int card, unsigned long channel, setup_parm setup); | 25 | static int dial(int card, unsigned long channel, setup_parm setup); |
26 | static int hangup(int card, unsigned long channel); | 26 | static int hangup(int card, unsigned long channel); |
27 | static int answer(int card, unsigned long channel); | 27 | static int answer(int card, unsigned long channel); |
28 | static int clreaz(int card, unsigned long channel); | 28 | static int clreaz(int card, unsigned long channel); |
29 | static int seteaz(int card, unsigned long channel, char *); | 29 | static int seteaz(int card, unsigned long channel, char *); |
30 | static int setl2(int card, unsigned long arg); | 30 | static int setl2(int card, unsigned long arg); |
31 | static int setl3(int card, unsigned long arg); | 31 | static int setl3(int card, unsigned long arg); |
32 | static int acceptb(int card, unsigned long channel); | 32 | static int acceptb(int card, unsigned long channel); |
33 | 33 | ||
34 | extern int cinst; | 34 | extern int cinst; |
35 | extern board *sc_adapter[]; | 35 | extern board *sc_adapter[]; |
36 | 36 | ||
37 | extern int sc_ioctl(int, scs_ioctl *); | 37 | extern int sc_ioctl(int, scs_ioctl *); |
38 | extern int setup_buffers(int, int, unsigned int); | 38 | extern int setup_buffers(int, int, unsigned int); |
39 | extern int indicate_status(int, int,ulong,char*); | 39 | extern int indicate_status(int, int,ulong,char*); |
40 | extern void check_reset(unsigned long); | 40 | extern void check_reset(unsigned long); |
41 | extern int send_and_receive(int, unsigned int, unsigned char, unsigned char, | 41 | extern int send_and_receive(int, unsigned int, unsigned char, unsigned char, |
42 | unsigned char, unsigned char, unsigned char, unsigned char *, | 42 | unsigned char, unsigned char, unsigned char, unsigned char *, |
43 | RspMessage *, int); | 43 | RspMessage *, int); |
44 | extern int sendmessage(int, unsigned int, unsigned int, unsigned int, | 44 | extern int sendmessage(int, unsigned int, unsigned int, unsigned int, |
45 | unsigned int, unsigned int, unsigned int, unsigned int *); | 45 | unsigned int, unsigned int, unsigned int, unsigned int *); |
46 | extern inline void pullphone(char *, char *); | ||
47 | 46 | ||
48 | #ifdef DEBUG | 47 | #ifdef DEBUG |
49 | /* | 48 | /* |
50 | * Translate command codes to strings | 49 | * Translate command codes to strings |
51 | */ | 50 | */ |
52 | static char *commands[] = { "ISDN_CMD_IOCTL", | 51 | static char *commands[] = { "ISDN_CMD_IOCTL", |
53 | "ISDN_CMD_DIAL", | 52 | "ISDN_CMD_DIAL", |
54 | "ISDN_CMD_ACCEPTB", | 53 | "ISDN_CMD_ACCEPTB", |
55 | "ISDN_CMD_ACCEPTB", | 54 | "ISDN_CMD_ACCEPTB", |
56 | "ISDN_CMD_HANGUP", | 55 | "ISDN_CMD_HANGUP", |
57 | "ISDN_CMD_CLREAZ", | 56 | "ISDN_CMD_CLREAZ", |
58 | "ISDN_CMD_SETEAZ", | 57 | "ISDN_CMD_SETEAZ", |
59 | NULL, | 58 | NULL, |
60 | NULL, | 59 | NULL, |
61 | NULL, | 60 | NULL, |
62 | "ISDN_CMD_SETL2", | 61 | "ISDN_CMD_SETL2", |
63 | NULL, | 62 | NULL, |
64 | "ISDN_CMD_SETL3", | 63 | "ISDN_CMD_SETL3", |
65 | NULL, | 64 | NULL, |
66 | NULL, | 65 | NULL, |
67 | NULL, | 66 | NULL, |
68 | NULL, | 67 | NULL, |
69 | NULL, }; | 68 | NULL, }; |
70 | 69 | ||
71 | /* | 70 | /* |
72 | * Translates ISDN4Linux protocol codes to strings for debug messages | 71 | * Translates ISDN4Linux protocol codes to strings for debug messages |
73 | */ | 72 | */ |
74 | static char *l3protos[] = { "ISDN_PROTO_L3_TRANS" }; | 73 | static char *l3protos[] = { "ISDN_PROTO_L3_TRANS" }; |
75 | static char *l2protos[] = { "ISDN_PROTO_L2_X75I", | 74 | static char *l2protos[] = { "ISDN_PROTO_L2_X75I", |
76 | "ISDN_PROTO_L2_X75UI", | 75 | "ISDN_PROTO_L2_X75UI", |
77 | "ISDN_PROTO_L2_X75BUI", | 76 | "ISDN_PROTO_L2_X75BUI", |
78 | "ISDN_PROTO_L2_HDLC", | 77 | "ISDN_PROTO_L2_HDLC", |
79 | "ISDN_PROTO_L2_TRANS" }; | 78 | "ISDN_PROTO_L2_TRANS" }; |
80 | #endif | 79 | #endif |
81 | 80 | ||
82 | int get_card_from_id(int driver) | 81 | int get_card_from_id(int driver) |
83 | { | 82 | { |
84 | int i; | 83 | int i; |
85 | 84 | ||
86 | for(i = 0 ; i < cinst ; i++) { | 85 | for(i = 0 ; i < cinst ; i++) { |
87 | if(sc_adapter[i]->driverId == driver) | 86 | if(sc_adapter[i]->driverId == driver) |
88 | return i; | 87 | return i; |
89 | } | 88 | } |
90 | return -ENODEV; | 89 | return -ENODEV; |
91 | } | 90 | } |
92 | 91 | ||
93 | /* | 92 | /* |
94 | * command | 93 | * command |
95 | */ | 94 | */ |
96 | 95 | ||
97 | int command(isdn_ctrl *cmd) | 96 | int command(isdn_ctrl *cmd) |
98 | { | 97 | { |
99 | int card; | 98 | int card; |
100 | 99 | ||
101 | card = get_card_from_id(cmd->driver); | 100 | card = get_card_from_id(cmd->driver); |
102 | if(!IS_VALID_CARD(card)) { | 101 | if(!IS_VALID_CARD(card)) { |
103 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 102 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
104 | return -ENODEV; | 103 | return -ENODEV; |
105 | } | 104 | } |
106 | 105 | ||
107 | pr_debug("%s: Received %s command from Link Layer\n", | 106 | pr_debug("%s: Received %s command from Link Layer\n", |
108 | sc_adapter[card]->devicename, commands[cmd->command]); | 107 | sc_adapter[card]->devicename, commands[cmd->command]); |
109 | 108 | ||
110 | /* | 109 | /* |
111 | * Dispatch the command | 110 | * Dispatch the command |
112 | */ | 111 | */ |
113 | switch(cmd->command) { | 112 | switch(cmd->command) { |
114 | case ISDN_CMD_IOCTL: | 113 | case ISDN_CMD_IOCTL: |
115 | { | 114 | { |
116 | unsigned long cmdptr; | 115 | unsigned long cmdptr; |
117 | scs_ioctl ioc; | 116 | scs_ioctl ioc; |
118 | 117 | ||
119 | memcpy(&cmdptr, cmd->parm.num, sizeof(unsigned long)); | 118 | memcpy(&cmdptr, cmd->parm.num, sizeof(unsigned long)); |
120 | if (copy_from_user(&ioc, (scs_ioctl __user *)cmdptr, | 119 | if (copy_from_user(&ioc, (scs_ioctl __user *)cmdptr, |
121 | sizeof(scs_ioctl))) { | 120 | sizeof(scs_ioctl))) { |
122 | pr_debug("%s: Failed to verify user space 0x%x\n", | 121 | pr_debug("%s: Failed to verify user space 0x%x\n", |
123 | sc_adapter[card]->devicename, cmdptr); | 122 | sc_adapter[card]->devicename, cmdptr); |
124 | return -EFAULT; | 123 | return -EFAULT; |
125 | } | 124 | } |
126 | return sc_ioctl(card, &ioc); | 125 | return sc_ioctl(card, &ioc); |
127 | } | 126 | } |
128 | case ISDN_CMD_DIAL: | 127 | case ISDN_CMD_DIAL: |
129 | return dial(card, cmd->arg, cmd->parm.setup); | 128 | return dial(card, cmd->arg, cmd->parm.setup); |
130 | case ISDN_CMD_HANGUP: | 129 | case ISDN_CMD_HANGUP: |
131 | return hangup(card, cmd->arg); | 130 | return hangup(card, cmd->arg); |
132 | case ISDN_CMD_ACCEPTD: | 131 | case ISDN_CMD_ACCEPTD: |
133 | return answer(card, cmd->arg); | 132 | return answer(card, cmd->arg); |
134 | case ISDN_CMD_ACCEPTB: | 133 | case ISDN_CMD_ACCEPTB: |
135 | return acceptb(card, cmd->arg); | 134 | return acceptb(card, cmd->arg); |
136 | case ISDN_CMD_CLREAZ: | 135 | case ISDN_CMD_CLREAZ: |
137 | return clreaz(card, cmd->arg); | 136 | return clreaz(card, cmd->arg); |
138 | case ISDN_CMD_SETEAZ: | 137 | case ISDN_CMD_SETEAZ: |
139 | return seteaz(card, cmd->arg, cmd->parm.num); | 138 | return seteaz(card, cmd->arg, cmd->parm.num); |
140 | case ISDN_CMD_SETL2: | 139 | case ISDN_CMD_SETL2: |
141 | return setl2(card, cmd->arg); | 140 | return setl2(card, cmd->arg); |
142 | case ISDN_CMD_SETL3: | 141 | case ISDN_CMD_SETL3: |
143 | return setl3(card, cmd->arg); | 142 | return setl3(card, cmd->arg); |
144 | default: | 143 | default: |
145 | return -EINVAL; | 144 | return -EINVAL; |
146 | } | 145 | } |
147 | return 0; | 146 | return 0; |
148 | } | 147 | } |
149 | 148 | ||
150 | /* | 149 | /* |
151 | * start the onboard firmware | 150 | * start the onboard firmware |
152 | */ | 151 | */ |
153 | int startproc(int card) | 152 | int startproc(int card) |
154 | { | 153 | { |
155 | int status; | 154 | int status; |
156 | 155 | ||
157 | if(!IS_VALID_CARD(card)) { | 156 | if(!IS_VALID_CARD(card)) { |
158 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 157 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
159 | return -ENODEV; | 158 | return -ENODEV; |
160 | } | 159 | } |
161 | 160 | ||
162 | /* | 161 | /* |
163 | * send start msg | 162 | * send start msg |
164 | */ | 163 | */ |
165 | status = sendmessage(card, CMPID,cmReqType2, | 164 | status = sendmessage(card, CMPID,cmReqType2, |
166 | cmReqClass0, | 165 | cmReqClass0, |
167 | cmReqStartProc, | 166 | cmReqStartProc, |
168 | 0,0,NULL); | 167 | 0,0,NULL); |
169 | pr_debug("%s: Sent startProc\n", sc_adapter[card]->devicename); | 168 | pr_debug("%s: Sent startProc\n", sc_adapter[card]->devicename); |
170 | 169 | ||
171 | return status; | 170 | return status; |
172 | } | 171 | } |
173 | 172 | ||
174 | 173 | ||
175 | /* | 174 | /* |
176 | * Dials the number passed in | 175 | * Dials the number passed in |
177 | */ | 176 | */ |
178 | static int dial(int card, unsigned long channel, setup_parm setup) | 177 | static int dial(int card, unsigned long channel, setup_parm setup) |
179 | { | 178 | { |
180 | int status; | 179 | int status; |
181 | char Phone[48]; | 180 | char Phone[48]; |
182 | 181 | ||
183 | if(!IS_VALID_CARD(card)) { | 182 | if(!IS_VALID_CARD(card)) { |
184 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 183 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
185 | return -ENODEV; | 184 | return -ENODEV; |
186 | } | 185 | } |
187 | 186 | ||
188 | /*extract ISDN number to dial from eaz/msn string*/ | 187 | /*extract ISDN number to dial from eaz/msn string*/ |
189 | strcpy(Phone,setup.phone); | 188 | strcpy(Phone,setup.phone); |
190 | 189 | ||
191 | /*send the connection message*/ | 190 | /*send the connection message*/ |
192 | status = sendmessage(card, CEPID,ceReqTypePhy, | 191 | status = sendmessage(card, CEPID,ceReqTypePhy, |
193 | ceReqClass1, | 192 | ceReqClass1, |
194 | ceReqPhyConnect, | 193 | ceReqPhyConnect, |
195 | (unsigned char) channel+1, | 194 | (unsigned char) channel+1, |
196 | strlen(Phone), | 195 | strlen(Phone), |
197 | (unsigned int *) Phone); | 196 | (unsigned int *) Phone); |
198 | 197 | ||
199 | pr_debug("%s: Dialing %s on channel %d\n", | 198 | pr_debug("%s: Dialing %s on channel %d\n", |
200 | sc_adapter[card]->devicename, Phone, channel+1); | 199 | sc_adapter[card]->devicename, Phone, channel+1); |
201 | 200 | ||
202 | return status; | 201 | return status; |
203 | } | 202 | } |
204 | 203 | ||
205 | /* | 204 | /* |
206 | * Answer an incoming call | 205 | * Answer an incoming call |
207 | */ | 206 | */ |
208 | static int answer(int card, unsigned long channel) | 207 | static int answer(int card, unsigned long channel) |
209 | { | 208 | { |
210 | if(!IS_VALID_CARD(card)) { | 209 | if(!IS_VALID_CARD(card)) { |
211 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 210 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
212 | return -ENODEV; | 211 | return -ENODEV; |
213 | } | 212 | } |
214 | 213 | ||
215 | if(setup_buffers(card, channel+1, BUFFER_SIZE)) { | 214 | if(setup_buffers(card, channel+1, BUFFER_SIZE)) { |
216 | hangup(card, channel+1); | 215 | hangup(card, channel+1); |
217 | return -ENOBUFS; | 216 | return -ENOBUFS; |
218 | } | 217 | } |
219 | 218 | ||
220 | indicate_status(card, ISDN_STAT_BCONN,channel,NULL); | 219 | indicate_status(card, ISDN_STAT_BCONN,channel,NULL); |
221 | pr_debug("%s: Answered incoming call on channel %s\n", | 220 | pr_debug("%s: Answered incoming call on channel %s\n", |
222 | sc_adapter[card]->devicename, channel+1); | 221 | sc_adapter[card]->devicename, channel+1); |
223 | return 0; | 222 | return 0; |
224 | } | 223 | } |
225 | 224 | ||
226 | /* | 225 | /* |
227 | * Hangup up the call on specified channel | 226 | * Hangup up the call on specified channel |
228 | */ | 227 | */ |
229 | static int hangup(int card, unsigned long channel) | 228 | static int hangup(int card, unsigned long channel) |
230 | { | 229 | { |
231 | int status; | 230 | int status; |
232 | 231 | ||
233 | if(!IS_VALID_CARD(card)) { | 232 | if(!IS_VALID_CARD(card)) { |
234 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 233 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
235 | return -ENODEV; | 234 | return -ENODEV; |
236 | } | 235 | } |
237 | 236 | ||
238 | status = sendmessage(card, CEPID, ceReqTypePhy, | 237 | status = sendmessage(card, CEPID, ceReqTypePhy, |
239 | ceReqClass1, | 238 | ceReqClass1, |
240 | ceReqPhyDisconnect, | 239 | ceReqPhyDisconnect, |
241 | (unsigned char) channel+1, | 240 | (unsigned char) channel+1, |
242 | 0, | 241 | 0, |
243 | NULL); | 242 | NULL); |
244 | pr_debug("%s: Sent HANGUP message to channel %d\n", | 243 | pr_debug("%s: Sent HANGUP message to channel %d\n", |
245 | sc_adapter[card]->devicename, channel+1); | 244 | sc_adapter[card]->devicename, channel+1); |
246 | return status; | 245 | return status; |
247 | } | 246 | } |
248 | 247 | ||
249 | /* | 248 | /* |
250 | * Set the layer 2 protocol (X.25, HDLC, Raw) | 249 | * Set the layer 2 protocol (X.25, HDLC, Raw) |
251 | */ | 250 | */ |
252 | static int setl2(int card, unsigned long arg) | 251 | static int setl2(int card, unsigned long arg) |
253 | { | 252 | { |
254 | int status =0; | 253 | int status =0; |
255 | int protocol,channel; | 254 | int protocol,channel; |
256 | 255 | ||
257 | if(!IS_VALID_CARD(card)) { | 256 | if(!IS_VALID_CARD(card)) { |
258 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 257 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
259 | return -ENODEV; | 258 | return -ENODEV; |
260 | } | 259 | } |
261 | protocol = arg >> 8; | 260 | protocol = arg >> 8; |
262 | channel = arg & 0xff; | 261 | channel = arg & 0xff; |
263 | sc_adapter[card]->channel[channel].l2_proto = protocol; | 262 | sc_adapter[card]->channel[channel].l2_proto = protocol; |
264 | pr_debug("%s: Level 2 protocol for channel %d set to %s from %d\n", | 263 | pr_debug("%s: Level 2 protocol for channel %d set to %s from %d\n", |
265 | sc_adapter[card]->devicename, channel+1, | 264 | sc_adapter[card]->devicename, channel+1, |
266 | l2protos[sc_adapter[card]->channel[channel].l2_proto],protocol); | 265 | l2protos[sc_adapter[card]->channel[channel].l2_proto],protocol); |
267 | 266 | ||
268 | /* | 267 | /* |
269 | * check that the adapter is also set to the correct protocol | 268 | * check that the adapter is also set to the correct protocol |
270 | */ | 269 | */ |
271 | pr_debug("%s: Sending GetFrameFormat for channel %d\n", | 270 | pr_debug("%s: Sending GetFrameFormat for channel %d\n", |
272 | sc_adapter[card]->devicename, channel+1); | 271 | sc_adapter[card]->devicename, channel+1); |
273 | status = sendmessage(card, CEPID, ceReqTypeCall, | 272 | status = sendmessage(card, CEPID, ceReqTypeCall, |
274 | ceReqClass0, | 273 | ceReqClass0, |
275 | ceReqCallGetFrameFormat, | 274 | ceReqCallGetFrameFormat, |
276 | (unsigned char)channel+1, | 275 | (unsigned char)channel+1, |
277 | 1, | 276 | 1, |
278 | (unsigned int *) protocol); | 277 | (unsigned int *) protocol); |
279 | if(status) | 278 | if(status) |
280 | return status; | 279 | return status; |
281 | return 0; | 280 | return 0; |
282 | } | 281 | } |
283 | 282 | ||
284 | /* | 283 | /* |
285 | * Set the layer 3 protocol | 284 | * Set the layer 3 protocol |
286 | */ | 285 | */ |
287 | static int setl3(int card, unsigned long channel) | 286 | static int setl3(int card, unsigned long channel) |
288 | { | 287 | { |
289 | int protocol = channel >> 8; | 288 | int protocol = channel >> 8; |
290 | 289 | ||
291 | if(!IS_VALID_CARD(card)) { | 290 | if(!IS_VALID_CARD(card)) { |
292 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 291 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
293 | return -ENODEV; | 292 | return -ENODEV; |
294 | } | 293 | } |
295 | 294 | ||
296 | sc_adapter[card]->channel[channel].l3_proto = protocol; | 295 | sc_adapter[card]->channel[channel].l3_proto = protocol; |
297 | pr_debug("%s: Level 3 protocol for channel %d set to %s\n", | 296 | pr_debug("%s: Level 3 protocol for channel %d set to %s\n", |
298 | sc_adapter[card]->devicename, channel+1, l3protos[protocol]); | 297 | sc_adapter[card]->devicename, channel+1, l3protos[protocol]); |
299 | return 0; | 298 | return 0; |
300 | } | 299 | } |
301 | 300 | ||
302 | static int acceptb(int card, unsigned long channel) | 301 | static int acceptb(int card, unsigned long channel) |
303 | { | 302 | { |
304 | if(!IS_VALID_CARD(card)) { | 303 | if(!IS_VALID_CARD(card)) { |
305 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 304 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
306 | return -ENODEV; | 305 | return -ENODEV; |
307 | } | 306 | } |
308 | 307 | ||
309 | if(setup_buffers(card, channel+1, BUFFER_SIZE)) | 308 | if(setup_buffers(card, channel+1, BUFFER_SIZE)) |
310 | { | 309 | { |
311 | hangup(card, channel+1); | 310 | hangup(card, channel+1); |
312 | return -ENOBUFS; | 311 | return -ENOBUFS; |
313 | } | 312 | } |
314 | 313 | ||
315 | pr_debug("%s: B-Channel connection accepted on channel %d\n", | 314 | pr_debug("%s: B-Channel connection accepted on channel %d\n", |
316 | sc_adapter[card]->devicename, channel+1); | 315 | sc_adapter[card]->devicename, channel+1); |
317 | indicate_status(card, ISDN_STAT_BCONN, channel, NULL); | 316 | indicate_status(card, ISDN_STAT_BCONN, channel, NULL); |
318 | return 0; | 317 | return 0; |
319 | } | 318 | } |
320 | 319 | ||
321 | static int clreaz(int card, unsigned long arg) | 320 | static int clreaz(int card, unsigned long arg) |
322 | { | 321 | { |
323 | if(!IS_VALID_CARD(card)) { | 322 | if(!IS_VALID_CARD(card)) { |
324 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 323 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
325 | return -ENODEV; | 324 | return -ENODEV; |
326 | } | 325 | } |
327 | 326 | ||
328 | strcpy(sc_adapter[card]->channel[arg].eazlist, ""); | 327 | strcpy(sc_adapter[card]->channel[arg].eazlist, ""); |
329 | sc_adapter[card]->channel[arg].eazclear = 1; | 328 | sc_adapter[card]->channel[arg].eazclear = 1; |
330 | pr_debug("%s: EAZ List cleared for channel %d\n", | 329 | pr_debug("%s: EAZ List cleared for channel %d\n", |
331 | sc_adapter[card]->devicename, arg+1); | 330 | sc_adapter[card]->devicename, arg+1); |
332 | return 0; | 331 | return 0; |
333 | } | 332 | } |
334 | 333 | ||
335 | static int seteaz(int card, unsigned long arg, char *num) | 334 | static int seteaz(int card, unsigned long arg, char *num) |
336 | { | 335 | { |
337 | if(!IS_VALID_CARD(card)) { | 336 | if(!IS_VALID_CARD(card)) { |
338 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 337 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
339 | return -ENODEV; | 338 | return -ENODEV; |
340 | } | 339 | } |
341 | 340 | ||
342 | strcpy(sc_adapter[card]->channel[arg].eazlist, num); | 341 | strcpy(sc_adapter[card]->channel[arg].eazlist, num); |
343 | sc_adapter[card]->channel[arg].eazclear = 0; | 342 | sc_adapter[card]->channel[arg].eazclear = 0; |
344 | pr_debug("%s: EAZ list for channel %d set to: %s\n", | 343 | pr_debug("%s: EAZ list for channel %d set to: %s\n", |
345 | sc_adapter[card]->devicename, arg+1, | 344 | sc_adapter[card]->devicename, arg+1, |
346 | sc_adapter[card]->channel[arg].eazlist); | 345 | sc_adapter[card]->channel[arg].eazlist); |
347 | return 0; | 346 | return 0; |
348 | } | 347 | } |
349 | 348 | ||
350 | int reset(int card) | 349 | int reset(int card) |
351 | { | 350 | { |
352 | unsigned long flags; | 351 | unsigned long flags; |
353 | 352 | ||
354 | if(!IS_VALID_CARD(card)) { | 353 | if(!IS_VALID_CARD(card)) { |
355 | pr_debug("Invalid param: %d is not a valid card id\n", card); | 354 | pr_debug("Invalid param: %d is not a valid card id\n", card); |
356 | return -ENODEV; | 355 | return -ENODEV; |
357 | } | 356 | } |
358 | 357 | ||
359 | indicate_status(card, ISDN_STAT_STOP, 0, NULL); | 358 | indicate_status(card, ISDN_STAT_STOP, 0, NULL); |
360 | 359 | ||
361 | if(sc_adapter[card]->EngineUp) { | 360 | if(sc_adapter[card]->EngineUp) { |
362 | del_timer(&sc_adapter[card]->stat_timer); | 361 | del_timer(&sc_adapter[card]->stat_timer); |
363 | } | 362 | } |
364 | 363 | ||
365 | sc_adapter[card]->EngineUp = 0; | 364 | sc_adapter[card]->EngineUp = 0; |
366 | 365 | ||
367 | spin_lock_irqsave(&sc_adapter[card]->lock, flags); | 366 | spin_lock_irqsave(&sc_adapter[card]->lock, flags); |
368 | init_timer(&sc_adapter[card]->reset_timer); | 367 | init_timer(&sc_adapter[card]->reset_timer); |
369 | sc_adapter[card]->reset_timer.function = check_reset; | 368 | sc_adapter[card]->reset_timer.function = check_reset; |
370 | sc_adapter[card]->reset_timer.data = card; | 369 | sc_adapter[card]->reset_timer.data = card; |
371 | sc_adapter[card]->reset_timer.expires = jiffies + CHECKRESET_TIME; | 370 | sc_adapter[card]->reset_timer.expires = jiffies + CHECKRESET_TIME; |
372 | add_timer(&sc_adapter[card]->reset_timer); | 371 | add_timer(&sc_adapter[card]->reset_timer); |
373 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); | 372 | spin_unlock_irqrestore(&sc_adapter[card]->lock, flags); |
374 | 373 | ||
375 | outb(0x1,sc_adapter[card]->ioport[SFT_RESET]); | 374 | outb(0x1,sc_adapter[card]->ioport[SFT_RESET]); |
376 | 375 | ||
377 | pr_debug("%s: Adapter Reset\n", sc_adapter[card]->devicename); | 376 | pr_debug("%s: Adapter Reset\n", sc_adapter[card]->devicename); |
378 | return 0; | 377 | return 0; |
379 | } | 378 | } |
380 | 379 | ||
381 | void flushreadfifo (int card) | 380 | void flushreadfifo (int card) |
382 | { | 381 | { |
383 | while(inb(sc_adapter[card]->ioport[FIFO_STATUS]) & RF_HAS_DATA) | 382 | while(inb(sc_adapter[card]->ioport[FIFO_STATUS]) & RF_HAS_DATA) |
384 | inb(sc_adapter[card]->ioport[FIFO_READ]); | 383 | inb(sc_adapter[card]->ioport[FIFO_READ]); |
385 | } | 384 | } |
386 | 385 |