File: /usr/src/linux/drivers/isdn/eicon/divas.h

1     
2     /*
3      *
4      * Copyright (C) Eicon Technology Corporation, 2000.
5      *
6      * Eicon File Revision :    1.5  
7      *
8      * This program is free software; you can redistribute it and/or modify
9      * it under the terms of the GNU General Public License as published by
10      * the Free Software Foundation; either version 2, or (at your option)
11      * any later version.
12      *
13      * This program is distributed in the hope that it will be useful,
14      * but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY 
15      * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
16      * See the GNU General Public License for more details.
17      *
18      * You should have received a copy of the GNU General Public License
19      * along with this program; if not, write to the Free Software
20      * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21      *
22      */
23     
24     
25     /* External Diva Server driver include file */
26     
27     #if !defined(DIVAS_H)
28     #define DIVAS_H
29     
30     #include "sys.h"
31     
32     
33     /* IOCTL commands */
34     
35     #define	DIA_IOCTL_INIT				(0)
36     #define	DIA_IOCTL_LOAD				(1)
37     #define	DIA_IOCTL_CONFIG			(2)
38     #define	DIA_IOCTL_START				(3)
39     #define	DIA_IOCTL_GET_NUM			(4)
40     #define	DIA_IOCTL_GET_LIST			(5)
41     #define	DIA_IOCTL_LOG				(6)
42     #define	DIA_IOCTL_DETECT			(7)
43     #define	DIA_IOCTL_SPACE				(8)
44     #define DIA_IOCTL_GET_MEM           (9)
45     #define DIA_IOCTL_FLAVOUR			(10)
46     #define	DIA_IOCTL_XLOG_REQ			(11)
47     
48     /* Error codes */
49     
50     #define XLOG_ERR_CARD_NUM	(13)
51     #define XLOG_ERR_DONE		(14)
52     #define XLOG_ERR_CMD		(15)
53     #define XLOG_ERR_TIMEOUT	(16)
54     #define XLOG_ERR_CARD_STATE	(17)
55     #define XLOG_ERR_UNKNOWN	(18)
56     #define XLOG_OK 			(0)
57     
58     /* Adapter states */
59     
60     #define DIA_UNKNOWN		(0)
61     #define DIA_RESET		(1)
62     #define DIA_LOADED		(2)
63     #define DIA_CONFIGURED	(3)
64     #define DIA_RUNNING		(4)
65     
66     /* Stucture for getting card specific information from active cad driver */
67     
68     typedef struct
69     {
70     	int card_type;
71     	int card_slot;
72     	int	state;
73     } dia_card_list_t;
74     
75     /* use following to select which logging to have active */
76     
77     #define	DIVAS_LOG_DEBUG		(1 << 0)
78     #define	DIVAS_LOG_XLOG		(1 << 1)
79     #define	DIVAS_LOG_IDI		(1 << 2)
80     #define	DIVAS_LOG_CAPI		(1 << 3)
81     
82     /* stucture for DIA_IOCTL_LOG to get information from adapter */
83     
84     typedef struct
85     {
86     	int		card_id;
87     	int		log_types;	/* bit mask of log types: use DIVAS_LOG_XXX */
88     } dia_log_t;
89     
90     /* list of cards supported by this driver */
91     
92     #define	DIA_CARD_TYPE_DIVA_SERVER	(0)	/* Diva Server PRI */
93     #define	DIA_CARD_TYPE_DIVA_SERVER_B	(1)	/* Diva Server BRI */
94     #define	DIA_CARD_TYPE_DIVA_SERVER_Q	(2)	/* Diva Server 4-BRI */
95     
96     /* bus types */
97     
98     #define	DIA_BUS_TYPE_ISA		(0)
99     #define	DIA_BUS_TYPE_ISA_PNP	(1)
100     #define	DIA_BUS_TYPE_PCI		(2)
101     #define	DIA_BUS_TYPE_MCA		(3)
102     
103     /* types of memory used (index for memory array below) */
104     
105     #define DIVAS_RAM_MEMORY 	0
106     #define DIVAS_REG_MEMORY 	1
107     #define DIVAS_CFG_MEMORY 	2
108     #define DIVAS_SHARED_MEMORY 3
109     #define DIVAS_CTL_MEMORY	4
110     /*
111      * card config information
112      * passed as parameter to DIA_IOCTL_INIT ioctl to initialise new card
113      */
114     
115     typedef struct
116     {
117     	int		card_id;	/* unique id assigned to this card */
118     	int		card_type;	/* use DIA_CARD_TYPE_xxx above */
119     	int		bus_type;	/* use DIA_BUS_TYPE_xxx above */
120     	int		bus_num;	/* bus number (instance number of bus type) */
121     	int		func_num;	/* adapter function number (PCI register) */
122     	int		slot;		/* slot number in bus */
123     	unsigned char	irq;		/* IRQ number */
124         int     reset_base; /* Reset register  for I/O mapped cards */
125     	int		io_base;	/* I/O base for I/O mapped cards */
126     	void	*memory[5];	/* memory base addresses for memory mapped cards */
127     	char	name[9];	/* name of adapter */
128     	int		serial;		/* serial number */
129     	unsigned char	int_priority;	/* Interrupt priority */
130     } dia_card_t;
131     
132     /*
133      * protocol configuration information
134      * passed as parameter to DIA_IOCTL_CONFIG ioctl to configure card
135      */
136     
137     typedef struct
138     {
139     	int				card_id;			/* to identify particular card */
140     	unsigned char	tei;
141     	unsigned char	nt2;
142     	unsigned char	watchdog;
143     	unsigned char	permanent;
144     	unsigned char	x_interface;
145     	unsigned char	stable_l2;
146     	unsigned char	no_order_check;
147     	unsigned char	handset_type;
148     	unsigned char	sig_flags;
149     	unsigned char	low_channel;
150     	unsigned char	prot_version;
151     	unsigned char	crc4;
152     	struct
153     	{
154     		unsigned char oad[32];
155     		unsigned char osa[32];
156     		unsigned char spid[32];
157     	}terminal[2];
158     } dia_config_t;
159     
160     /*
161      * code configuration 
162      * passed as parameter to DIA_IOCTL_LOAD ioctl
163      * one of these ioctl per code file to load
164      */
165     
166     typedef struct
167     {
168     	int				card_id;	/* card to load */
169     	enum
170     	{
171     		DIA_CPU_CODE,			/* CPU code */
172     		DIA_DSP_CODE,			/* DSP code */
173     		DIA_CONT_CODE,			/* continuation of code */
174     		DIA_TABLE_CODE,			/* code table */
175     	        DIA_DLOAD_CNT,           /* number of downloads*/
176     		DIA_FPGA_CODE
177     	}				code_type;	/* code for CPU or DSP ? */
178     	int				length;		/* length of code */
179     	unsigned char	*code;		/* pointer (in user-space) to code */
180     } dia_load_t;
181     
182     /*
183      * start configuration 
184      * passed as parameter to DIA_IOCTL_START ioctl
185      */
186     
187     typedef struct
188     {
189     	int				card_id;	/* card to start */
190     } dia_start_t;
191     
192     /* used for retrieving memory from the card */
193     
194     typedef struct {
195     	word	card_id;
196     	dword 	addr;
197     	byte	data[16 * 8];
198     } mem_block_t;
199     
200     /* DIVA Server specific addresses */
201     
202     #define DIVAS_CPU_START_ADDR    (0x0)
203     #define	ORG_MAX_PROTOCOL_CODE_SIZE	0x000A0000
204     #define	ORG_MAX_DSP_CODE_SIZE		(0x000F0000 - ORG_MAX_PROTOCOL_CODE_SIZE)
205     #define	ORG_DSP_CODE_BASE		(0xBF7F0000 - ORG_MAX_DSP_CODE_SIZE)
206     #define DIVAS_DSP_START_ADDR    (0xBF7A0000)
207     #define DIVAS_SHARED_OFFSET     (0x1000)
208     #define MP_DSP_CODE_BASE           0xa03a0000
209     #define MQ_PROTCODE_OFFSET  0x100000
210     #define MQ_SM_OFFSET		0X0f0000
211     
212     #define	V90D_MAX_PROTOCOL_CODE_SIZE	0x00090000
213     #define V90D_MAX_DSP_CODE_SIZE		(0x000F0000 - V90D_MAX_PROTOCOL_CODE_SIZE)
214     #define	V90D_DSP_CODE_BASE		(0xBF7F0000 - V90D_MAX_DSP_CODE_SIZE)
215     
216     #define MQ_ORG_MAX_PROTOCOL_CODE_SIZE   0x000a0000  /* max 640K Protocol-Code */
217     #define MQ_ORG_MAX_DSP_CODE_SIZE        0x00050000  /* max 320K DSP-Code */
218     #define MQ_ORG_DSP_CODE_BASE           (MQ_MAX_DSP_DOWNLOAD_ADDR \
219                                           - MQ_ORG_MAX_DSP_CODE_SIZE)
220     #define MQ_V90D_MAX_PROTOCOL_CODE_SIZE  0x00090000  /* max 576K Protocol-Code */
221     #define MQ_V90D_MAX_DSP_CODE_SIZE       0x00060000  /* max 384K DSP-Code if V.90D included */
222     #define	MQ_MAX_DSP_DOWNLOAD_ADDR        0xa03f0000
223     #define MQ_V90D_DSP_CODE_BASE          (MQ_MAX_DSP_DOWNLOAD_ADDR \
224                                           - MQ_V90D_MAX_DSP_CODE_SIZE)
225     
226     
227     #define ALIGNMENT_MASK_MAESTRA        0xfffffffc
228     
229     #endif /* DIVAS_H */
230