mISDNif.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. /*
  2. *
  3. * Author Karsten Keil <kkeil@novell.com>
  4. *
  5. * Copyright 2008 by Karsten Keil <kkeil@novell.com>
  6. *
  7. * This code is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
  9. * version 2.1 as published by the Free Software Foundation.
  10. *
  11. * This code is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU LESSER GENERAL PUBLIC LICENSE for more details.
  15. *
  16. */
  17. #ifndef mISDNIF_H
  18. #define mISDNIF_H
  19. #include <stdarg.h>
  20. #include <linux/types.h>
  21. #include <linux/errno.h>
  22. #include <linux/socket.h>
  23. /*
  24. * ABI Version 32 bit
  25. *
  26. * <8 bit> Major version
  27. * - changed if any interface become backwards incompatible
  28. *
  29. * <8 bit> Minor version
  30. * - changed if any interface is extended but backwards compatible
  31. *
  32. * <16 bit> Release number
  33. * - should be incremented on every checkin
  34. */
  35. #define MISDN_MAJOR_VERSION 1
  36. #define MISDN_MINOR_VERSION 1
  37. #define MISDN_RELEASE 20
  38. /* primitives for information exchange
  39. * generell format
  40. * <16 bit 0 >
  41. * <8 bit command>
  42. * BIT 8 = 1 LAYER private
  43. * BIT 7 = 1 answer
  44. * BIT 6 = 1 DATA
  45. * <8 bit target layer mask>
  46. *
  47. * Layer = 00 is reserved for general commands
  48. Layer = 01 L2 -> HW
  49. Layer = 02 HW -> L2
  50. Layer = 04 L3 -> L2
  51. Layer = 08 L2 -> L3
  52. * Layer = FF is reserved for broadcast commands
  53. */
  54. #define MISDN_CMDMASK 0xff00
  55. #define MISDN_LAYERMASK 0x00ff
  56. /* generell commands */
  57. #define OPEN_CHANNEL 0x0100
  58. #define CLOSE_CHANNEL 0x0200
  59. #define CONTROL_CHANNEL 0x0300
  60. #define CHECK_DATA 0x0400
  61. /* layer 2 -> layer 1 */
  62. #define PH_ACTIVATE_REQ 0x0101
  63. #define PH_DEACTIVATE_REQ 0x0201
  64. #define PH_DATA_REQ 0x2001
  65. #define MPH_ACTIVATE_REQ 0x0501
  66. #define MPH_DEACTIVATE_REQ 0x0601
  67. #define MPH_INFORMATION_REQ 0x0701
  68. #define PH_CONTROL_REQ 0x0801
  69. /* layer 1 -> layer 2 */
  70. #define PH_ACTIVATE_IND 0x0102
  71. #define PH_ACTIVATE_CNF 0x4102
  72. #define PH_DEACTIVATE_IND 0x0202
  73. #define PH_DEACTIVATE_CNF 0x4202
  74. #define PH_DATA_IND 0x2002
  75. #define PH_DATA_E_IND 0x3002
  76. #define MPH_ACTIVATE_IND 0x0502
  77. #define MPH_DEACTIVATE_IND 0x0602
  78. #define MPH_INFORMATION_IND 0x0702
  79. #define PH_DATA_CNF 0x6002
  80. #define PH_CONTROL_IND 0x0802
  81. #define PH_CONTROL_CNF 0x4802
  82. /* layer 3 -> layer 2 */
  83. #define DL_ESTABLISH_REQ 0x1004
  84. #define DL_RELEASE_REQ 0x1104
  85. #define DL_DATA_REQ 0x3004
  86. #define DL_UNITDATA_REQ 0x3104
  87. #define DL_INFORMATION_REQ 0x0004
  88. /* layer 2 -> layer 3 */
  89. #define DL_ESTABLISH_IND 0x1008
  90. #define DL_ESTABLISH_CNF 0x5008
  91. #define DL_RELEASE_IND 0x1108
  92. #define DL_RELEASE_CNF 0x5108
  93. #define DL_DATA_IND 0x3008
  94. #define DL_UNITDATA_IND 0x3108
  95. #define DL_INFORMATION_IND 0x0008
  96. /* intern layer 2 managment */
  97. #define MDL_ASSIGN_REQ 0x1804
  98. #define MDL_ASSIGN_IND 0x1904
  99. #define MDL_REMOVE_REQ 0x1A04
  100. #define MDL_REMOVE_IND 0x1B04
  101. #define MDL_STATUS_UP_IND 0x1C04
  102. #define MDL_STATUS_DOWN_IND 0x1D04
  103. #define MDL_STATUS_UI_IND 0x1E04
  104. #define MDL_ERROR_IND 0x1F04
  105. #define MDL_ERROR_RSP 0x5F04
  106. /* DL_INFORMATION_IND types */
  107. #define DL_INFO_L2_CONNECT 0x0001
  108. #define DL_INFO_L2_REMOVED 0x0002
  109. /* PH_CONTROL types */
  110. /* TOUCH TONE IS 0x20XX XX "0"..."9", "A","B","C","D","*","#" */
  111. #define DTMF_TONE_VAL 0x2000
  112. #define DTMF_TONE_MASK 0x007F
  113. #define DTMF_TONE_START 0x2100
  114. #define DTMF_TONE_STOP 0x2200
  115. #define DTMF_HFC_COEF 0x4000
  116. #define DSP_CONF_JOIN 0x2403
  117. #define DSP_CONF_SPLIT 0x2404
  118. #define DSP_RECEIVE_OFF 0x2405
  119. #define DSP_RECEIVE_ON 0x2406
  120. #define DSP_ECHO_ON 0x2407
  121. #define DSP_ECHO_OFF 0x2408
  122. #define DSP_MIX_ON 0x2409
  123. #define DSP_MIX_OFF 0x240a
  124. #define DSP_DELAY 0x240b
  125. #define DSP_JITTER 0x240c
  126. #define DSP_TXDATA_ON 0x240d
  127. #define DSP_TXDATA_OFF 0x240e
  128. #define DSP_TX_DEJITTER 0x240f
  129. #define DSP_TX_DEJ_OFF 0x2410
  130. #define DSP_TONE_PATT_ON 0x2411
  131. #define DSP_TONE_PATT_OFF 0x2412
  132. #define DSP_VOL_CHANGE_TX 0x2413
  133. #define DSP_VOL_CHANGE_RX 0x2414
  134. #define DSP_BF_ENABLE_KEY 0x2415
  135. #define DSP_BF_DISABLE 0x2416
  136. #define DSP_BF_ACCEPT 0x2416
  137. #define DSP_BF_REJECT 0x2417
  138. #define DSP_PIPELINE_CFG 0x2418
  139. #define HFC_VOL_CHANGE_TX 0x2601
  140. #define HFC_VOL_CHANGE_RX 0x2602
  141. #define HFC_SPL_LOOP_ON 0x2603
  142. #define HFC_SPL_LOOP_OFF 0x2604
  143. /* DSP_TONE_PATT_ON parameter */
  144. #define TONE_OFF 0x0000
  145. #define TONE_GERMAN_DIALTONE 0x0001
  146. #define TONE_GERMAN_OLDDIALTONE 0x0002
  147. #define TONE_AMERICAN_DIALTONE 0x0003
  148. #define TONE_GERMAN_DIALPBX 0x0004
  149. #define TONE_GERMAN_OLDDIALPBX 0x0005
  150. #define TONE_AMERICAN_DIALPBX 0x0006
  151. #define TONE_GERMAN_RINGING 0x0007
  152. #define TONE_GERMAN_OLDRINGING 0x0008
  153. #define TONE_AMERICAN_RINGPBX 0x000b
  154. #define TONE_GERMAN_RINGPBX 0x000c
  155. #define TONE_GERMAN_OLDRINGPBX 0x000d
  156. #define TONE_AMERICAN_RINGING 0x000e
  157. #define TONE_GERMAN_BUSY 0x000f
  158. #define TONE_GERMAN_OLDBUSY 0x0010
  159. #define TONE_AMERICAN_BUSY 0x0011
  160. #define TONE_GERMAN_HANGUP 0x0012
  161. #define TONE_GERMAN_OLDHANGUP 0x0013
  162. #define TONE_AMERICAN_HANGUP 0x0014
  163. #define TONE_SPECIAL_INFO 0x0015
  164. #define TONE_GERMAN_GASSENBESETZT 0x0016
  165. #define TONE_GERMAN_AUFSCHALTTON 0x0016
  166. /* MPH_INFORMATION_IND */
  167. #define L1_SIGNAL_LOS_OFF 0x0010
  168. #define L1_SIGNAL_LOS_ON 0x0011
  169. #define L1_SIGNAL_AIS_OFF 0x0012
  170. #define L1_SIGNAL_AIS_ON 0x0013
  171. #define L1_SIGNAL_RDI_OFF 0x0014
  172. #define L1_SIGNAL_RDI_ON 0x0015
  173. #define L1_SIGNAL_SLIP_RX 0x0020
  174. #define L1_SIGNAL_SLIP_TX 0x0021
  175. /*
  176. * protocol ids
  177. * D channel 1-31
  178. * B channel 33 - 63
  179. */
  180. #define ISDN_P_NONE 0
  181. #define ISDN_P_BASE 0
  182. #define ISDN_P_TE_S0 0x01
  183. #define ISDN_P_NT_S0 0x02
  184. #define ISDN_P_TE_E1 0x03
  185. #define ISDN_P_NT_E1 0x04
  186. #define ISDN_P_TE_UP0 0x05
  187. #define ISDN_P_NT_UP0 0x06
  188. #define IS_ISDN_P_TE(p) ((p == ISDN_P_TE_S0) || (p == ISDN_P_TE_E1) || \
  189. (p == ISDN_P_TE_UP0) || (p == ISDN_P_LAPD_TE))
  190. #define IS_ISDN_P_NT(p) ((p == ISDN_P_NT_S0) || (p == ISDN_P_NT_E1) || \
  191. (p == ISDN_P_NT_UP0) || (p == ISDN_P_LAPD_NT))
  192. #define IS_ISDN_P_S0(p) ((p == ISDN_P_TE_S0) || (p == ISDN_P_NT_S0))
  193. #define IS_ISDN_P_E1(p) ((p == ISDN_P_TE_E1) || (p == ISDN_P_NT_E1))
  194. #define IS_ISDN_P_UP0(p) ((p == ISDN_P_TE_UP0) || (p == ISDN_P_NT_UP0))
  195. #define ISDN_P_LAPD_TE 0x10
  196. #define ISDN_P_LAPD_NT 0x11
  197. #define ISDN_P_B_MASK 0x1f
  198. #define ISDN_P_B_START 0x20
  199. #define ISDN_P_B_RAW 0x21
  200. #define ISDN_P_B_HDLC 0x22
  201. #define ISDN_P_B_X75SLP 0x23
  202. #define ISDN_P_B_L2DTMF 0x24
  203. #define ISDN_P_B_L2DSP 0x25
  204. #define ISDN_P_B_L2DSPHDLC 0x26
  205. #define OPTION_L2_PMX 1
  206. #define OPTION_L2_PTP 2
  207. #define OPTION_L2_FIXEDTEI 3
  208. #define OPTION_L2_CLEANUP 4
  209. /* should be in sync with linux/kobject.h:KOBJ_NAME_LEN */
  210. #define MISDN_MAX_IDLEN 20
  211. struct mISDNhead {
  212. unsigned int prim;
  213. unsigned int id;
  214. } __attribute__((packed));
  215. #define MISDN_HEADER_LEN sizeof(struct mISDNhead)
  216. #define MAX_DATA_SIZE 2048
  217. #define MAX_DATA_MEM (MAX_DATA_SIZE + MISDN_HEADER_LEN)
  218. #define MAX_DFRAME_LEN 260
  219. #define MISDN_ID_ADDR_MASK 0xFFFF
  220. #define MISDN_ID_TEI_MASK 0xFF00
  221. #define MISDN_ID_SAPI_MASK 0x00FF
  222. #define MISDN_ID_TEI_ANY 0x7F00
  223. #define MISDN_ID_ANY 0xFFFF
  224. #define MISDN_ID_NONE 0xFFFE
  225. #define GROUP_TEI 127
  226. #define TEI_SAPI 63
  227. #define CTRL_SAPI 0
  228. #define MISDN_MAX_CHANNEL 127
  229. #define MISDN_CHMAP_SIZE ((MISDN_MAX_CHANNEL + 1) >> 3)
  230. #define SOL_MISDN 0
  231. struct sockaddr_mISDN {
  232. sa_family_t family;
  233. unsigned char dev;
  234. unsigned char channel;
  235. unsigned char sapi;
  236. unsigned char tei;
  237. };
  238. struct mISDNversion {
  239. unsigned char major;
  240. unsigned char minor;
  241. unsigned short release;
  242. };
  243. struct mISDN_devinfo {
  244. u_int id;
  245. u_int Dprotocols;
  246. u_int Bprotocols;
  247. u_int protocol;
  248. u_char channelmap[MISDN_CHMAP_SIZE];
  249. u_int nrbchan;
  250. char name[MISDN_MAX_IDLEN];
  251. };
  252. struct mISDN_devrename {
  253. u_int id;
  254. char name[MISDN_MAX_IDLEN]; /* new name */
  255. };
  256. /* MPH_INFORMATION_REQ payload */
  257. struct ph_info_ch {
  258. __u32 protocol;
  259. __u64 Flags;
  260. };
  261. struct ph_info_dch {
  262. struct ph_info_ch ch;
  263. __u16 state;
  264. __u16 num_bch;
  265. };
  266. struct ph_info {
  267. struct ph_info_dch dch;
  268. struct ph_info_ch bch[];
  269. };
  270. /* timer device ioctl */
  271. #define IMADDTIMER _IOR('I', 64, int)
  272. #define IMDELTIMER _IOR('I', 65, int)
  273. /* socket ioctls */
  274. #define IMGETVERSION _IOR('I', 66, int)
  275. #define IMGETCOUNT _IOR('I', 67, int)
  276. #define IMGETDEVINFO _IOR('I', 68, int)
  277. #define IMCTRLREQ _IOR('I', 69, int)
  278. #define IMCLEAR_L2 _IOR('I', 70, int)
  279. #define IMSETDEVNAME _IOR('I', 71, struct mISDN_devrename)
  280. static inline int
  281. test_channelmap(u_int nr, u_char *map)
  282. {
  283. if (nr <= MISDN_MAX_CHANNEL)
  284. return map[nr >> 3] & (1 << (nr & 7));
  285. else
  286. return 0;
  287. }
  288. static inline void
  289. set_channelmap(u_int nr, u_char *map)
  290. {
  291. map[nr >> 3] |= (1 << (nr & 7));
  292. }
  293. static inline void
  294. clear_channelmap(u_int nr, u_char *map)
  295. {
  296. map[nr >> 3] &= ~(1 << (nr & 7));
  297. }
  298. /* CONTROL_CHANNEL parameters */
  299. #define MISDN_CTRL_GETOP 0x0000
  300. #define MISDN_CTRL_LOOP 0x0001
  301. #define MISDN_CTRL_CONNECT 0x0002
  302. #define MISDN_CTRL_DISCONNECT 0x0004
  303. #define MISDN_CTRL_PCMCONNECT 0x0010
  304. #define MISDN_CTRL_PCMDISCONNECT 0x0020
  305. #define MISDN_CTRL_SETPEER 0x0040
  306. #define MISDN_CTRL_UNSETPEER 0x0080
  307. #define MISDN_CTRL_RX_OFF 0x0100
  308. #define MISDN_CTRL_FILL_EMPTY 0x0200
  309. #define MISDN_CTRL_GETPEER 0x0400
  310. #define MISDN_CTRL_HW_FEATURES_OP 0x2000
  311. #define MISDN_CTRL_HW_FEATURES 0x2001
  312. #define MISDN_CTRL_HFC_OP 0x4000
  313. #define MISDN_CTRL_HFC_PCM_CONN 0x4001
  314. #define MISDN_CTRL_HFC_PCM_DISC 0x4002
  315. #define MISDN_CTRL_HFC_CONF_JOIN 0x4003
  316. #define MISDN_CTRL_HFC_CONF_SPLIT 0x4004
  317. #define MISDN_CTRL_HFC_RECEIVE_OFF 0x4005
  318. #define MISDN_CTRL_HFC_RECEIVE_ON 0x4006
  319. #define MISDN_CTRL_HFC_ECHOCAN_ON 0x4007
  320. #define MISDN_CTRL_HFC_ECHOCAN_OFF 0x4008
  321. #define MISDN_CTRL_HFC_WD_INIT 0x4009
  322. #define MISDN_CTRL_HFC_WD_RESET 0x400A
  323. /* socket options */
  324. #define MISDN_TIME_STAMP 0x0001
  325. struct mISDN_ctrl_req {
  326. int op;
  327. int channel;
  328. int p1;
  329. int p2;
  330. };
  331. /* muxer options */
  332. #define MISDN_OPT_ALL 1
  333. #define MISDN_OPT_TEIMGR 2
  334. #ifdef __KERNEL__
  335. #include <linux/list.h>
  336. #include <linux/skbuff.h>
  337. #include <linux/net.h>
  338. #include <net/sock.h>
  339. #include <linux/completion.h>
  340. #define DEBUG_CORE 0x000000ff
  341. #define DEBUG_CORE_FUNC 0x00000002
  342. #define DEBUG_SOCKET 0x00000004
  343. #define DEBUG_MANAGER 0x00000008
  344. #define DEBUG_SEND_ERR 0x00000010
  345. #define DEBUG_MSG_THREAD 0x00000020
  346. #define DEBUG_QUEUE_FUNC 0x00000040
  347. #define DEBUG_L1 0x0000ff00
  348. #define DEBUG_L1_FSM 0x00000200
  349. #define DEBUG_L2 0x00ff0000
  350. #define DEBUG_L2_FSM 0x00020000
  351. #define DEBUG_L2_CTRL 0x00040000
  352. #define DEBUG_L2_RECV 0x00080000
  353. #define DEBUG_L2_TEI 0x00100000
  354. #define DEBUG_L2_TEIFSM 0x00200000
  355. #define DEBUG_TIMER 0x01000000
  356. #define DEBUG_CLOCK 0x02000000
  357. #define mISDN_HEAD_P(s) ((struct mISDNhead *)&s->cb[0])
  358. #define mISDN_HEAD_PRIM(s) (((struct mISDNhead *)&s->cb[0])->prim)
  359. #define mISDN_HEAD_ID(s) (((struct mISDNhead *)&s->cb[0])->id)
  360. /* socket states */
  361. #define MISDN_OPEN 1
  362. #define MISDN_BOUND 2
  363. #define MISDN_CLOSED 3
  364. struct mISDNchannel;
  365. struct mISDNdevice;
  366. struct mISDNstack;
  367. struct mISDNclock;
  368. struct channel_req {
  369. u_int protocol;
  370. struct sockaddr_mISDN adr;
  371. struct mISDNchannel *ch;
  372. };
  373. typedef int (ctrl_func_t)(struct mISDNchannel *, u_int, void *);
  374. typedef int (send_func_t)(struct mISDNchannel *, struct sk_buff *);
  375. typedef int (create_func_t)(struct channel_req *);
  376. struct Bprotocol {
  377. struct list_head list;
  378. char *name;
  379. u_int Bprotocols;
  380. create_func_t *create;
  381. };
  382. struct mISDNchannel {
  383. struct list_head list;
  384. u_int protocol;
  385. u_int nr;
  386. u_long opt;
  387. u_int addr;
  388. struct mISDNstack *st;
  389. struct mISDNchannel *peer;
  390. send_func_t *send;
  391. send_func_t *recv;
  392. ctrl_func_t *ctrl;
  393. };
  394. struct mISDN_sock_list {
  395. struct hlist_head head;
  396. rwlock_t lock;
  397. };
  398. struct mISDN_sock {
  399. struct sock sk;
  400. struct mISDNchannel ch;
  401. u_int cmask;
  402. struct mISDNdevice *dev;
  403. };
  404. struct mISDNdevice {
  405. struct mISDNchannel D;
  406. u_int id;
  407. u_int Dprotocols;
  408. u_int Bprotocols;
  409. u_int nrbchan;
  410. u_char channelmap[MISDN_CHMAP_SIZE];
  411. struct list_head bchannels;
  412. struct mISDNchannel *teimgr;
  413. struct device dev;
  414. };
  415. struct mISDNstack {
  416. u_long status;
  417. struct mISDNdevice *dev;
  418. struct task_struct *thread;
  419. struct completion *notify;
  420. wait_queue_head_t workq;
  421. struct sk_buff_head msgq;
  422. struct list_head layer2;
  423. struct mISDNchannel *layer1;
  424. struct mISDNchannel own;
  425. struct mutex lmutex; /* protect lists */
  426. struct mISDN_sock_list l1sock;
  427. #ifdef MISDN_MSG_STATS
  428. u_int msg_cnt;
  429. u_int sleep_cnt;
  430. u_int stopped_cnt;
  431. #endif
  432. };
  433. typedef int (clockctl_func_t)(void *, int);
  434. struct mISDNclock {
  435. struct list_head list;
  436. char name[64];
  437. int pri;
  438. clockctl_func_t *ctl;
  439. void *priv;
  440. };
  441. /* global alloc/queue functions */
  442. static inline struct sk_buff *
  443. mI_alloc_skb(unsigned int len, gfp_t gfp_mask)
  444. {
  445. struct sk_buff *skb;
  446. skb = alloc_skb(len + MISDN_HEADER_LEN, gfp_mask);
  447. if (likely(skb))
  448. skb_reserve(skb, MISDN_HEADER_LEN);
  449. return skb;
  450. }
  451. static inline struct sk_buff *
  452. _alloc_mISDN_skb(u_int prim, u_int id, u_int len, void *dp, gfp_t gfp_mask)
  453. {
  454. struct sk_buff *skb = mI_alloc_skb(len, gfp_mask);
  455. struct mISDNhead *hh;
  456. if (!skb)
  457. return NULL;
  458. if (len)
  459. memcpy(skb_put(skb, len), dp, len);
  460. hh = mISDN_HEAD_P(skb);
  461. hh->prim = prim;
  462. hh->id = id;
  463. return skb;
  464. }
  465. static inline void
  466. _queue_data(struct mISDNchannel *ch, u_int prim,
  467. u_int id, u_int len, void *dp, gfp_t gfp_mask)
  468. {
  469. struct sk_buff *skb;
  470. if (!ch->peer)
  471. return;
  472. skb = _alloc_mISDN_skb(prim, id, len, dp, gfp_mask);
  473. if (!skb)
  474. return;
  475. if (ch->recv(ch->peer, skb))
  476. dev_kfree_skb(skb);
  477. }
  478. /* global register/unregister functions */
  479. extern int mISDN_register_device(struct mISDNdevice *,
  480. struct device *parent, char *name);
  481. extern void mISDN_unregister_device(struct mISDNdevice *);
  482. extern int mISDN_register_Bprotocol(struct Bprotocol *);
  483. extern void mISDN_unregister_Bprotocol(struct Bprotocol *);
  484. extern struct mISDNclock *mISDN_register_clock(char *, int, clockctl_func_t *,
  485. void *);
  486. extern void mISDN_unregister_clock(struct mISDNclock *);
  487. static inline struct mISDNdevice *dev_to_mISDN(struct device *dev)
  488. {
  489. if (dev)
  490. return dev_get_drvdata(dev);
  491. else
  492. return NULL;
  493. }
  494. extern void set_channel_address(struct mISDNchannel *, u_int, u_int);
  495. extern void mISDN_clock_update(struct mISDNclock *, int, struct timeval *);
  496. extern unsigned short mISDN_clock_get(void);
  497. #endif /* __KERNEL__ */
  498. #endif /* mISDNIF_H */