Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
card.h
Go to the documentation of this file.
1 /* $Id: card.h,v 1.1.10.1 2001/09/23 22:24:59 kai Exp $
2  *
3  * Driver parameters for SpellCaster ISA ISDN adapters
4  *
5  * Copyright (C) 1996 SpellCaster Telecommunications Inc.
6  *
7  * This software may be used and distributed according to the terms
8  * of the GNU General Public License, incorporated herein by reference.
9  *
10  * For more information, please contact [email protected] or write:
11  *
12  * SpellCaster Telecommunications Inc.
13  * 5621 Finch Avenue East, Unit #3
14  * Scarborough, Ontario Canada
15  * M1B 2T9
16  * +1 (416) 297-8565
17  * +1 (416) 297-6433 Facsimile
18  */
19 
20 #ifndef CARD_H
21 #define CARD_H
22 
23 /*
24  * We need these if they're not already included
25  */
26 #include <linux/timer.h>
27 #include <linux/time.h>
28 #include <linux/isdnif.h>
29 #include <linux/irqreturn.h>
30 #include "message.h"
31 #include "scioc.h"
32 
33 /*
34  * Amount of time to wait for a reset to complete
35  */
36 #define CHECKRESET_TIME msecs_to_jiffies(4000)
37 
38 /*
39  * Amount of time between line status checks
40  */
41 #define CHECKSTAT_TIME msecs_to_jiffies(8000)
42 
43 /*
44  * The maximum amount of time to wait for a message response
45  * to arrive. Use exclusively by send_and_receive
46  */
47 #define SAR_TIMEOUT msecs_to_jiffies(10000)
48 
49 /*
50  * Macro to determine is a card id is valid
51  */
52 #define IS_VALID_CARD(x) ((x >= 0) && (x <= cinst))
53 
54 /*
55  * Per channel status and configuration
56  */
57 typedef struct {
58  int l2_proto;
59  int l3_proto;
60  char dn[50];
61  unsigned long first_sendbuf; /* Offset of first send buffer */
62  unsigned int num_sendbufs; /* Number of send buffers */
63  unsigned int free_sendbufs; /* Number of free sendbufs */
64  unsigned int next_sendbuf; /* Next sequential buffer */
65  char eazlist[50]; /* Set with SETEAZ */
66  char sillist[50]; /* Set with SETSIL */
67  int eazclear; /* Don't accept calls if TRUE */
68 } bchan;
69 
70 /*
71  * Everything you want to know about the adapter ...
72  */
73 typedef struct {
74  int model;
75  int driverId; /* LL Id */
76  char devicename[20]; /* The device name */
77  isdn_if *card; /* ISDN4Linux structure */
78  bchan *channel; /* status of the B channels */
79  char nChannels; /* Number of channels */
80  unsigned int interrupt; /* Interrupt number */
81  int iobase; /* I/O Base address */
82  int ioport[MAX_IO_REGS]; /* Index to I/O ports */
83  int shmem_pgport; /* port for the exp mem page reg. */
84  int shmem_magic; /* adapter magic number */
85  unsigned int rambase; /* Shared RAM base address */
86  unsigned int ramsize; /* Size of shared memory */
87  RspMessage async_msg; /* Async response message */
88  int want_async_messages; /* Snoop the Q ? */
89  unsigned char seq_no; /* Next send seq. number */
90  struct timer_list reset_timer; /* Check reset timer */
91  struct timer_list stat_timer; /* Check startproc timer */
92  unsigned char nphystat; /* Latest PhyStat info */
93  unsigned char phystat; /* Last PhyStat info */
94  HWConfig_pl hwconfig; /* Hardware config info */
95  char load_ver[11]; /* CommManage Version string */
96  char proc_ver[11]; /* CommEngine Version */
97  int StartOnReset; /* Indicates startproc after reset */
98  int EngineUp; /* Indicates CommEngine Up */
99  int trace_mode; /* Indicate if tracing is on */
100  spinlock_t lock; /* local lock */
101 } board;
102 
103 
104 extern board *sc_adapter[];
105 extern int cinst;
106 
107 void memcpy_toshmem(int card, void *dest, const void *src, size_t n);
108 void memcpy_fromshmem(int card, void *dest, const void *src, size_t n);
109 int get_card_from_id(int driver);
110 int indicate_status(int card, int event, ulong Channel, char *Data);
111 irqreturn_t interrupt_handler(int interrupt, void *cardptr);
112 int sndpkt(int devId, int channel, int ack, struct sk_buff *data);
113 void rcvpkt(int card, RspMessage *rcvmsg);
114 int command(isdn_ctrl *cmd);
115 int reset(int card);
116 int startproc(int card);
117 int send_and_receive(int card, unsigned int procid, unsigned char type,
118  unsigned char class, unsigned char code,
119  unsigned char link, unsigned char data_len,
120  unsigned char *data, RspMessage *mesgdata, int timeout);
121 void flushreadfifo(int card);
122 int sendmessage(int card, unsigned int procid, unsigned int type,
123  unsigned int class, unsigned int code, unsigned int link,
124  unsigned int data_len, unsigned int *data);
125 int receivemessage(int card, RspMessage *rspmsg);
126 int sc_ioctl(int card, scs_ioctl *data);
127 int setup_buffers(int card, int c);
128 void sc_check_reset(unsigned long data);
129 void check_phystat(unsigned long data);
130 
131 #endif /* CARD_H */