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