1 /* 2 * cyclomx.h Cyclom 2X WAN Link Driver. 3 * User-level API definitions. 4 * 5 * Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br> 6 * 7 * Copyright: (c) 1998-2000 Arnaldo Carvalho de Melo 8 * 9 * Based on wanpipe.h by Gene Kozin <genek@compuserve.com> 10 * 11 * This program is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU General Public License 13 * as published by the Free Software Foundation; either version 14 * 2 of the License, or (at your option) any later version. 15 * ============================================================================ 16 * 2000/07/13 acme remove crap #if KERNEL_VERSION > blah 17 * 2000/01/21 acme rename cyclomx_open to cyclomx_mod_inc_use_count 18 * and cyclomx_close to cyclomx_mod_dec_use_count 19 * 1999/05/19 acme wait_queue_head_t wait_stats(support for 2.3.*) 20 * 1999/01/03 acme judicious use of data types 21 * 1998/12/27 acme cleanup: PACKED not needed 22 * 1998/08/08 acme Version 0.0.1 23 */ 24 #ifndef _CYCLOMX_H 25 #define _CYCLOMX_H 26 27 #include <linux/config.h> 28 #include <linux/wanrouter.h> 29 #include <linux/spinlock.h> 30 31 #ifdef __KERNEL__ 32 /* Kernel Interface */ 33 34 #include <linux/cycx_drv.h> /* Cyclom 2X support module API definitions */ 35 #include <linux/cycx_cfm.h> /* Cyclom 2X firmware module definitions */ 36 #ifdef CONFIG_CYCLOMX_X25 37 #include <linux/cycx_x25.h> 38 #endif 39 40 #define is_digit(ch) (((ch)>=(unsigned)'0'&&(ch)<=(unsigned)'9')?1:0) 41 42 /* Adapter Data Space. 43 * This structure is needed because we handle multiple cards, otherwise 44 * static data would do it. 45 */ 46 typedef struct cycx { 47 char devname[WAN_DRVNAME_SZ+1]; /* card name */ 48 cycxhw_t hw; /* hardware configuration */ 49 wan_device_t wandev; /* WAN device data space */ 50 u32 open_cnt; /* number of open interfaces */ 51 u32 state_tick; /* link state timestamp */ 52 spinlock_t lock; 53 char in_isr; /* interrupt-in-service flag */ 54 char buff_int_mode_unbusy; /* flag for carrying out dev_tint */ 55 wait_queue_head_t wait_stats; /* to wait for the STATS indication */ 56 u32 mbox; /* -> mailbox */ 57 void (*isr)(struct cycx* card); /* interrupt service routine */ 58 int (*exec)(struct cycx* card, void* u_cmd, void* u_data); 59 union { 60 #ifdef CONFIG_CYCLOMX_X25 61 struct { /* X.25 specific data */ 62 u32 lo_pvc; 63 u32 hi_pvc; 64 u32 lo_svc; 65 u32 hi_svc; 66 TX25Stats stats; 67 spinlock_t lock; 68 u32 connection_keys; 69 } x; 70 #endif 71 } u; 72 } cycx_t; 73 74 /* Public Functions */ 75 void cyclomx_mod_inc_use_count (cycx_t *card); /* cycx_main.c */ 76 void cyclomx_mod_dec_use_count (cycx_t *card); /* cycx_main.c */ 77 void cyclomx_set_state (cycx_t *card, int state); /* cycx_main.c */ 78 79 #ifdef CONFIG_CYCLOMX_X25 80 int cyx_init (cycx_t *card, wandev_conf_t *conf); /* cycx_x25.c */ 81 #endif 82 #endif /* __KERNEL__ */ 83 #endif /* _CYCLOMX_H */ 84