microblaze: Add TIMESTAMPING constants to socket.h
[linux-2.6/mini2440.git] / Documentation / video4linux / extract_xc3028.pl
blob2cb816047fc128bb67323c00ffcd982fe5d174fc
1 #!/usr/bin/perl
3 # Copyright (c) Mauro Carvalho Chehab <mchehab@infradead.org>
4 # Released under GPLv2
6 # In order to use, you need to:
7 # 1) Download the windows driver with something like:
8 # wget http://www.steventoth.net/linux/xc5000/HVR-12x0-14x0-17x0_1_25_25271_WHQL.zip
9 # 2) Extract the file hcw85bda.sys from the zip into the current dir:
10 # unzip -j HVR-12x0-14x0-17x0_1_25_25271_WHQL.zip Driver85/hcw85bda.sys
11 # 3) run the script:
12 # ./extract_xc3028.pl
13 # 4) copy the generated file:
14 # cp xc3028-v27.fw /lib/firmware
16 #use strict;
17 use IO::Handle;
19 my $debug=0;
21 sub verify ($$)
23 my ($filename, $hash) = @_;
24 my ($testhash);
26 if (system("which md5sum > /dev/null 2>&1")) {
27 die "This firmware requires the md5sum command - see http://www.gnu.org/software/coreutils/\n";
30 open(CMD, "md5sum ".$filename."|");
31 $testhash = <CMD>;
32 $testhash =~ /([a-zA-Z0-9]*)/;
33 $testhash = $1;
34 close CMD;
35 die "Hash of extracted file does not match (found $testhash, expected $hash!\n" if ($testhash ne $hash);
38 sub get_hunk ($$)
40 my ($offset, $length) = @_;
41 my ($chunklength, $buf, $rcount, $out);
43 sysseek(INFILE, $offset, SEEK_SET);
44 while ($length > 0) {
45 # Calc chunk size
46 $chunklength = 2048;
47 $chunklength = $length if ($chunklength > $length);
49 $rcount = sysread(INFILE, $buf, $chunklength);
50 die "Ran out of data\n" if ($rcount != $chunklength);
51 $out .= $buf;
52 $length -= $rcount;
54 return $out;
57 sub write_le16($)
59 my $val = shift;
60 my $msb = ($val >> 8) &0xff;
61 my $lsb = $val & 0xff;
63 syswrite(OUTFILE, chr($lsb).chr($msb));
66 sub write_le32($)
68 my $val = shift;
69 my $l3 = ($val >> 24) & 0xff;
70 my $l2 = ($val >> 16) & 0xff;
71 my $l1 = ($val >> 8) & 0xff;
72 my $l0 = $val & 0xff;
74 syswrite(OUTFILE, chr($l0).chr($l1).chr($l2).chr($l3));
77 sub write_le64($$)
79 my $msb_val = shift;
80 my $lsb_val = shift;
81 my $l7 = ($msb_val >> 24) & 0xff;
82 my $l6 = ($msb_val >> 16) & 0xff;
83 my $l5 = ($msb_val >> 8) & 0xff;
84 my $l4 = $msb_val & 0xff;
86 my $l3 = ($lsb_val >> 24) & 0xff;
87 my $l2 = ($lsb_val >> 16) & 0xff;
88 my $l1 = ($lsb_val >> 8) & 0xff;
89 my $l0 = $lsb_val & 0xff;
91 syswrite(OUTFILE,
92 chr($l0).chr($l1).chr($l2).chr($l3).
93 chr($l4).chr($l5).chr($l6).chr($l7));
96 sub write_hunk($$)
98 my ($offset, $length) = @_;
99 my $out = get_hunk($offset, $length);
101 printf "(len %d) ",$length if ($debug);
103 for (my $i=0;$i<$length;$i++) {
104 printf "%02x ",ord(substr($out,$i,1)) if ($debug);
106 printf "\n" if ($debug);
108 syswrite(OUTFILE, $out);
111 sub write_hunk_fix_endian($$)
113 my ($offset, $length) = @_;
114 my $out = get_hunk($offset, $length);
116 printf "(len_fix %d) ",$length if ($debug);
118 for (my $i=0;$i<$length;$i++) {
119 printf "%02x ",ord(substr($out,$i,1)) if ($debug);
121 printf "\n" if ($debug);
123 my $i=0;
124 while ($i<$length) {
125 my $size = ord(substr($out,$i,1))*256+ord(substr($out,$i+1,1));
126 syswrite(OUTFILE, substr($out,$i+1,1));
127 syswrite(OUTFILE, substr($out,$i,1));
128 $i+=2;
129 if ($size>0 && $size <0x8000) {
130 for (my $j=0;$j<$size;$j++) {
131 syswrite(OUTFILE, substr($out,$j+$i,1));
133 $i+=$size;
138 sub main_firmware($$$$)
140 my $out;
141 my $j=0;
142 my $outfile = shift;
143 my $name = shift;
144 my $version = shift;
145 my $nr_desc = shift;
147 for ($j = length($name); $j <32; $j++) {
148 $name = $name.chr(0);
151 open OUTFILE, ">$outfile";
152 syswrite(OUTFILE, $name);
153 write_le16($version);
154 write_le16($nr_desc);
157 # Firmware 0, type: BASE FW F8MHZ (0x00000003), id: (0000000000000000), size: 8718
160 write_le32(0x00000003); # Type
161 write_le64(0x00000000, 0x00000000); # ID
162 write_le32(8718); # Size
163 write_hunk_fix_endian(813432, 8718);
166 # Firmware 1, type: BASE FW F8MHZ MTS (0x00000007), id: (0000000000000000), size: 8712
169 write_le32(0x00000007); # Type
170 write_le64(0x00000000, 0x00000000); # ID
171 write_le32(8712); # Size
172 write_hunk_fix_endian(822152, 8712);
175 # Firmware 2, type: BASE FW FM (0x00000401), id: (0000000000000000), size: 8562
178 write_le32(0x00000401); # Type
179 write_le64(0x00000000, 0x00000000); # ID
180 write_le32(8562); # Size
181 write_hunk_fix_endian(830872, 8562);
184 # Firmware 3, type: BASE FW FM INPUT1 (0x00000c01), id: (0000000000000000), size: 8576
187 write_le32(0x00000c01); # Type
188 write_le64(0x00000000, 0x00000000); # ID
189 write_le32(8576); # Size
190 write_hunk_fix_endian(839440, 8576);
193 # Firmware 4, type: BASE FW (0x00000001), id: (0000000000000000), size: 8706
196 write_le32(0x00000001); # Type
197 write_le64(0x00000000, 0x00000000); # ID
198 write_le32(8706); # Size
199 write_hunk_fix_endian(848024, 8706);
202 # Firmware 5, type: BASE FW MTS (0x00000005), id: (0000000000000000), size: 8682
205 write_le32(0x00000005); # Type
206 write_le64(0x00000000, 0x00000000); # ID
207 write_le32(8682); # Size
208 write_hunk_fix_endian(856736, 8682);
211 # Firmware 6, type: STD FW (0x00000000), id: PAL/BG A2/A (0000000100000007), size: 161
214 write_le32(0x00000000); # Type
215 write_le64(0x00000001, 0x00000007); # ID
216 write_le32(161); # Size
217 write_hunk_fix_endian(865424, 161);
220 # Firmware 7, type: STD FW MTS (0x00000004), id: PAL/BG A2/A (0000000100000007), size: 169
223 write_le32(0x00000004); # Type
224 write_le64(0x00000001, 0x00000007); # ID
225 write_le32(169); # Size
226 write_hunk_fix_endian(865592, 169);
229 # Firmware 8, type: STD FW (0x00000000), id: PAL/BG A2/B (0000000200000007), size: 161
232 write_le32(0x00000000); # Type
233 write_le64(0x00000002, 0x00000007); # ID
234 write_le32(161); # Size
235 write_hunk_fix_endian(865424, 161);
238 # Firmware 9, type: STD FW MTS (0x00000004), id: PAL/BG A2/B (0000000200000007), size: 169
241 write_le32(0x00000004); # Type
242 write_le64(0x00000002, 0x00000007); # ID
243 write_le32(169); # Size
244 write_hunk_fix_endian(865592, 169);
247 # Firmware 10, type: STD FW (0x00000000), id: PAL/BG NICAM/A (0000000400000007), size: 161
250 write_le32(0x00000000); # Type
251 write_le64(0x00000004, 0x00000007); # ID
252 write_le32(161); # Size
253 write_hunk_fix_endian(866112, 161);
256 # Firmware 11, type: STD FW MTS (0x00000004), id: PAL/BG NICAM/A (0000000400000007), size: 169
259 write_le32(0x00000004); # Type
260 write_le64(0x00000004, 0x00000007); # ID
261 write_le32(169); # Size
262 write_hunk_fix_endian(866280, 169);
265 # Firmware 12, type: STD FW (0x00000000), id: PAL/BG NICAM/B (0000000800000007), size: 161
268 write_le32(0x00000000); # Type
269 write_le64(0x00000008, 0x00000007); # ID
270 write_le32(161); # Size
271 write_hunk_fix_endian(866112, 161);
274 # Firmware 13, type: STD FW MTS (0x00000004), id: PAL/BG NICAM/B (0000000800000007), size: 169
277 write_le32(0x00000004); # Type
278 write_le64(0x00000008, 0x00000007); # ID
279 write_le32(169); # Size
280 write_hunk_fix_endian(866280, 169);
283 # Firmware 14, type: STD FW (0x00000000), id: PAL/DK A2 (00000003000000e0), size: 161
286 write_le32(0x00000000); # Type
287 write_le64(0x00000003, 0x000000e0); # ID
288 write_le32(161); # Size
289 write_hunk_fix_endian(866800, 161);
292 # Firmware 15, type: STD FW MTS (0x00000004), id: PAL/DK A2 (00000003000000e0), size: 169
295 write_le32(0x00000004); # Type
296 write_le64(0x00000003, 0x000000e0); # ID
297 write_le32(169); # Size
298 write_hunk_fix_endian(866968, 169);
301 # Firmware 16, type: STD FW (0x00000000), id: PAL/DK NICAM (0000000c000000e0), size: 161
304 write_le32(0x00000000); # Type
305 write_le64(0x0000000c, 0x000000e0); # ID
306 write_le32(161); # Size
307 write_hunk_fix_endian(867144, 161);
310 # Firmware 17, type: STD FW MTS (0x00000004), id: PAL/DK NICAM (0000000c000000e0), size: 169
313 write_le32(0x00000004); # Type
314 write_le64(0x0000000c, 0x000000e0); # ID
315 write_le32(169); # Size
316 write_hunk_fix_endian(867312, 169);
319 # Firmware 18, type: STD FW (0x00000000), id: SECAM/K1 (0000000000200000), size: 161
322 write_le32(0x00000000); # Type
323 write_le64(0x00000000, 0x00200000); # ID
324 write_le32(161); # Size
325 write_hunk_fix_endian(867488, 161);
328 # Firmware 19, type: STD FW MTS (0x00000004), id: SECAM/K1 (0000000000200000), size: 169
331 write_le32(0x00000004); # Type
332 write_le64(0x00000000, 0x00200000); # ID
333 write_le32(169); # Size
334 write_hunk_fix_endian(867656, 169);
337 # Firmware 20, type: STD FW (0x00000000), id: SECAM/K3 (0000000004000000), size: 161
340 write_le32(0x00000000); # Type
341 write_le64(0x00000000, 0x04000000); # ID
342 write_le32(161); # Size
343 write_hunk_fix_endian(867832, 161);
346 # Firmware 21, type: STD FW MTS (0x00000004), id: SECAM/K3 (0000000004000000), size: 169
349 write_le32(0x00000004); # Type
350 write_le64(0x00000000, 0x04000000); # ID
351 write_le32(169); # Size
352 write_hunk_fix_endian(868000, 169);
355 # Firmware 22, type: STD FW D2633 DTV6 ATSC (0x00010030), id: (0000000000000000), size: 149
358 write_le32(0x00010030); # Type
359 write_le64(0x00000000, 0x00000000); # ID
360 write_le32(149); # Size
361 write_hunk_fix_endian(868176, 149);
364 # Firmware 23, type: STD FW D2620 DTV6 QAM (0x00000068), id: (0000000000000000), size: 149
367 write_le32(0x00000068); # Type
368 write_le64(0x00000000, 0x00000000); # ID
369 write_le32(149); # Size
370 write_hunk_fix_endian(868336, 149);
373 # Firmware 24, type: STD FW D2633 DTV6 QAM (0x00000070), id: (0000000000000000), size: 149
376 write_le32(0x00000070); # Type
377 write_le64(0x00000000, 0x00000000); # ID
378 write_le32(149); # Size
379 write_hunk_fix_endian(868488, 149);
382 # Firmware 25, type: STD FW D2620 DTV7 (0x00000088), id: (0000000000000000), size: 149
385 write_le32(0x00000088); # Type
386 write_le64(0x00000000, 0x00000000); # ID
387 write_le32(149); # Size
388 write_hunk_fix_endian(868648, 149);
391 # Firmware 26, type: STD FW D2633 DTV7 (0x00000090), id: (0000000000000000), size: 149
394 write_le32(0x00000090); # Type
395 write_le64(0x00000000, 0x00000000); # ID
396 write_le32(149); # Size
397 write_hunk_fix_endian(868800, 149);
400 # Firmware 27, type: STD FW D2620 DTV78 (0x00000108), id: (0000000000000000), size: 149
403 write_le32(0x00000108); # Type
404 write_le64(0x00000000, 0x00000000); # ID
405 write_le32(149); # Size
406 write_hunk_fix_endian(868960, 149);
409 # Firmware 28, type: STD FW D2633 DTV78 (0x00000110), id: (0000000000000000), size: 149
412 write_le32(0x00000110); # Type
413 write_le64(0x00000000, 0x00000000); # ID
414 write_le32(149); # Size
415 write_hunk_fix_endian(869112, 149);
418 # Firmware 29, type: STD FW D2620 DTV8 (0x00000208), id: (0000000000000000), size: 149
421 write_le32(0x00000208); # Type
422 write_le64(0x00000000, 0x00000000); # ID
423 write_le32(149); # Size
424 write_hunk_fix_endian(868648, 149);
427 # Firmware 30, type: STD FW D2633 DTV8 (0x00000210), id: (0000000000000000), size: 149
430 write_le32(0x00000210); # Type
431 write_le64(0x00000000, 0x00000000); # ID
432 write_le32(149); # Size
433 write_hunk_fix_endian(868800, 149);
436 # Firmware 31, type: STD FW FM (0x00000400), id: (0000000000000000), size: 135
439 write_le32(0x00000400); # Type
440 write_le64(0x00000000, 0x00000000); # ID
441 write_le32(135); # Size
442 write_hunk_fix_endian(869584, 135);
445 # Firmware 32, type: STD FW (0x00000000), id: PAL/I (0000000000000010), size: 161
448 write_le32(0x00000000); # Type
449 write_le64(0x00000000, 0x00000010); # ID
450 write_le32(161); # Size
451 write_hunk_fix_endian(869728, 161);
454 # Firmware 33, type: STD FW MTS (0x00000004), id: PAL/I (0000000000000010), size: 169
457 write_le32(0x00000004); # Type
458 write_le64(0x00000000, 0x00000010); # ID
459 write_le32(169); # Size
460 write_hunk_fix_endian(869896, 169);
463 # Firmware 34, type: STD FW (0x00000000), id: SECAM/L AM (0000001000400000), size: 169
466 write_le32(0x00000000); # Type
467 write_le64(0x00000010, 0x00400000); # ID
468 write_le32(169); # Size
469 write_hunk_fix_endian(870072, 169);
472 # Firmware 35, type: STD FW (0x00000000), id: SECAM/L NICAM (0000000c00400000), size: 161
475 write_le32(0x00000000); # Type
476 write_le64(0x0000000c, 0x00400000); # ID
477 write_le32(161); # Size
478 write_hunk_fix_endian(870248, 161);
481 # Firmware 36, type: STD FW (0x00000000), id: SECAM/Lc (0000000000800000), size: 161
484 write_le32(0x00000000); # Type
485 write_le64(0x00000000, 0x00800000); # ID
486 write_le32(161); # Size
487 write_hunk_fix_endian(870416, 161);
490 # Firmware 37, type: STD FW (0x00000000), id: NTSC/M Kr (0000000000008000), size: 161
493 write_le32(0x00000000); # Type
494 write_le64(0x00000000, 0x00008000); # ID
495 write_le32(161); # Size
496 write_hunk_fix_endian(870584, 161);
499 # Firmware 38, type: STD FW LCD (0x00001000), id: NTSC/M Kr (0000000000008000), size: 161
502 write_le32(0x00001000); # Type
503 write_le64(0x00000000, 0x00008000); # ID
504 write_le32(161); # Size
505 write_hunk_fix_endian(870752, 161);
508 # Firmware 39, type: STD FW LCD NOGD (0x00003000), id: NTSC/M Kr (0000000000008000), size: 161
511 write_le32(0x00003000); # Type
512 write_le64(0x00000000, 0x00008000); # ID
513 write_le32(161); # Size
514 write_hunk_fix_endian(870920, 161);
517 # Firmware 40, type: STD FW MTS (0x00000004), id: NTSC/M Kr (0000000000008000), size: 169
520 write_le32(0x00000004); # Type
521 write_le64(0x00000000, 0x00008000); # ID
522 write_le32(169); # Size
523 write_hunk_fix_endian(871088, 169);
526 # Firmware 41, type: STD FW (0x00000000), id: NTSC PAL/M PAL/N (000000000000b700), size: 161
529 write_le32(0x00000000); # Type
530 write_le64(0x00000000, 0x0000b700); # ID
531 write_le32(161); # Size
532 write_hunk_fix_endian(871264, 161);
535 # Firmware 42, type: STD FW LCD (0x00001000), id: NTSC PAL/M PAL/N (000000000000b700), size: 161
538 write_le32(0x00001000); # Type
539 write_le64(0x00000000, 0x0000b700); # ID
540 write_le32(161); # Size
541 write_hunk_fix_endian(871432, 161);
544 # Firmware 43, type: STD FW LCD NOGD (0x00003000), id: NTSC PAL/M PAL/N (000000000000b700), size: 161
547 write_le32(0x00003000); # Type
548 write_le64(0x00000000, 0x0000b700); # ID
549 write_le32(161); # Size
550 write_hunk_fix_endian(871600, 161);
553 # Firmware 44, type: STD FW (0x00000000), id: NTSC/M Jp (0000000000002000), size: 161
556 write_le32(0x00000000); # Type
557 write_le64(0x00000000, 0x00002000); # ID
558 write_le32(161); # Size
559 write_hunk_fix_endian(871264, 161);
562 # Firmware 45, type: STD FW MTS (0x00000004), id: NTSC PAL/M PAL/N (000000000000b700), size: 169
565 write_le32(0x00000004); # Type
566 write_le64(0x00000000, 0x0000b700); # ID
567 write_le32(169); # Size
568 write_hunk_fix_endian(871936, 169);
571 # Firmware 46, type: STD FW MTS LCD (0x00001004), id: NTSC PAL/M PAL/N (000000000000b700), size: 169
574 write_le32(0x00001004); # Type
575 write_le64(0x00000000, 0x0000b700); # ID
576 write_le32(169); # Size
577 write_hunk_fix_endian(872112, 169);
580 # Firmware 47, type: STD FW MTS LCD NOGD (0x00003004), id: NTSC PAL/M PAL/N (000000000000b700), size: 169
583 write_le32(0x00003004); # Type
584 write_le64(0x00000000, 0x0000b700); # ID
585 write_le32(169); # Size
586 write_hunk_fix_endian(872288, 169);
589 # Firmware 48, type: SCODE FW HAS IF (0x60000000), IF = 3.28 MHz id: (0000000000000000), size: 192
592 write_le32(0x60000000); # Type
593 write_le64(0x00000000, 0x00000000); # ID
594 write_le16(3280); # IF
595 write_le32(192); # Size
596 write_hunk(811896, 192);
599 # Firmware 49, type: SCODE FW HAS IF (0x60000000), IF = 3.30 MHz id: (0000000000000000), size: 192
602 write_le32(0x60000000); # Type
603 write_le64(0x00000000, 0x00000000); # ID
604 write_le16(3300); # IF
605 write_le32(192); # Size
606 write_hunk(813048, 192);
609 # Firmware 50, type: SCODE FW HAS IF (0x60000000), IF = 3.44 MHz id: (0000000000000000), size: 192
612 write_le32(0x60000000); # Type
613 write_le64(0x00000000, 0x00000000); # ID
614 write_le16(3440); # IF
615 write_le32(192); # Size
616 write_hunk(812280, 192);
619 # Firmware 51, type: SCODE FW HAS IF (0x60000000), IF = 3.46 MHz id: (0000000000000000), size: 192
622 write_le32(0x60000000); # Type
623 write_le64(0x00000000, 0x00000000); # ID
624 write_le16(3460); # IF
625 write_le32(192); # Size
626 write_hunk(812472, 192);
629 # Firmware 52, type: SCODE FW DTV6 ATSC OREN36 HAS IF (0x60210020), IF = 3.80 MHz id: (0000000000000000), size: 192
632 write_le32(0x60210020); # Type
633 write_le64(0x00000000, 0x00000000); # ID
634 write_le16(3800); # IF
635 write_le32(192); # Size
636 write_hunk(809784, 192);
639 # Firmware 53, type: SCODE FW HAS IF (0x60000000), IF = 4.00 MHz id: (0000000000000000), size: 192
642 write_le32(0x60000000); # Type
643 write_le64(0x00000000, 0x00000000); # ID
644 write_le16(4000); # IF
645 write_le32(192); # Size
646 write_hunk(812088, 192);
649 # Firmware 54, type: SCODE FW DTV6 ATSC TOYOTA388 HAS IF (0x60410020), IF = 4.08 MHz id: (0000000000000000), size: 192
652 write_le32(0x60410020); # Type
653 write_le64(0x00000000, 0x00000000); # ID
654 write_le16(4080); # IF
655 write_le32(192); # Size
656 write_hunk(809976, 192);
659 # Firmware 55, type: SCODE FW HAS IF (0x60000000), IF = 4.20 MHz id: (0000000000000000), size: 192
662 write_le32(0x60000000); # Type
663 write_le64(0x00000000, 0x00000000); # ID
664 write_le16(4200); # IF
665 write_le32(192); # Size
666 write_hunk(811704, 192);
669 # Firmware 56, type: SCODE FW MONO HAS IF (0x60008000), IF = 4.32 MHz id: NTSC/M Kr (0000000000008000), size: 192
672 write_le32(0x60008000); # Type
673 write_le64(0x00000000, 0x00008000); # ID
674 write_le16(4320); # IF
675 write_le32(192); # Size
676 write_hunk(808056, 192);
679 # Firmware 57, type: SCODE FW HAS IF (0x60000000), IF = 4.45 MHz id: (0000000000000000), size: 192
682 write_le32(0x60000000); # Type
683 write_le64(0x00000000, 0x00000000); # ID
684 write_le16(4450); # IF
685 write_le32(192); # Size
686 write_hunk(812664, 192);
689 # Firmware 58, type: SCODE FW MTS LCD NOGD MONO IF HAS IF (0x6002b004), IF = 4.50 MHz id: NTSC PAL/M PAL/N (000000000000b700), size: 192
692 write_le32(0x6002b004); # Type
693 write_le64(0x00000000, 0x0000b700); # ID
694 write_le16(4500); # IF
695 write_le32(192); # Size
696 write_hunk(807672, 192);
699 # Firmware 59, type: SCODE FW LCD NOGD IF HAS IF (0x60023000), IF = 4.60 MHz id: NTSC/M Kr (0000000000008000), size: 192
702 write_le32(0x60023000); # Type
703 write_le64(0x00000000, 0x00008000); # ID
704 write_le16(4600); # IF
705 write_le32(192); # Size
706 write_hunk(807864, 192);
709 # Firmware 60, type: SCODE FW DTV6 QAM DTV7 DTV78 DTV8 ZARLINK456 HAS IF (0x620003e0), IF = 4.76 MHz id: (0000000000000000), size: 192
712 write_le32(0x620003e0); # Type
713 write_le64(0x00000000, 0x00000000); # ID
714 write_le16(4760); # IF
715 write_le32(192); # Size
716 write_hunk(807288, 192);
719 # Firmware 61, type: SCODE FW HAS IF (0x60000000), IF = 4.94 MHz id: (0000000000000000), size: 192
722 write_le32(0x60000000); # Type
723 write_le64(0x00000000, 0x00000000); # ID
724 write_le16(4940); # IF
725 write_le32(192); # Size
726 write_hunk(811512, 192);
729 # Firmware 62, type: SCODE FW HAS IF (0x60000000), IF = 5.26 MHz id: (0000000000000000), size: 192
732 write_le32(0x60000000); # Type
733 write_le64(0x00000000, 0x00000000); # ID
734 write_le16(5260); # IF
735 write_le32(192); # Size
736 write_hunk(810552, 192);
739 # Firmware 63, type: SCODE FW MONO HAS IF (0x60008000), IF = 5.32 MHz id: PAL/BG A2 NICAM (0000000f00000007), size: 192
742 write_le32(0x60008000); # Type
743 write_le64(0x0000000f, 0x00000007); # ID
744 write_le16(5320); # IF
745 write_le32(192); # Size
746 write_hunk(810744, 192);
749 # Firmware 64, type: SCODE FW DTV7 DTV78 DTV8 DIBCOM52 CHINA HAS IF (0x65000380), IF = 5.40 MHz id: (0000000000000000), size: 192
752 write_le32(0x65000380); # Type
753 write_le64(0x00000000, 0x00000000); # ID
754 write_le16(5400); # IF
755 write_le32(192); # Size
756 write_hunk(807096, 192);
759 # Firmware 65, type: SCODE FW DTV6 ATSC OREN538 HAS IF (0x60110020), IF = 5.58 MHz id: (0000000000000000), size: 192
762 write_le32(0x60110020); # Type
763 write_le64(0x00000000, 0x00000000); # ID
764 write_le16(5580); # IF
765 write_le32(192); # Size
766 write_hunk(809592, 192);
769 # Firmware 66, type: SCODE FW HAS IF (0x60000000), IF = 5.64 MHz id: PAL/BG A2 (0000000300000007), size: 192
772 write_le32(0x60000000); # Type
773 write_le64(0x00000003, 0x00000007); # ID
774 write_le16(5640); # IF
775 write_le32(192); # Size
776 write_hunk(808440, 192);
779 # Firmware 67, type: SCODE FW HAS IF (0x60000000), IF = 5.74 MHz id: PAL/BG NICAM (0000000c00000007), size: 192
782 write_le32(0x60000000); # Type
783 write_le64(0x0000000c, 0x00000007); # ID
784 write_le16(5740); # IF
785 write_le32(192); # Size
786 write_hunk(808632, 192);
789 # Firmware 68, type: SCODE FW HAS IF (0x60000000), IF = 5.90 MHz id: (0000000000000000), size: 192
792 write_le32(0x60000000); # Type
793 write_le64(0x00000000, 0x00000000); # ID
794 write_le16(5900); # IF
795 write_le32(192); # Size
796 write_hunk(810360, 192);
799 # Firmware 69, type: SCODE FW MONO HAS IF (0x60008000), IF = 6.00 MHz id: PAL/DK PAL/I SECAM/K3 SECAM/L SECAM/Lc NICAM (0000000c04c000f0), size: 192
802 write_le32(0x60008000); # Type
803 write_le64(0x0000000c, 0x04c000f0); # ID
804 write_le16(6000); # IF
805 write_le32(192); # Size
806 write_hunk(808824, 192);
809 # Firmware 70, type: SCODE FW DTV6 QAM ATSC LG60 F6MHZ HAS IF (0x68050060), IF = 6.20 MHz id: (0000000000000000), size: 192
812 write_le32(0x68050060); # Type
813 write_le64(0x00000000, 0x00000000); # ID
814 write_le16(6200); # IF
815 write_le32(192); # Size
816 write_hunk(809400, 192);
819 # Firmware 71, type: SCODE FW HAS IF (0x60000000), IF = 6.24 MHz id: PAL/I (0000000000000010), size: 192
822 write_le32(0x60000000); # Type
823 write_le64(0x00000000, 0x00000010); # ID
824 write_le16(6240); # IF
825 write_le32(192); # Size
826 write_hunk(808248, 192);
829 # Firmware 72, type: SCODE FW MONO HAS IF (0x60008000), IF = 6.32 MHz id: SECAM/K1 (0000000000200000), size: 192
832 write_le32(0x60008000); # Type
833 write_le64(0x00000000, 0x00200000); # ID
834 write_le16(6320); # IF
835 write_le32(192); # Size
836 write_hunk(811320, 192);
839 # Firmware 73, type: SCODE FW HAS IF (0x60000000), IF = 6.34 MHz id: SECAM/K1 (0000000000200000), size: 192
842 write_le32(0x60000000); # Type
843 write_le64(0x00000000, 0x00200000); # ID
844 write_le16(6340); # IF
845 write_le32(192); # Size
846 write_hunk(809208, 192);
849 # Firmware 74, type: SCODE FW MONO HAS IF (0x60008000), IF = 6.50 MHz id: PAL/DK SECAM/K3 SECAM/L NICAM (0000000c044000e0), size: 192
852 write_le32(0x60008000); # Type
853 write_le64(0x0000000c, 0x044000e0); # ID
854 write_le16(6500); # IF
855 write_le32(192); # Size
856 write_hunk(811128, 192);
859 # Firmware 75, type: SCODE FW DTV6 ATSC ATI638 HAS IF (0x60090020), IF = 6.58 MHz id: (0000000000000000), size: 192
862 write_le32(0x60090020); # Type
863 write_le64(0x00000000, 0x00000000); # ID
864 write_le16(6580); # IF
865 write_le32(192); # Size
866 write_hunk(807480, 192);
869 # Firmware 76, type: SCODE FW HAS IF (0x60000000), IF = 6.60 MHz id: PAL/DK A2 (00000003000000e0), size: 192
872 write_le32(0x60000000); # Type
873 write_le64(0x00000003, 0x000000e0); # ID
874 write_le16(6600); # IF
875 write_le32(192); # Size
876 write_hunk(809016, 192);
879 # Firmware 77, type: SCODE FW MONO HAS IF (0x60008000), IF = 6.68 MHz id: PAL/DK A2 (00000003000000e0), size: 192
882 write_le32(0x60008000); # Type
883 write_le64(0x00000003, 0x000000e0); # ID
884 write_le16(6680); # IF
885 write_le32(192); # Size
886 write_hunk(810936, 192);
889 # Firmware 78, type: SCODE FW DTV6 ATSC TOYOTA794 HAS IF (0x60810020), IF = 8.14 MHz id: (0000000000000000), size: 192
892 write_le32(0x60810020); # Type
893 write_le64(0x00000000, 0x00000000); # ID
894 write_le16(8140); # IF
895 write_le32(192); # Size
896 write_hunk(810168, 192);
899 # Firmware 79, type: SCODE FW HAS IF (0x60000000), IF = 8.20 MHz id: (0000000000000000), size: 192
902 write_le32(0x60000000); # Type
903 write_le64(0x00000000, 0x00000000); # ID
904 write_le16(8200); # IF
905 write_le32(192); # Size
906 write_hunk(812856, 192);
909 sub extract_firmware {
910 my $sourcefile = "hcw85bda.sys";
911 my $hash = "0e44dbf63bb0169d57446aec21881ff2";
912 my $outfile = "xc3028-v27.fw";
913 my $name = "xc2028 firmware";
914 my $version = 519;
915 my $nr_desc = 80;
916 my $out;
918 verify($sourcefile, $hash);
920 open INFILE, "<$sourcefile";
921 main_firmware($outfile, $name, $version, $nr_desc);
922 close INFILE;
925 extract_firmware;
926 printf "Firmwares generated.\n";