OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [drivers/] [isdn/] [tpam/] [tpam.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/* $Id: tpam.h,v 1.1.1.1 2004-04-15 02:04:00 phoenix Exp $
2
 *
3
 * Turbo PAM ISDN driver for Linux. (Kernel Driver)
4
 *
5
 * Copyright 2001 Stelian Pop <stelian.pop@fr.alcove.com>, Alcôve
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 all support questions please contact: <support@auvertech.fr>
11
 *
12
 */
13
 
14
#ifndef _TPAM_PRIV_H_
15
#define _TPAM_PRIV_H_
16
 
17
#include <linux/isdnif.h>
18
#include <linux/init.h>
19
 
20
/* Maximum number of channels for this board */
21
#define TPAM_NBCHANNEL          30
22
/* Maximum size of data */
23
#define TPAM_MAXBUFSIZE         2032
24
/* Size of a page of board memory */
25
#define TPAM_PAGE_SIZE          0x003ffffc      /* 4 MB */
26
/* Magic number present if the board was successfully started */
27
#define TPAM_MAGICNUMBER        0x2a343242
28
 
29
/* Registers in the PCI BAR0 */
30
#define TPAM_PAGE_REGISTER      0x00400000      /* Select page */
31
#define TPAM_DSPINT_REGISTER    0x00400004      /* Interrupt board */
32
#define TPAM_RESETPAM_REGISTER  0x00400008      /* Reset board */
33
#define TPAM_HINTACK_REGISTER   0x0040000c      /* Ack interrupt */
34
#define TPAM_HPIC_REGISTER      0x00400014      /* Board ready */
35
 
36
/* Registers in the board memory */
37
#define TPAM_MAGICNUMBER_REGISTER       0x80008000 /* Magic number */
38
#define TPAM_EXID_REGISTER              0x80008004 /* EXID - not used */
39
#define TPAM_UPLOADPTR_REGISTER         0x80008008 /* Upload data ptr */
40
#define TPAM_DOWNLOADPTR_REGISTER       0x8000800c /* Download data ptr */
41
#define TPAM_ACKUPLOAD_REGISTER         0x80008010 /* Ack upload */
42
#define TPAM_ACKDOWNLOAD_REGISTER       0x80008014 /* Ack download */
43
#define TPAM_INTERRUPTACK_REGISTER      0x80008018 /* Ack interrupt */
44
 
45
/* Reserved areas in the board memory */
46
#define TPAM_RESERVEDAREA1_START        0x00000000
47
#define TPAM_RESERVEDAREA1_END          0x003FFFFF
48
#define TPAM_RESERVEDAREA2_START        0x01C00000
49
#define TPAM_RESERVEDAREA2_END          0x01FFFFFF
50
#define TPAM_RESERVEDAREA3_START        0x04000000
51
#define TPAM_RESERVEDAREA3_END          0x7FFFFFFF
52
#define TPAM_RESERVEDAREA4_START        0x80010000
53
#define TPAM_RESERVEDAREA4_END          0xFFFFFFFF
54
 
55
/* NCO ID invalid */
56
#define TPAM_NCOID_INVALID      0xffff
57
/* channel number invalid */
58
#define TPAM_CHANNEL_INVALID    0xffff
59
 
60
/* Channel structure */
61
typedef struct tpam_channel {
62
        int num;                        /* channel number */
63
        struct tpam_card *card;         /* channel's card */
64
        u32 ncoid;                      /* ncoid */
65
        u8  hdlc;                       /* hdlc mode (set by user level) */
66
        u8  realhdlc;                   /* hdlc mode (negociated with peer) */
67
        u32 hdlcshift;                  /* hdlc shift */
68
        u8  readytoreceive;             /* channel ready to receive data */
69
        struct sk_buff_head sendq;      /* Send queue */
70
} tpam_channel;
71
 
72
/* Card structure */
73
typedef struct tpam_card {
74
        struct tpam_card *next;         /* next card in list */
75
        unsigned int irq;               /* IRQ used by this board */
76
        unsigned long bar0;             /* ioremapped bar0 */
77
        int id;                         /* id of the board */
78
        isdn_if interface;              /* isdn link-level pointer */
79
        int channels_used;              /* number of channels actually used */
80
        int channels_tested;            /* number of channels being tested */
81
        u8 loopmode;                    /* board in looptest mode */
82
        tpam_channel channels[TPAM_NBCHANNEL];/* channels tab */
83
        int running;                    /* card is running */
84
        int busy;                       /* waiting for ack from card */
85
        int roundrobin;                 /* round robin between channels */
86
        struct sk_buff_head sendq;      /* send queue */
87
        struct sk_buff_head recvq;      /* receive queue */
88
        struct tq_struct send_tq;       /* send task queue */
89
        struct tq_struct recv_tq;       /* receive task queue */
90
        spinlock_t lock;                /* lock for the card */
91
} tpam_card;
92
 
93
/* Timeout waiting for signature to become available */
94
#define SIGNATURE_TIMEOUT       (5*HZ)
95
/* Timeout waiting for receiving all the ACreateNCOCnf */
96
#define NCOCREATE_TIMEOUT       (30*HZ)
97
 
98
/* Maximum size of the TLV block */
99
#define MPB_MAXIMUMBLOCKTLVSIZE  128
100
/* Maximum size of the data block */
101
#define MPB_MAXIMUMDATASIZE     4904
102
/* Maximum size of a phone number */
103
#define PHONE_MAXIMUMSIZE         32
104
 
105
/* Header for a sk_buff structure */
106
typedef struct skb_header {
107
        u16 size;               /* size of pci_mpb block + size of tlv block */
108
        u16 data_size;          /* size of the data block */
109
        u16 ack;                /* packet needs to send ack upon send */
110
        u16 ack_size;           /* size of data to be acknowledged upon send */
111
} skb_header;
112
 
113
/* PCI message header structure */
114
typedef struct pci_mpb {
115
        u16 exID;                       /* exID - not used */
116
        u16 flags;                      /* flags - not used */
117
        u32 errorCode;                  /* errorCode - not used */
118
        u16 messageID;                  /* message ID - one of ID_XXX */
119
        u16 maximumBlockTLVSize;        /* MPB_MAXIMUMBLOCKTLVSIZE */
120
        u16 actualBlockTLVSize;         /* size of the tlv block */
121
        u16 maximumDataSize;            /* MPB_MAXIMUMDATASIZE */
122
        u16 actualDataSize;             /* size of the data block */
123
        u16 dummy;                      /* padding */
124
} pci_mpb;
125
 
126
/* Types of PCI messages */
127
#define ID_ACreateNCOReq        101
128
#define ID_ACreateNCOCnf        102
129
#define ID_ADestroyNCOReq       103
130
#define ID_ADestroyNCOCnf       104
131
#define ID_CConnectReq          203
132
#define ID_CConnectInd          204
133
#define ID_CConnectRsp          205
134
#define ID_CConnectCnf          206
135
#define ID_CDisconnectReq       207
136
#define ID_CDisconnectInd       208
137
#define ID_CDisconnectRsp       209
138
#define ID_CDisconnectCnf       210
139
#define ID_U3DataReq            307
140
#define ID_U3DataInd            308
141
#define ID_U3ReadyToReceiveInd  318
142
 
143
/* Parameters for the PCI message TLV block */
144
#define PAR_BearerCap           3
145
#define PAR_CalledNumber        7
146
#define PAR_CallingNumber       11
147
#define PAR_CauseToPUF          15
148
#define PAR_Cdirection          16
149
#define PAR_CompletionStatus    19
150
#define PAR_Facility            30
151
#define PAR_HLC                 34
152
#define PAR_NCOID               49
153
#define PAR_NCOType             50
154
#define PAR_ReadyFlag           55
155
#define PAR_U3Protocol          62
156
#define PAR_Udirection          64
157
 
158
/* Delayed statcallb structure */
159
typedef struct tpam_statcallb_data {
160
        tpam_card *card;                /* card issuing the statcallb */
161
        struct timer_list *timer;       /* timer launching the statcallb */
162
        isdn_ctrl ctrl;                 /* isdn command */
163
} tpam_statcallb_data;
164
 
165
/* Function prototypes from tpam_main.c */
166
extern tpam_card *tpam_findcard(int);
167
extern u32 tpam_findchannel(tpam_card *, u32);
168
 
169
/* Function prototypes from tpam_memory.c */
170
extern void copy_to_pam_dword(tpam_card *, const void *, u32);
171
extern void copy_to_pam(tpam_card *, void *, const void *, u32);
172
extern u32 copy_from_pam_dword(tpam_card *, const void *);
173
extern void copy_from_pam(tpam_card *, void *, const void *, u32);
174
extern int copy_from_pam_to_user(tpam_card *, void *, const void *, u32);
175
extern int copy_from_user_to_pam(tpam_card *, void *, const void *, u32);
176
extern int tpam_verify_area(u32, u32);
177
 
178
/* Function prototypes from tpam_nco.c */
179
extern struct sk_buff *build_ACreateNCOReq(const u8 *);
180
extern struct sk_buff *build_ADestroyNCOReq(u32);
181
extern struct sk_buff *build_CConnectReq(u32, const u8 *, u8);
182
extern struct sk_buff *build_CConnectRsp(u32);
183
extern struct sk_buff *build_CDisconnectReq(u32);
184
extern struct sk_buff *build_CDisconnectRsp(u32);
185
extern struct sk_buff *build_U3DataReq(u32, void *, u16, u16, u16);
186
extern int parse_ACreateNCOCnf(struct sk_buff *, u8 *, u32 *);
187
extern int parse_ADestroyNCOCnf(struct sk_buff *, u8 *, u32 *);
188
extern int parse_CConnectCnf(struct sk_buff *, u32 *);
189
extern int parse_CConnectInd(struct sk_buff *, u32 *, u8 *, u8 *,
190
                             u8 *, u8 *, u8 *);
191
extern int parse_CDisconnectCnf(struct sk_buff *, u32 *, u32 *);
192
extern int parse_CDisconnectInd(struct sk_buff *, u32 *, u32 *);
193
extern int parse_U3ReadyToReceiveInd(struct sk_buff *, u32 *, u8 *);
194
extern int parse_U3DataInd(struct sk_buff *, u32 *, u8 **, u16 *);
195
 
196
/* Function prototypes from tpam_queues.c */
197
extern void tpam_enqueue(tpam_card *, struct sk_buff *);
198
extern void tpam_enqueue_data(tpam_channel *, struct sk_buff *);
199
extern void tpam_irq(int, void *, struct pt_regs *);
200
extern void tpam_recv_tq(tpam_card *);
201
extern void tpam_send_tq(tpam_card *);
202
 
203
/* Function prototypes from tpam_commands.c */
204
extern int tpam_command(isdn_ctrl *);
205
extern int tpam_writebuf_skb(int, int, int, struct sk_buff *);
206
extern void tpam_recv_ACreateNCOCnf(tpam_card *, struct sk_buff *);
207
extern void tpam_recv_ADestroyNCOCnf(tpam_card *, struct sk_buff *);
208
extern void tpam_recv_CConnectCnf(tpam_card *, struct sk_buff *);
209
extern void tpam_recv_CConnectInd(tpam_card *, struct sk_buff *);
210
extern void tpam_recv_CDisconnectInd(tpam_card *, struct sk_buff *);
211
extern void tpam_recv_CDisconnectCnf(tpam_card *, struct sk_buff *);
212
extern void tpam_recv_U3DataInd(tpam_card *, struct sk_buff *);
213
extern void tpam_recv_U3ReadyToReceiveInd(tpam_card *, struct sk_buff *);
214
 
215
/* Function prototypes from tpam_hdlc.c */
216
extern u32 tpam_hdlc_encode(u8 *, u8 *, u32 *, u32);
217
extern u32 tpam_hdlc_decode(u8 *, u8 *, u32);
218
 
219
/* Function prototypes from tpam_crcpc.c */
220
extern void init_CRC(void);
221
extern void hdlc_encode_modem(u8 *, u32, u8 *, u32 *);
222
extern void hdlc_no_accm_encode(u8 *, u32, u8 *, u32 *);
223
extern u32 hdlc_no_accm_decode(u8 *, u32);
224
 
225
/* Define this to enable debug tracing prints */
226
#undef DEBUG
227
 
228
#ifdef DEBUG
229
#define dprintk printk
230
#else
231
#define dprintk while(0) printk
232
#endif
233
 
234
#endif /* _TPAM_H_ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.