Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 1 | |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 2 | #ifndef DHF_H |
| 3 | #define DHF_H |
| 4 | |
| 5 | /************************************************************************************************************** |
| 6 | * |
| 7 | * FILE : DHF.H |
| 8 | * |
| 9 | * DATE : $Date: 2004/07/19 08:16:14 $ $Revision: 1.2 $ |
| 10 | * Original : 2004/05/17 07:33:13 Revision: 1.25 Tag: hcf7_t20040602_01 |
| 11 | * Original : 2004/05/11 06:03:14 Revision: 1.24 Tag: hcf7_t7_20040513_01 |
| 12 | * Original : 2004/04/15 09:24:42 Revision: 1.22 Tag: hcf7_t7_20040415_01 |
| 13 | * Original : 2004/04/09 14:35:52 Revision: 1.21 Tag: t7_20040413_01 |
| 14 | * Original : 2004/04/01 15:32:55 Revision: 1.18 Tag: t7_20040401_01 |
| 15 | * Original : 2004/03/10 15:39:28 Revision: 1.15 Tag: t20040310_01 |
| 16 | * Original : 2004/03/04 11:03:38 Revision: 1.13 Tag: t20040304_01 |
| 17 | * Original : 2004/02/25 14:14:37 Revision: 1.11 Tag: t20040302_03 |
| 18 | * Original : 2004/02/24 13:00:28 Revision: 1.10 Tag: t20040224_01 |
| 19 | * Original : 2004/02/19 10:57:28 Revision: 1.8 Tag: t20040219_01 |
| 20 | * |
| 21 | * AUTHOR : John Meertens |
| 22 | * Nico Valster |
| 23 | * |
| 24 | * SPECIFICATION: ......... |
| 25 | * |
| 26 | * DESC : structure definitions and function prototypes for unit DHF. |
| 27 | * |
| 28 | * Customizable via HCFCFG.H, which is included indirectly via HCF.H |
| 29 | * |
| 30 | *************************************************************************************************************** |
| 31 | * |
| 32 | * |
| 33 | * SOFTWARE LICENSE |
| 34 | * |
| 35 | * This software is provided subject to the following terms and conditions, |
| 36 | * which you should read carefully before using the software. Using this |
| 37 | * software indicates your acceptance of these terms and conditions. If you do |
| 38 | * not agree with these terms and conditions, do not use the software. |
| 39 | * |
Ruslan Pisarev | 7adea18 | 2010-03-20 09:24:44 +0200 | [diff] [blame] | 40 | * COPYRIGHT (C) 1994 - 1995 by AT&T. All Rights Reserved |
| 41 | * COPYRIGHT (C) 1999 - 2000 by Lucent Technologies. All Rights Reserved |
| 42 | * COPYRIGHT (C) 2001 - 2004 by Agere Systems Inc. All Rights Reserved |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 43 | * All rights reserved. |
| 44 | * |
| 45 | * Redistribution and use in source or binary forms, with or without |
| 46 | * modifications, are permitted provided that the following conditions are met: |
| 47 | * |
| 48 | * . Redistributions of source code must retain the above copyright notice, this |
| 49 | * list of conditions and the following Disclaimer as comments in the code as |
| 50 | * well as in the documentation and/or other materials provided with the |
| 51 | * distribution. |
| 52 | * |
| 53 | * . Redistributions in binary form must reproduce the above copyright notice, |
| 54 | * this list of conditions and the following Disclaimer in the documentation |
| 55 | * and/or other materials provided with the distribution. |
| 56 | * |
| 57 | * . Neither the name of Agere Systems Inc. nor the names of the contributors |
| 58 | * may be used to endorse or promote products derived from this software |
| 59 | * without specific prior written permission. |
| 60 | * |
| 61 | * Disclaimer |
| 62 | * |
| 63 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, |
| 64 | * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF |
| 65 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY |
| 66 | * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN |
| 67 | * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY |
| 68 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 69 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 70 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 71 | * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT |
| 72 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
| 73 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
| 74 | * DAMAGE. |
| 75 | * |
| 76 | * |
| 77 | **************************************************************************************************************/ |
| 78 | |
| 79 | |
| 80 | #ifdef _WIN32_WCE |
| 81 | #include <windef.h> |
| 82 | #endif |
| 83 | |
Ruslan Pisarev | 1ef6118 | 2010-03-20 09:24:57 +0200 | [diff] [blame] | 84 | #include "hcf.h" /* includes HCFCFG.H too */ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 85 | |
| 86 | #ifdef DHF_UIL |
Ruslan Pisarev | 7adea18 | 2010-03-20 09:24:44 +0200 | [diff] [blame] | 87 | #define GET_INFO(pp) uil_get_info((LTVP)pp) |
| 88 | #define PUT_INFO(pp) uil_put_info((LTVP)pp) |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 89 | #else |
Ruslan Pisarev | 7adea18 | 2010-03-20 09:24:44 +0200 | [diff] [blame] | 90 | #define GET_INFO(pp) hcf_get_info(ifbp, (LTVP)pp) |
| 91 | #define PUT_INFO(pp) hcf_put_info(ifbp, (LTVP)pp) |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 92 | #endif |
| 93 | |
| 94 | |
| 95 | /*---- Defines --------------------------------------------------------------*/ |
Ruslan Pisarev | 1ef6118 | 2010-03-20 09:24:57 +0200 | [diff] [blame] | 96 | #define CODEMASK 0x0000FFFFL /* Codemask for plug records */ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 97 | |
| 98 | /*---- Error numbers --------------------------------------------------------*/ |
| 99 | |
Ruslan Pisarev | 1ef6118 | 2010-03-20 09:24:57 +0200 | [diff] [blame] | 100 | #define DHF_ERR_INCOMP_FW 0x40 /* Image not compatible with NIC */ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 101 | |
| 102 | /*---- Type definitions -----------------------------------------------------*/ |
Ruslan Pisarev | 1ef6118 | 2010-03-20 09:24:57 +0200 | [diff] [blame] | 103 | /* needed by dhf_wrap.c */ |
| 104 | |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 105 | typedef struct { |
| 106 | LTVP ltvp; |
| 107 | hcf_16 len; |
| 108 | } LTV_INFO_STRUCT , *LTV_INFO_STRUCT_PTR; |
| 109 | |
| 110 | |
| 111 | /* |
| 112 | * Type: plugrecord |
| 113 | * |
| 114 | * Abstract: This structure represents a Plug Data Record. |
| 115 | * |
| 116 | * Description: |
| 117 | * This structure is used to overlay the plug records in the firmware memory image. |
| 118 | */ |
| 119 | |
| 120 | typedef struct { |
Ruslan Pisarev | 1ef6118 | 2010-03-20 09:24:57 +0200 | [diff] [blame] | 121 | hcf_32 code; /* Code to plug */ |
| 122 | hcf_32 addr; /* Address within the memory image to plug it in */ |
| 123 | hcf_32 len; /* The # of bytes which are available to store it */ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 124 | } plugrecord; |
| 125 | |
| 126 | /* |
| 127 | * Type: stringrecord |
| 128 | * |
| 129 | * Abstract: This structure represents a Firmware debug/assert string |
| 130 | * |
| 131 | * Description: |
| 132 | * This structure is used to get assert and debug outputs in the driver and/or utility to be |
| 133 | * able to get more visability of the FW. |
| 134 | */ |
| 135 | |
| 136 | #define MAX_DEBUGSTRINGS 1024 |
| 137 | #define MAX_DEBUGSTRING_LEN 82 |
| 138 | |
| 139 | typedef struct { |
| 140 | hcf_32 id; |
| 141 | char str[MAX_DEBUGSTRING_LEN]; |
| 142 | } stringrecord; |
| 143 | |
| 144 | /* |
| 145 | * Type: exportrecord |
| 146 | * |
| 147 | * Abstract: This structure represents a Firmware export of a variable |
| 148 | * |
| 149 | * Description: |
| 150 | * This structure is used to get the address and name of a FW variable. |
| 151 | */ |
| 152 | |
| 153 | #define MAX_DEBUGEXPORTS 2048 |
| 154 | #define MAX_DEBUGEXPORT_LEN 12 |
| 155 | |
| 156 | typedef struct { |
| 157 | hcf_32 id; |
| 158 | char str[MAX_DEBUGEXPORT_LEN]; |
| 159 | } exportrecord; |
| 160 | |
Ruslan Pisarev | 1ef6118 | 2010-03-20 09:24:57 +0200 | [diff] [blame] | 161 | /* Offsets in memimage array p[] */ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 162 | #define FWSTRINGS_FUNCTION 0 |
| 163 | #define FWEXPORTS_FUNCTION 1 |
| 164 | |
| 165 | /* |
| 166 | * Type: memimage |
| 167 | * |
| 168 | * Abstract: The "root" description of a complete memory image |
| 169 | * |
| 170 | * Description: |
| 171 | * This type represents an entire memory image. The image is built up of several |
| 172 | * segments. These segments need not be contiguous areas in memory, in other words |
| 173 | * the image may contain 'holes'. |
| 174 | * |
| 175 | * The 'codep' field points to an array of segment_descriptor structures. |
| 176 | * The end of the array is indicated by a segment_descriptor of which all fields are zero. |
| 177 | * The 'execution' field is a 32-bit address representing the execution address |
| 178 | * of the firmware within the memory image. This address is zero in case of non-volatile |
| 179 | * memory download. |
| 180 | * The 'compat' field points to an array of TODO |
| 181 | * The end of the array is indicated by a plug record of which all fields are zero. |
| 182 | * The 'identity' field points to an array of TODO |
| 183 | * The end of the array is indicated by a plug record of which all fields are zero. |
| 184 | * The Hermes-I specific 'pdaplug' field points to an array of Production Data Plug record structures. |
| 185 | * The end of the array is indicated by a plug record of which all fields are zero. |
| 186 | * The Hermes-I specific 'priplug' field points to an array of Primary Information Plug record structures. |
| 187 | * The end of the array is indicated by a plug record of which all fields are zero. |
| 188 | */ |
| 189 | typedef struct { |
Ruslan Pisarev | 1ef6118 | 2010-03-20 09:24:57 +0200 | [diff] [blame] | 190 | char signature[14+1+1]; /* signature (see DHF.C) + C/LE-Bin/BE-Bin-flag + format version */ |
| 191 | CFG_PROG_STRCT FAR *codep; /* */ |
| 192 | hcf_32 execution; /* Execution address of the firmware */ |
| 193 | void FAR *place_holder_1; |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 194 | void FAR *place_holder_2; |
Ruslan Pisarev | 1ef6118 | 2010-03-20 09:24:57 +0200 | [diff] [blame] | 195 | CFG_RANGE20_STRCT FAR *compat; /* Pointer to the compatibility info records */ |
| 196 | CFG_IDENTITY_STRCT FAR *identity; /* Pointer to the identity info records */ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 197 | void FAR *p[2]; /* (Up to 9) pointers for (future) expansion |
| 198 | * currently in use: |
| 199 | * - F/W printf information |
| 200 | */ |
| 201 | } memimage; |
| 202 | |
| 203 | |
| 204 | |
| 205 | /*----------------------------------------------------------------------------- |
| 206 | * |
| 207 | * DHF function prototypes |
| 208 | * |
| 209 | *---------------------------------------------------------------------------*/ |
| 210 | |
Ruslan Pisarev | 1ef6118 | 2010-03-20 09:24:57 +0200 | [diff] [blame] | 211 | EXTERN_C int dhf_download_fw(void *ifbp, memimage *fw); /* ifbp, ignored when using the UIL */ |
Ruslan Pisarev | 7adea18 | 2010-03-20 09:24:44 +0200 | [diff] [blame] | 212 | EXTERN_C int dhf_download_binary(memimage *fw); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 213 | |
| 214 | |
| 215 | /*----------------------------------------------------------------------------- |
| 216 | * |
| 217 | * Functions to be provided by the user of the DHF module. |
| 218 | * |
| 219 | *---------------------------------------------------------------------------*/ |
| 220 | |
Ruslan Pisarev | 1ef6118 | 2010-03-20 09:24:57 +0200 | [diff] [blame] | 221 | /* defined in DHF.C; see there for comments */ |
Ruslan Pisarev | 7adea18 | 2010-03-20 09:24:44 +0200 | [diff] [blame] | 222 | EXTERN_C hcf_16 *find_record_in_pda(hcf_16 *pdap, hcf_16 code); |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 223 | |
Ruslan Pisarev | 1ef6118 | 2010-03-20 09:24:57 +0200 | [diff] [blame] | 224 | #endif /* DHF_H */ |
Henk de Groot | 68c0bdf | 2009-09-27 11:12:52 +0200 | [diff] [blame] | 225 | |