summaryrefslogtreecommitdiffstats
path: root/include/linux/cyclomx.h
blob: 983295c1835778ce7c72411f6927d834014229f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
* cyclomx.h	Cyclom 2X WAN Link Driver.
*		User-level API definitions.
*
* Author:	Arnaldo Carvalho de Melo <acme@conectiva.com.br>
*
* Copyright:	(c) 1998-2000 Arnaldo Carvalho de Melo
*
* Based on wanpipe.h by Gene Kozin <genek@compuserve.com>
*
*		This program is free software; you can redistribute it and/or
*		modify it under the terms of the GNU General Public License
*		as published by the Free Software Foundation; either version
*		2 of the License, or (at your option) any later version.
* ============================================================================
* 2000/01/21    acme            rename cyclomx_open to cyclomx_mod_inc_use_count
*                               and cyclomx_close to cyclomx_mod_dec_use_count
* 1999/05/19	acme		wait_queue_head_t wait_stats(support for 2.3.*)
* 1999/01/03	acme		judicious use of data types
* 1998/12/27	acme		cleanup: PACKED not needed
* 1998/08/08	acme		Version 0.0.1
*/
#ifndef	_CYCLOMX_H
#define	_CYCLOMX_H

#include <linux/config.h>
#include <linux/wanrouter.h>
#include <linux/spinlock.h>

#ifdef	__KERNEL__
/* Kernel Interface */

#include <linux/cycx_drv.h>	/* Cyclom 2X support module API definitions */
#include <linux/cycx_cfm.h>	/* Cyclom 2X firmware module definitions */
#ifdef CONFIG_CYCLOMX_X25
#include <linux/cycx_x25.h>
#endif

#ifndef	min
#define min(a,b) (((a)<(b))?(a):(b))
#endif
#ifndef	max
#define max(a,b) (((a)>(b))?(a):(b))
#endif

#define	is_digit(ch) (((ch)>=(unsigned)'0'&&(ch)<=(unsigned)'9')?1:0)

/* Adapter Data Space.
 * This structure is needed because we handle multiple cards, otherwise
 * static data would do it.
 */
typedef struct cycx {
	char devname[WAN_DRVNAME_SZ+1];	/* card name */
	cycxhw_t hw;			/* hardware configuration */
	wan_device_t wandev;		/* WAN device data space */
	u32 open_cnt;			/* number of open interfaces */
	u32 state_tick;			/* link state timestamp */
	spinlock_t lock;
	char in_isr;			/* interrupt-in-service flag */
	char buff_int_mode_unbusy;      /* flag for carrying out dev_tint */
#if (LINUX_VERSION_CODE >= 0x20300)
	wait_queue_head_t wait_stats;  /* to wait for the STATS indication */
#else
	struct wait_queue* wait_stats;  /* to wait for the STATS indication */
#endif
	u32 mbox;			/* -> mailbox */
	void (*isr)(struct cycx* card);	/* interrupt service routine */
	int (*exec)(struct cycx* card, void* u_cmd, void* u_data);
	union {
#ifdef CONFIG_CYCLOMX_X25
		struct { /* X.25 specific data */
			u32 lo_pvc;
			u32 hi_pvc;
			u32 lo_svc;
			u32 hi_svc;
			TX25Stats stats;
			spinlock_t lock;
			u32 connection_keys;
		} x;
#endif
	} u;
} cycx_t;

/* Public Functions */
void cyclomx_mod_inc_use_count (cycx_t *card);		/* cycx_main.c */
void cyclomx_mod_dec_use_count (cycx_t *card);		/* cycx_main.c */
void cyclomx_set_state (cycx_t *card, int state);	/* cycx_main.c */

#ifdef CONFIG_CYCLOMX_X25
int cyx_init (cycx_t *card, wandev_conf_t *conf);	/* cycx_x25.c */
#endif
#endif	/* __KERNEL__ */
#endif	/* _CYCLOMX_H */