Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame^] | 1 | |
| 2 | /* |
| 3 | * |
| 4 | Copyright (c) Eicon Networks, 2002. |
| 5 | * |
| 6 | This source file is supplied for the use with |
| 7 | Eicon Networks range of DIVA Server Adapters. |
| 8 | * |
| 9 | Eicon File Revision : 2.1 |
| 10 | * |
| 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) |
| 14 | any later version. |
| 15 | * |
| 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. |
| 20 | * |
| 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. |
| 24 | * |
| 25 | */ |
| 26 | #ifndef DSP_DEFS_H_ |
| 27 | #define DSP_DEFS_H_ |
| 28 | #include "dspdids.h" |
| 29 | /*---------------------------------------------------------------------------*/ |
| 30 | #define dsp_download_reserve_space(fp,length) |
| 31 | /*****************************************************************************/ |
| 32 | /* |
| 33 | * OS file access abstraction layer |
| 34 | * |
| 35 | * I/O functions returns -1 on error, 0 on EOF |
| 36 | */ |
| 37 | #define OS_SEEK_SET 0 |
| 38 | #define OS_SEEK_CUR 1 |
| 39 | #define OS_SEEK_END 2 |
| 40 | struct _OsFileHandle_; |
| 41 | typedef long ( * OsFileIo) (struct _OsFileHandle_ *handle, |
| 42 | void *buffer, |
| 43 | long size) ; |
| 44 | typedef long ( * OsFileSeek)(struct _OsFileHandle_ *handle, |
| 45 | long position, |
| 46 | int mode) ; |
| 47 | typedef long ( * OsCardLoad)(struct _OsFileHandle_ *handle, |
| 48 | long length, |
| 49 | void * *addr) ; |
| 50 | typedef struct _OsFileHandle_ |
| 51 | { void *sysFileDesc ; |
| 52 | unsigned long sysFileSize ; |
| 53 | OsFileIo sysFileRead ; |
| 54 | OsFileSeek sysFileSeek ; |
| 55 | void *sysLoadDesc ; |
| 56 | OsCardLoad sysCardLoad ; |
| 57 | } OsFileHandle ; |
| 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 |
| 98 | { |
| 99 | char format_identification[DSP_COMBIFILE_FORMAT_IDENTIFICATION_SIZE]; |
| 100 | word format_version_bcd; |
| 101 | word header_size; |
| 102 | word combifile_description_size; |
| 103 | word directory_entries; |
| 104 | word directory_size; |
| 105 | word download_count; |
| 106 | word usage_mask_size; |
| 107 | } t_dsp_combifile_header; |
| 108 | typedef struct tag_dsp_combifile_directory_entry |
| 109 | { |
| 110 | word card_type_number; |
| 111 | word file_set_number; |
| 112 | } t_dsp_combifile_directory_entry; |
| 113 | typedef struct tag_dsp_file_header |
| 114 | { |
| 115 | char format_identification[DSP_FILE_FORMAT_IDENTIFICATION_SIZE]; |
| 116 | word format_version_bcd; |
| 117 | word download_id; |
| 118 | word download_flags; |
| 119 | word required_processing_power; |
| 120 | word interface_channel_count; |
| 121 | word header_size; |
| 122 | word download_description_size; |
| 123 | word memory_block_table_size; |
| 124 | word memory_block_count; |
| 125 | word segment_table_size; |
| 126 | word segment_count; |
| 127 | word symbol_table_size; |
| 128 | word symbol_count; |
| 129 | word total_data_size_dm; |
| 130 | word data_block_count_dm; |
| 131 | word total_data_size_pm; |
| 132 | word data_block_count_pm; |
| 133 | } t_dsp_file_header; |
| 134 | typedef struct tag_dsp_memory_block_desc |
| 135 | { |
| 136 | word alias_memory_block; |
| 137 | word memory_type; |
| 138 | word address; |
| 139 | word size; /* DSP words */ |
| 140 | } t_dsp_memory_block_desc; |
| 141 | typedef struct tag_dsp_segment_desc |
| 142 | { |
| 143 | word memory_block; |
| 144 | word attributes; |
| 145 | word base; |
| 146 | word size; |
| 147 | word alignment; /* ==0 -> no other legal start address than base */ |
| 148 | } t_dsp_segment_desc; |
| 149 | typedef struct tag_dsp_symbol_desc |
| 150 | { |
| 151 | word symbol_id; |
| 152 | word segment; |
| 153 | word offset; |
| 154 | word size; /* DSP words */ |
| 155 | } t_dsp_symbol_desc; |
| 156 | typedef struct tag_dsp_data_block_header |
| 157 | { |
| 158 | word attributes; |
| 159 | word segment; |
| 160 | word offset; |
| 161 | word size; /* DSP words */ |
| 162 | } t_dsp_data_block_header; |
| 163 | typedef struct tag_dsp_download_desc |
| 164 | { |
| 165 | word download_id; |
| 166 | word download_flags; |
| 167 | word required_processing_power; |
| 168 | word interface_channel_count; |
| 169 | word excess_header_size; |
| 170 | word memory_block_count; |
| 171 | word segment_count; |
| 172 | word symbol_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; |
| 182 | } t_dsp_desc; |
| 183 | typedef struct tag_dsp_portable_download_desc /* be sure to keep native alignment for MAESTRA's */ |
| 184 | { |
| 185 | word download_id; |
| 186 | word download_flags; |
| 187 | word required_processing_power; |
| 188 | word interface_channel_count; |
| 189 | word excess_header_size; |
| 190 | word memory_block_count; |
| 191 | word segment_count; |
| 192 | word symbol_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 |
| 209 | /* |
| 210 | parameters: |
| 211 | <word> reconfigure delay (in 8kHz samples) |
| 212 | <word> reconfigure code |
| 213 | <byte> reconfigure hdlc preamble flags |
| 214 | */ |
| 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 |
| 234 | /* |
| 235 | data indications if transparent framer |
| 236 | <byte> data 0 |
| 237 | <byte> data 1 |
| 238 | ... |
| 239 | data indications if HDLC framer |
| 240 | <byte> data 0 |
| 241 | <byte> data 1 |
| 242 | ... |
| 243 | <byte> CRC 0 |
| 244 | <byte> CRC 1 |
| 245 | <byte> preamble flags |
| 246 | */ |
| 247 | #define DSP_UDATA_INDICATION_SYNC 0 |
| 248 | /* |
| 249 | returns: |
| 250 | <word> time of sync (sampled from counter at 8kHz) |
| 251 | */ |
| 252 | #define DSP_UDATA_INDICATION_DCD_OFF 1 |
| 253 | /* |
| 254 | returns: |
| 255 | <word> time of DCD off (sampled from counter at 8kHz) |
| 256 | */ |
| 257 | #define DSP_UDATA_INDICATION_DCD_ON 2 |
| 258 | /* |
| 259 | returns: |
| 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) |
| 264 | */ |
| 265 | #define DSP_UDATA_INDICATION_CTS_OFF 3 |
| 266 | /* |
| 267 | returns: |
| 268 | <word> time of CTS off (sampled from counter at 8kHz) |
| 269 | */ |
| 270 | #define DSP_UDATA_INDICATION_CTS_ON 4 |
| 271 | /* |
| 272 | returns: |
| 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) |
| 277 | */ |
| 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_ */ |