4 Copyright (c) Eicon Networks, 2002.
6 This source file is supplied for the use with
7 Eicon Networks range of DIVA Server Adapters.
9 Eicon File Revision : 2.1
11 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)
16 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.
21 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.
29 /*---------------------------------------------------------------------------*/
30 #define dsp_download_reserve_space(fp,length)
31 /*****************************************************************************/
33 * OS file access abstraction layer
35 * I/O functions returns -1 on error, 0 on EOF
40 struct _OsFileHandle_;
41 typedef long ( * OsFileIo) (struct _OsFileHandle_ *handle,
44 typedef long ( * OsFileSeek)(struct _OsFileHandle_ *handle,
47 typedef long ( * OsCardLoad)(struct _OsFileHandle_ *handle,
50 typedef struct _OsFileHandle_
52 unsigned long sysFileSize ;
53 OsFileIo sysFileRead ;
54 OsFileSeek sysFileSeek ;
56 OsCardLoad sysCardLoad ;
58 extern OsFileHandle *OsOpenFile (char *path_name) ;
59 extern void OsCloseFile (OsFileHandle *fp) ;
60 /*****************************************************************************/
61 #define DSP_TELINDUS_FILE "dspdload.bin"
62 /* special DSP file for BRI cards for Qsig and CornetN because of missing memory */
63 #define DSP_QSIG_TELINDUS_FILE "dspdqsig.bin"
64 #define DSP_MDM_TELINDUS_FILE "dspdvmdm.bin"
65 #define DSP_FAX_TELINDUS_FILE "dspdvfax.bin"
66 #define DSP_DIRECTORY_ENTRIES 64
67 #define DSP_MEMORY_TYPE_EXTERNAL_DM 0
68 #define DSP_MEMORY_TYPE_EXTERNAL_PM 1
69 #define DSP_MEMORY_TYPE_INTERNAL_DM 2
70 #define DSP_MEMORY_TYPE_INTERNAL_PM 3
71 #define DSP_DOWNLOAD_FLAG_BOOTABLE 0x0001
72 #define DSP_DOWNLOAD_FLAG_2181 0x0002
73 #define DSP_DOWNLOAD_FLAG_TIMECRITICAL 0x0004
74 #define DSP_DOWNLOAD_FLAG_COMPAND 0x0008
75 #define DSP_MEMORY_BLOCK_COUNT 16
76 #define DSP_SEGMENT_PM_FLAG 0x0001
77 #define DSP_SEGMENT_SHARED_FLAG 0x0002
78 #define DSP_SEGMENT_EXTERNAL_DM DSP_MEMORY_TYPE_EXTERNAL_DM
79 #define DSP_SEGMENT_EXTERNAL_PM DSP_MEMORY_TYPE_EXTERNAL_PM
80 #define DSP_SEGMENT_INTERNAL_DM DSP_MEMORY_TYPE_INTERNAL_DM
81 #define DSP_SEGMENT_INTERNAL_PM DSP_MEMORY_TYPE_INTERNAL_PM
82 #define DSP_SEGMENT_FIRST_RELOCATABLE 4
83 #define DSP_DATA_BLOCK_PM_FLAG 0x0001
84 #define DSP_DATA_BLOCK_DWORD_FLAG 0x0002
85 #define DSP_DATA_BLOCK_RESOLVE_FLAG 0x0004
86 #define DSP_RELOC_NONE 0x00
87 #define DSP_RELOC_SEGMENT_MASK 0x3f
88 #define DSP_RELOC_TYPE_MASK 0xc0
89 #define DSP_RELOC_TYPE_0 0x00 /* relocation of address in DM word / high part of PM word */
90 #define DSP_RELOC_TYPE_1 0x40 /* relocation of address in low part of PM data word */
91 #define DSP_RELOC_TYPE_2 0x80 /* relocation of address in standard command */
92 #define DSP_RELOC_TYPE_3 0xc0 /* relocation of address in call/jump on flag in */
93 #define DSP_COMBIFILE_FORMAT_IDENTIFICATION_SIZE 48
94 #define DSP_COMBIFILE_FORMAT_VERSION_BCD 0x0100
95 #define DSP_FILE_FORMAT_IDENTIFICATION_SIZE 48
96 #define DSP_FILE_FORMAT_VERSION_BCD 0x0100
97 typedef struct tag_dsp_combifile_header
99 char format_identification[DSP_COMBIFILE_FORMAT_IDENTIFICATION_SIZE];
100 word format_version_bcd;
102 word combifile_description_size;
103 word directory_entries;
106 word usage_mask_size;
107 } t_dsp_combifile_header;
108 typedef struct tag_dsp_combifile_directory_entry
110 word card_type_number;
111 word file_set_number;
112 } t_dsp_combifile_directory_entry;
113 typedef struct tag_dsp_file_header
115 char format_identification[DSP_FILE_FORMAT_IDENTIFICATION_SIZE];
116 word format_version_bcd;
119 word required_processing_power;
120 word interface_channel_count;
122 word download_description_size;
123 word memory_block_table_size;
124 word memory_block_count;
125 word segment_table_size;
127 word symbol_table_size;
129 word total_data_size_dm;
130 word data_block_count_dm;
131 word total_data_size_pm;
132 word data_block_count_pm;
134 typedef struct tag_dsp_memory_block_desc
136 word alias_memory_block;
139 word size; /* DSP words */
140 } t_dsp_memory_block_desc;
141 typedef struct tag_dsp_segment_desc
147 word alignment; /* ==0 -> no other legal start address than base */
148 } t_dsp_segment_desc;
149 typedef struct tag_dsp_symbol_desc
154 word size; /* DSP words */
156 typedef struct tag_dsp_data_block_header
161 word size; /* DSP words */
162 } t_dsp_data_block_header;
163 typedef struct tag_dsp_download_desc
167 word required_processing_power;
168 word interface_channel_count;
169 word excess_header_size;
170 word memory_block_count;
173 word data_block_count_dm;
174 word data_block_count_pm;
175 byte * p_excess_header_data;
176 char * p_download_description;
177 t_dsp_memory_block_desc *p_memory_block_table;
178 t_dsp_segment_desc *p_segment_table;
179 t_dsp_symbol_desc *p_symbol_table;
180 word * p_data_blocks_dm;
181 word * p_data_blocks_pm;
183 typedef struct tag_dsp_portable_download_desc /* be sure to keep native alignment for MAESTRA's */
187 word required_processing_power;
188 word interface_channel_count;
189 word excess_header_size;
190 word memory_block_count;
193 word data_block_count_dm;
194 word data_block_count_pm;
195 dword p_excess_header_data;
196 dword p_download_description;
197 dword p_memory_block_table;
198 dword p_segment_table;
199 dword p_symbol_table;
200 dword p_data_blocks_dm;
201 dword p_data_blocks_pm;
202 } t_dsp_portable_desc;
203 #define DSP_DOWNLOAD_INDEX_KERNEL 0
204 #define DSP30TX_DOWNLOAD_INDEX_KERNEL 1
205 #define DSP30RX_DOWNLOAD_INDEX_KERNEL 2
206 #define DSP_MAX_DOWNLOAD_COUNT 64
207 #define DSP_DOWNLOAD_MAX_SEGMENTS 16
208 #define DSP_UDATA_REQUEST_RECONFIGURE 0
211 <word> reconfigure delay (in 8kHz samples)
212 <word> reconfigure code
213 <byte> reconfigure hdlc preamble flags
215 #define DSP_RECONFIGURE_TX_FLAG 0x8000
216 #define DSP_RECONFIGURE_SHORT_TRAIN_FLAG 0x4000
217 #define DSP_RECONFIGURE_ECHO_PROTECT_FLAG 0x2000
218 #define DSP_RECONFIGURE_HDLC_FLAG 0x1000
219 #define DSP_RECONFIGURE_SYNC_FLAG 0x0800
220 #define DSP_RECONFIGURE_PROTOCOL_MASK 0x00ff
221 #define DSP_RECONFIGURE_IDLE 0
222 #define DSP_RECONFIGURE_V25 1
223 #define DSP_RECONFIGURE_V21_CH2 2
224 #define DSP_RECONFIGURE_V27_2400 3
225 #define DSP_RECONFIGURE_V27_4800 4
226 #define DSP_RECONFIGURE_V29_7200 5
227 #define DSP_RECONFIGURE_V29_9600 6
228 #define DSP_RECONFIGURE_V33_12000 7
229 #define DSP_RECONFIGURE_V33_14400 8
230 #define DSP_RECONFIGURE_V17_7200 9
231 #define DSP_RECONFIGURE_V17_9600 10
232 #define DSP_RECONFIGURE_V17_12000 11
233 #define DSP_RECONFIGURE_V17_14400 12
235 data indications if transparent framer
239 data indications if HDLC framer
245 <byte> preamble flags
247 #define DSP_UDATA_INDICATION_SYNC 0
250 <word> time of sync (sampled from counter at 8kHz)
252 #define DSP_UDATA_INDICATION_DCD_OFF 1
255 <word> time of DCD off (sampled from counter at 8kHz)
257 #define DSP_UDATA_INDICATION_DCD_ON 2
260 <word> time of DCD on (sampled from counter at 8kHz)
261 <byte> connected norm
262 <word> connected options
263 <dword> connected speed (bit/s)
265 #define DSP_UDATA_INDICATION_CTS_OFF 3
268 <word> time of CTS off (sampled from counter at 8kHz)
270 #define DSP_UDATA_INDICATION_CTS_ON 4
273 <word> time of CTS on (sampled from counter at 8kHz)
274 <byte> connected norm
275 <word> connected options
276 <dword> connected speed (bit/s)
278 #define DSP_CONNECTED_NORM_UNSPECIFIED 0
279 #define DSP_CONNECTED_NORM_V21 1
280 #define DSP_CONNECTED_NORM_V23 2
281 #define DSP_CONNECTED_NORM_V22 3
282 #define DSP_CONNECTED_NORM_V22_BIS 4
283 #define DSP_CONNECTED_NORM_V32_BIS 5
284 #define DSP_CONNECTED_NORM_V34 6
285 #define DSP_CONNECTED_NORM_V8 7
286 #define DSP_CONNECTED_NORM_BELL_212A 8
287 #define DSP_CONNECTED_NORM_BELL_103 9
288 #define DSP_CONNECTED_NORM_V29_LEASED_LINE 10
289 #define DSP_CONNECTED_NORM_V33_LEASED_LINE 11
290 #define DSP_CONNECTED_NORM_TFAST 12
291 #define DSP_CONNECTED_NORM_V21_CH2 13
292 #define DSP_CONNECTED_NORM_V27_TER 14
293 #define DSP_CONNECTED_NORM_V29 15
294 #define DSP_CONNECTED_NORM_V33 16
295 #define DSP_CONNECTED_NORM_V17 17
296 #define DSP_CONNECTED_OPTION_TRELLIS 0x0001
297 /*---------------------------------------------------------------------------*/
298 extern char *dsp_read_file (OsFileHandle *fp,
299 word card_type_number,
300 word *p_dsp_download_count,
301 t_dsp_desc *p_dsp_download_table,
302 t_dsp_portable_desc *p_dsp_portable_download_table) ;
303 /*---------------------------------------------------------------------------*/
304 #endif /* DSP_DEFS_H_ */