summaryrefslogtreecommitdiff
path: root/utils/AMS/hacking/amsinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils/AMS/hacking/amsinfo.c')
-rw-r--r--utils/AMS/hacking/amsinfo.c37
1 files changed, 2 insertions, 35 deletions
diff --git a/utils/AMS/hacking/amsinfo.c b/utils/AMS/hacking/amsinfo.c
index ff92175e64..433333ecca 100644
--- a/utils/AMS/hacking/amsinfo.c
+++ b/utils/AMS/hacking/amsinfo.c
@@ -66,7 +66,7 @@ uint8_t *buf; /* file content */
66 66
67/* 1st block description */ 67/* 1st block description */
68uint32_t idx,checksum,bs_multiplier,firmware_sz; 68uint32_t idx,checksum,bs_multiplier,firmware_sz;
69uint32_t unknown_4_1; uint8_t unknown_1,id; uint16_t unknown_2; 69uint32_t unknown_4_1; uint16_t unknown_1, unknown_2;
70uint32_t unknown_4_2,unknown_4_3; 70uint32_t unknown_4_2,unknown_4_3;
71 71
72static void *xmalloc(size_t s) /* malloc helper */ 72static void *xmalloc(size_t s) /* malloc helper */
@@ -76,28 +76,6 @@ static void *xmalloc(size_t s) /* malloc helper */
76 return r; 76 return r;
77} 77}
78 78
79/* known models */
80static const char * model(uint8_t id)
81{
82 switch(id)
83 {
84 case 0x1E: return "FUZE"; break;
85 case 0x22: return "CLIP"; break;
86 case 0x23: return "C200"; break;
87 case 0x24: return "E200"; break;
88 case 0x25: return "M200"; break;
89 case 0x27: return "CLV2"; break;
90 case 0x28: return "CLI+"; break;
91 case 0x70:
92 case 0x6d: return "FUZ2"; break;
93 default:
94 printf("Unknown ID 0x%x\n", id);
95
96 assert(id == 0x1E || (id >= 0x22 && id <= 0x28));
97 return "UNKNOWN!";
98 }
99}
100
101/* checksums the firmware (the firmware header contains the verification) */ 79/* checksums the firmware (the firmware header contains the verification) */
102static uint32_t do_checksum(void) 80static uint32_t do_checksum(void)
103{ 81{
@@ -142,8 +120,7 @@ static void check(void)
142 assert(bs_multiplier << 9 == PAD_TO_BOUNDARY(firmware_sz)); /* 0x200 * bs_multiplier */ 120 assert(bs_multiplier << 9 == PAD_TO_BOUNDARY(firmware_sz)); /* 0x200 * bs_multiplier */
143 121
144 unknown_4_1 = get32le(0x10 + shift); 122 unknown_4_1 = get32le(0x10 + shift);
145 unknown_1 = buf[0x14 + shift]; 123 unknown_1 = get16le(0x14 + shift);
146 id = buf[0x15 + shift];
147 unknown_2 = get16le(0x16 + shift); 124 unknown_2 = get16le(0x16 + shift);
148 unknown_4_2 = get32le(0x18 + shift); 125 unknown_4_2 = get32le(0x18 + shift);
149 unknown_4_3 = get32le(0x1c + shift); 126 unknown_4_3 = get32le(0x1c + shift);
@@ -171,9 +148,6 @@ static void check(void)
171 printf("1 Unknown %x\n",unknown_1); 148 printf("1 Unknown %x\n",unknown_1);
172 149
173 color(GREEN); 150 color(GREEN);
174 printf("1 Model ID %x (%s)\n",id,model(id));
175
176 color(GREEN);
177 printf("2 Unknown (should be 0) %x\n",unknown_2); 151 printf("2 Unknown (should be 0) %x\n",unknown_2);
178 assert(unknown_2 == 0); 152 assert(unknown_2 == 0);
179 153
@@ -185,13 +159,6 @@ static void check(void)
185 printf("4 Unknown (should be 1) %x\n",unknown_4_3); 159 printf("4 Unknown (should be 1) %x\n",unknown_4_3);
186 assert(unknown_4_3 == 1); 160 assert(unknown_4_3 == 1);
187 161
188 /* rest of the block is padded with 0xff */
189 for(i=0x20 + shift;i<0x200 - shift;i++)
190 assert(buf[i]==0xff /* normal case */ ||
191 ((id==0x1e||id==0x24) && ( /* Fuze or E200 */
192 (i>=0x3c && i<=0x3f && get32le(0x3c)==0x00005000)
193 )));
194
195 /* the 2nd block is identical, except that the 1st byte has been incremented */ 162 /* the 2nd block is identical, except that the 1st byte has been incremented */
196 assert(buf[0x0]==0&&buf[0x200]==1); 163 assert(buf[0x0]==0&&buf[0x200]==1);
197 assert(!memcmp(&buf[1],&buf[0x201],0x1FF - shift)); 164 assert(!memcmp(&buf[1],&buf[0x201],0x1FF - shift));