blob: 94828c87e2a4233936dc238efb8d874132d74121 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001
2/*
3 *
Joe Perches475be4d2012-02-19 19:52:38 -08004 Copyright (c) Eicon Networks, 2002.
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 *
Joe Perches475be4d2012-02-19 19:52:38 -08006 This source file is supplied for the use with
7 Eicon Networks range of DIVA Server Adapters.
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 *
Joe Perches475be4d2012-02-19 19:52:38 -08009 Eicon File Revision : 2.1
Linus Torvalds1da177e2005-04-16 15:20:36 -070010 *
Joe Perches475be4d2012-02-19 19:52:38 -080011 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2, or (at your option)
14 any later version.
Linus Torvalds1da177e2005-04-16 15:20:36 -070015 *
Joe Perches475be4d2012-02-19 19:52:38 -080016 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
18 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19 See the GNU General Public License for more details.
Linus Torvalds1da177e2005-04-16 15:20:36 -070020 *
Joe Perches475be4d2012-02-19 19:52:38 -080021 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Linus Torvalds1da177e2005-04-16 15:20:36 -070024 *
25 */
Joe Perches475be4d2012-02-19 19:52:38 -080026#ifndef DSP_DEFS_H_
Linus Torvalds1da177e2005-04-16 15:20:36 -070027#define DSP_DEFS_H_
28#include "dspdids.h"
29/*---------------------------------------------------------------------------*/
Joe Perches475be4d2012-02-19 19:52:38 -080030#define dsp_download_reserve_space(fp, length)
Linus Torvalds1da177e2005-04-16 15:20:36 -070031/*****************************************************************************/
32/*
33 * OS file access abstraction layer
34 *
35 * I/O functions returns -1 on error, 0 on EOF
36 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070037struct _OsFileHandle_;
Joe Perches475be4d2012-02-19 19:52:38 -080038typedef long (*OsFileIo)(struct _OsFileHandle_ *handle,
39 void *buffer,
40 long size);
41typedef long (*OsFileSeek)(struct _OsFileHandle_ *handle,
42 long position,
43 int mode);
44typedef long (*OsCardLoad)(struct _OsFileHandle_ *handle,
45 long length,
46 void **addr);
Linus Torvalds1da177e2005-04-16 15:20:36 -070047typedef struct _OsFileHandle_
Joe Perches475be4d2012-02-19 19:52:38 -080048{ void *sysFileDesc;
49 unsigned long sysFileSize;
50 OsFileIo sysFileRead;
51 OsFileSeek sysFileSeek;
52 void *sysLoadDesc;
53 OsCardLoad sysCardLoad;
54} OsFileHandle;
55extern OsFileHandle *OsOpenFile(char *path_name);
56extern void OsCloseFile(OsFileHandle *fp);
Linus Torvalds1da177e2005-04-16 15:20:36 -070057/*****************************************************************************/
58#define DSP_TELINDUS_FILE "dspdload.bin"
59/* special DSP file for BRI cards for Qsig and CornetN because of missing memory */
60#define DSP_QSIG_TELINDUS_FILE "dspdqsig.bin"
61#define DSP_MDM_TELINDUS_FILE "dspdvmdm.bin"
62#define DSP_FAX_TELINDUS_FILE "dspdvfax.bin"
63#define DSP_DIRECTORY_ENTRIES 64
64#define DSP_MEMORY_TYPE_EXTERNAL_DM 0
65#define DSP_MEMORY_TYPE_EXTERNAL_PM 1
66#define DSP_MEMORY_TYPE_INTERNAL_DM 2
67#define DSP_MEMORY_TYPE_INTERNAL_PM 3
68#define DSP_DOWNLOAD_FLAG_BOOTABLE 0x0001
69#define DSP_DOWNLOAD_FLAG_2181 0x0002
70#define DSP_DOWNLOAD_FLAG_TIMECRITICAL 0x0004
71#define DSP_DOWNLOAD_FLAG_COMPAND 0x0008
72#define DSP_MEMORY_BLOCK_COUNT 16
73#define DSP_SEGMENT_PM_FLAG 0x0001
74#define DSP_SEGMENT_SHARED_FLAG 0x0002
75#define DSP_SEGMENT_EXTERNAL_DM DSP_MEMORY_TYPE_EXTERNAL_DM
76#define DSP_SEGMENT_EXTERNAL_PM DSP_MEMORY_TYPE_EXTERNAL_PM
77#define DSP_SEGMENT_INTERNAL_DM DSP_MEMORY_TYPE_INTERNAL_DM
78#define DSP_SEGMENT_INTERNAL_PM DSP_MEMORY_TYPE_INTERNAL_PM
79#define DSP_SEGMENT_FIRST_RELOCATABLE 4
80#define DSP_DATA_BLOCK_PM_FLAG 0x0001
81#define DSP_DATA_BLOCK_DWORD_FLAG 0x0002
82#define DSP_DATA_BLOCK_RESOLVE_FLAG 0x0004
83#define DSP_RELOC_NONE 0x00
84#define DSP_RELOC_SEGMENT_MASK 0x3f
85#define DSP_RELOC_TYPE_MASK 0xc0
86#define DSP_RELOC_TYPE_0 0x00 /* relocation of address in DM word / high part of PM word */
87#define DSP_RELOC_TYPE_1 0x40 /* relocation of address in low part of PM data word */
88#define DSP_RELOC_TYPE_2 0x80 /* relocation of address in standard command */
89#define DSP_RELOC_TYPE_3 0xc0 /* relocation of address in call/jump on flag in */
90#define DSP_COMBIFILE_FORMAT_IDENTIFICATION_SIZE 48
91#define DSP_COMBIFILE_FORMAT_VERSION_BCD 0x0100
92#define DSP_FILE_FORMAT_IDENTIFICATION_SIZE 48
93#define DSP_FILE_FORMAT_VERSION_BCD 0x0100
94typedef struct tag_dsp_combifile_header
95{
Joe Perches475be4d2012-02-19 19:52:38 -080096 char format_identification[DSP_COMBIFILE_FORMAT_IDENTIFICATION_SIZE];
97 word format_version_bcd;
98 word header_size;
99 word combifile_description_size;
100 word directory_entries;
101 word directory_size;
102 word download_count;
103 word usage_mask_size;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104} t_dsp_combifile_header;
105typedef struct tag_dsp_combifile_directory_entry
106{
Joe Perches475be4d2012-02-19 19:52:38 -0800107 word card_type_number;
108 word file_set_number;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109} t_dsp_combifile_directory_entry;
110typedef struct tag_dsp_file_header
111{
Joe Perches475be4d2012-02-19 19:52:38 -0800112 char format_identification[DSP_FILE_FORMAT_IDENTIFICATION_SIZE];
113 word format_version_bcd;
114 word download_id;
115 word download_flags;
116 word required_processing_power;
117 word interface_channel_count;
118 word header_size;
119 word download_description_size;
120 word memory_block_table_size;
121 word memory_block_count;
122 word segment_table_size;
123 word segment_count;
124 word symbol_table_size;
125 word symbol_count;
126 word total_data_size_dm;
127 word data_block_count_dm;
128 word total_data_size_pm;
129 word data_block_count_pm;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130} t_dsp_file_header;
131typedef struct tag_dsp_memory_block_desc
132{
Joe Perches475be4d2012-02-19 19:52:38 -0800133 word alias_memory_block;
134 word memory_type;
135 word address;
136 word size; /* DSP words */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137} t_dsp_memory_block_desc;
138typedef struct tag_dsp_segment_desc
139{
Joe Perches475be4d2012-02-19 19:52:38 -0800140 word memory_block;
141 word attributes;
142 word base;
143 word size;
144 word alignment; /* ==0 -> no other legal start address than base */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145} t_dsp_segment_desc;
146typedef struct tag_dsp_symbol_desc
147{
Joe Perches475be4d2012-02-19 19:52:38 -0800148 word symbol_id;
149 word segment;
150 word offset;
151 word size; /* DSP words */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152} t_dsp_symbol_desc;
153typedef struct tag_dsp_data_block_header
154{
Joe Perches475be4d2012-02-19 19:52:38 -0800155 word attributes;
156 word segment;
157 word offset;
158 word size; /* DSP words */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159} t_dsp_data_block_header;
160typedef struct tag_dsp_download_desc
161{
Joe Perches475be4d2012-02-19 19:52:38 -0800162 word download_id;
163 word download_flags;
164 word required_processing_power;
165 word interface_channel_count;
166 word excess_header_size;
167 word memory_block_count;
168 word segment_count;
169 word symbol_count;
170 word data_block_count_dm;
171 word data_block_count_pm;
172 byte *p_excess_header_data;
173 char *p_download_description;
174 t_dsp_memory_block_desc *p_memory_block_table;
175 t_dsp_segment_desc *p_segment_table;
176 t_dsp_symbol_desc *p_symbol_table;
177 word *p_data_blocks_dm;
178 word *p_data_blocks_pm;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179} t_dsp_desc;
180typedef struct tag_dsp_portable_download_desc /* be sure to keep native alignment for MAESTRA's */
181{
Joe Perches475be4d2012-02-19 19:52:38 -0800182 word download_id;
183 word download_flags;
184 word required_processing_power;
185 word interface_channel_count;
186 word excess_header_size;
187 word memory_block_count;
188 word segment_count;
189 word symbol_count;
190 word data_block_count_dm;
191 word data_block_count_pm;
192 dword p_excess_header_data;
193 dword p_download_description;
194 dword p_memory_block_table;
195 dword p_segment_table;
196 dword p_symbol_table;
197 dword p_data_blocks_dm;
198 dword p_data_blocks_pm;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700199} t_dsp_portable_desc;
200#define DSP_DOWNLOAD_INDEX_KERNEL 0
201#define DSP30TX_DOWNLOAD_INDEX_KERNEL 1
202#define DSP30RX_DOWNLOAD_INDEX_KERNEL 2
203#define DSP_MAX_DOWNLOAD_COUNT 64
204#define DSP_DOWNLOAD_MAX_SEGMENTS 16
205#define DSP_UDATA_REQUEST_RECONFIGURE 0
206/*
Joe Perches475be4d2012-02-19 19:52:38 -0800207 parameters:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700208 <word> reconfigure delay (in 8kHz samples)
209 <word> reconfigure code
210 <byte> reconfigure hdlc preamble flags
211*/
212#define DSP_RECONFIGURE_TX_FLAG 0x8000
213#define DSP_RECONFIGURE_SHORT_TRAIN_FLAG 0x4000
214#define DSP_RECONFIGURE_ECHO_PROTECT_FLAG 0x2000
215#define DSP_RECONFIGURE_HDLC_FLAG 0x1000
216#define DSP_RECONFIGURE_SYNC_FLAG 0x0800
217#define DSP_RECONFIGURE_PROTOCOL_MASK 0x00ff
218#define DSP_RECONFIGURE_IDLE 0
219#define DSP_RECONFIGURE_V25 1
220#define DSP_RECONFIGURE_V21_CH2 2
221#define DSP_RECONFIGURE_V27_2400 3
222#define DSP_RECONFIGURE_V27_4800 4
223#define DSP_RECONFIGURE_V29_7200 5
224#define DSP_RECONFIGURE_V29_9600 6
225#define DSP_RECONFIGURE_V33_12000 7
226#define DSP_RECONFIGURE_V33_14400 8
227#define DSP_RECONFIGURE_V17_7200 9
228#define DSP_RECONFIGURE_V17_9600 10
229#define DSP_RECONFIGURE_V17_12000 11
230#define DSP_RECONFIGURE_V17_14400 12
231/*
Joe Perches475be4d2012-02-19 19:52:38 -0800232 data indications if transparent framer
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233 <byte> data 0
234 <byte> data 1
235 ...
Joe Perches475be4d2012-02-19 19:52:38 -0800236 data indications if HDLC framer
Linus Torvalds1da177e2005-04-16 15:20:36 -0700237 <byte> data 0
238 <byte> data 1
239 ...
240 <byte> CRC 0
241 <byte> CRC 1
242 <byte> preamble flags
243*/
244#define DSP_UDATA_INDICATION_SYNC 0
245/*
Joe Perches475be4d2012-02-19 19:52:38 -0800246 returns:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247 <word> time of sync (sampled from counter at 8kHz)
248*/
249#define DSP_UDATA_INDICATION_DCD_OFF 1
250/*
Joe Perches475be4d2012-02-19 19:52:38 -0800251 returns:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252 <word> time of DCD off (sampled from counter at 8kHz)
253*/
254#define DSP_UDATA_INDICATION_DCD_ON 2
255/*
Joe Perches475be4d2012-02-19 19:52:38 -0800256 returns:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700257 <word> time of DCD on (sampled from counter at 8kHz)
258 <byte> connected norm
259 <word> connected options
260 <dword> connected speed (bit/s)
261*/
262#define DSP_UDATA_INDICATION_CTS_OFF 3
263/*
Joe Perches475be4d2012-02-19 19:52:38 -0800264 returns:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700265 <word> time of CTS off (sampled from counter at 8kHz)
266*/
267#define DSP_UDATA_INDICATION_CTS_ON 4
268/*
Joe Perches475be4d2012-02-19 19:52:38 -0800269 returns:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700270 <word> time of CTS on (sampled from counter at 8kHz)
271 <byte> connected norm
272 <word> connected options
273 <dword> connected speed (bit/s)
274*/
275#define DSP_CONNECTED_NORM_UNSPECIFIED 0
276#define DSP_CONNECTED_NORM_V21 1
277#define DSP_CONNECTED_NORM_V23 2
278#define DSP_CONNECTED_NORM_V22 3
279#define DSP_CONNECTED_NORM_V22_BIS 4
280#define DSP_CONNECTED_NORM_V32_BIS 5
281#define DSP_CONNECTED_NORM_V34 6
282#define DSP_CONNECTED_NORM_V8 7
283#define DSP_CONNECTED_NORM_BELL_212A 8
284#define DSP_CONNECTED_NORM_BELL_103 9
285#define DSP_CONNECTED_NORM_V29_LEASED_LINE 10
286#define DSP_CONNECTED_NORM_V33_LEASED_LINE 11
287#define DSP_CONNECTED_NORM_TFAST 12
288#define DSP_CONNECTED_NORM_V21_CH2 13
289#define DSP_CONNECTED_NORM_V27_TER 14
290#define DSP_CONNECTED_NORM_V29 15
291#define DSP_CONNECTED_NORM_V33 16
292#define DSP_CONNECTED_NORM_V17 17
293#define DSP_CONNECTED_OPTION_TRELLIS 0x0001
294/*---------------------------------------------------------------------------*/
Joe Perches475be4d2012-02-19 19:52:38 -0800295extern char *dsp_read_file(OsFileHandle *fp,
296 word card_type_number,
297 word *p_dsp_download_count,
298 t_dsp_desc *p_dsp_download_table,
299 t_dsp_portable_desc *p_dsp_portable_download_table);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700300/*---------------------------------------------------------------------------*/
Joe Perches475be4d2012-02-19 19:52:38 -0800301#endif /* DSP_DEFS_H_ */