Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 1 | /* |
| 2 | * $Id: sbe_promformat.h,v 2.2 2005/09/28 00:10:09 rickd PMCC4_3_1B $ |
| 3 | */ |
| 4 | |
| 5 | #ifndef _INC_SBE_PROMFORMAT_H_ |
| 6 | #define _INC_SBE_PROMFORMAT_H_ |
| 7 | |
| 8 | /*----------------------------------------------------------------------------- |
| 9 | * sbe_promformat.h - Contents of seeprom used by dvt and manufacturing tests |
| 10 | * |
| 11 | * Copyright (C) 2002-2005 SBE, Inc. |
| 12 | * |
| 13 | * This program is free software; you can redistribute it and/or modify |
| 14 | * it under the terms of the GNU General Public License as published by |
| 15 | * the Free Software Foundation; either version 2 of the License, or |
| 16 | * (at your option) any later version. |
| 17 | * |
| 18 | * This program is distributed in the hope that it will be useful, |
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 | * GNU General Public License for more details. |
| 22 | * |
| 23 | * For further information, contact via email: support@sbei.com |
| 24 | * SBE, Inc. San Ramon, California U.S.A. |
| 25 | * |
| 26 | *----------------------------------------------------------------------------- |
| 27 | * RCS info: |
| 28 | * RCS revision: $Revision: 2.2 $ |
| 29 | * Last changed on $Date: 2005/09/28 00:10:09 $ |
| 30 | * Changed by $Author: rickd $ |
| 31 | *----------------------------------------------------------------------------- |
| 32 | * $Log: sbe_promformat.h,v $ |
| 33 | * Revision 2.2 2005/09/28 00:10:09 rickd |
| 34 | * Add EEPROM sample from C4T1E1 board. |
| 35 | * |
| 36 | * Revision 2.1 2005/05/04 17:18:24 rickd |
| 37 | * Initial CI. |
| 38 | * |
| 39 | *----------------------------------------------------------------------------- |
| 40 | */ |
| 41 | |
| 42 | |
| 43 | /*** |
| 44 | * PMCC4 SAMPLE EEPROM IMAGE |
| 45 | * |
| 46 | * eeprom[00]: 01 11 76 07 01 00 a0 d6 |
| 47 | * eeprom[08]: 22 34 56 3e 5b c1 1c 3e |
| 48 | * eeprom[16]: 5b e1 b6 00 00 00 01 00 |
| 49 | * eeprom[24]: 00 08 46 d3 7b 5e a8 fb |
| 50 | * eeprom[32]: f7 ef df bf 7f 55 00 01 |
| 51 | * eeprom[40]: 02 04 08 10 20 40 80 ff |
| 52 | * eeprom[48]: fe fd fb f7 ef df bf 7f |
| 53 | * |
| 54 | ***/ |
| 55 | |
| 56 | |
| 57 | /*------------------------------------------------------------------------ |
| 58 | * Type 1 Format |
| 59 | * byte: |
| 60 | * 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
| 61 | * ------------------------------------------------------------------------- |
| 62 | * 01 11 76 SS SS 00 0A D6 <SERIAL NUM> <Create TIME> <Heatrun TIME> |
| 63 | * SBE SUB SERIAL # (BCD) (time_t) (time_t) |
| 64 | * ID VENDOR (format) (format) |
| 65 | * |
| 66 | * 19 20 21 22 23 24 25 26 |
| 67 | * Heat Run Heat Run |
| 68 | * Iterations Errors |
| 69 | *------------------------------------------------------------------------ |
| 70 | * |
| 71 | * |
| 72 | * |
| 73 | * Type 2 Format - Added length, CRC in fixed position |
| 74 | * byte: |
| 75 | * 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
| 76 | * ------------------------------------------------------------------------- |
| 77 | * 02 00 1A CC CC CC CC 11 76 07 03 00 0A D6 <SERIAL NUM> |
| 78 | * Payload SBE Crc32 SUB System System SERIAL/MAC |
| 79 | * Length VENDOR ID ID |
| 80 | * |
| 81 | * 17 18 19 20 21 22 23 24 25 26 27 28 29 39 31 32 |
| 82 | * -------------------------------------------------------------------------- |
| 83 | * <Create TIME> <Heatrun TIME> Heat Run Heat Run |
| 84 | * (time_t) (time_t) Iterations Errors |
| 85 | * |
| 86 | */ |
| 87 | |
| 88 | #ifdef __cplusplus |
| 89 | extern "C" |
| 90 | { |
| 91 | #endif |
| 92 | |
| 93 | |
| 94 | #define STRUCT_OFFSET(type, symbol) ((long)&(((type *)0)->symbol)) |
| 95 | |
| 96 | /*------------------------------------------------------------------------ |
| 97 | * Historically different Prom format types. |
| 98 | * |
| 99 | * For diagnostic and failure purposes, do not create a type 0x00 or a |
| 100 | * type 0xff |
| 101 | *------------------------------------------------------------------------ |
| 102 | */ |
| 103 | #define PROM_FORMAT_Unk (-1) |
| 104 | #define PROM_FORMAT_TYPE1 1 |
| 105 | #define PROM_FORMAT_TYPE2 2 |
| 106 | |
| 107 | |
| 108 | /****** bit fields for a type 1 formatted seeprom **************************/ |
| 109 | typedef struct |
| 110 | { |
| 111 | char type; /* 0x00 */ |
| 112 | char Id[2]; /* 0x01-0x02 */ |
| 113 | char SubId[2]; /* 0x03-0x04 */ |
| 114 | char Serial[6]; /* 0x05-0x0a */ |
| 115 | char CreateTime[4]; /* 0x0b-0x0e */ |
| 116 | char HeatRunTime[4]; /* 0x0f-0x12 */ |
| 117 | char HeatRunIterations[4]; /* 0x13-0x16 */ |
| 118 | char HeatRunErrors[4]; /* 0x17-0x1a */ |
| 119 | char Crc32[4]; /* 0x1b-0x1e */ |
| 120 | } FLD_TYPE1; |
| 121 | |
| 122 | |
| 123 | /****** bit fields for a type 2 formatted seeprom **************************/ |
| 124 | typedef struct |
| 125 | { |
| 126 | char type; /* 0x00 */ |
| 127 | char length[2]; /* 0x01-0x02 */ |
| 128 | char Crc32[4]; /* 0x03-0x06 */ |
| 129 | char Id[2]; /* 0x07-0x08 */ |
| 130 | char SubId[2]; /* 0x09-0x0a */ |
| 131 | char Serial[6]; /* 0x0b-0x10 */ |
| 132 | char CreateTime[4]; /* 0x11-0x14 */ |
| 133 | char HeatRunTime[4]; /* 0x15-0x18 */ |
| 134 | char HeatRunIterations[4]; /* 0x19-0x1c */ |
| 135 | char HeatRunErrors[4]; /* 0x1d-0x20 */ |
| 136 | } FLD_TYPE2; |
| 137 | |
| 138 | |
| 139 | |
| 140 | /***** this union allows us to access the seeprom as an array of bytes ***/ |
| 141 | /***** or as individual fields ***/ |
| 142 | |
| 143 | #define SBE_EEPROM_SIZE 128 |
| 144 | #define SBE_MFG_INFO_SIZE sizeof(FLD_TYPE2) |
| 145 | |
| 146 | typedef union |
| 147 | { |
| 148 | char bytes[128]; |
| 149 | FLD_TYPE1 fldType1; |
| 150 | FLD_TYPE2 fldType2; |
| 151 | } PROMFORMAT; |
| 152 | |
| 153 | #ifdef __cplusplus |
| 154 | } |
| 155 | #endif |
| 156 | |
| 157 | #endif /*** _INC_SBE_PROMFORMAT_H_ ***/ |