| 392 |
dpurdie |
1 |
#! perl
|
|
|
2 |
########################################################################
|
| 6177 |
dpurdie |
3 |
# COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.
|
| 392 |
dpurdie |
4 |
#
|
|
|
5 |
# Module name : jats.sh
|
|
|
6 |
# Module type : Makefile system
|
|
|
7 |
# Compiler(s) : n/a
|
|
|
8 |
# Environment(s): jats
|
|
|
9 |
#
|
|
|
10 |
# Description : Dump MUG file information
|
|
|
11 |
#
|
|
|
12 |
# Primitive attempt to dump out the APMCFG and MASSAPMV files
|
|
|
13 |
#
|
|
|
14 |
# The APMCFG file works OK
|
|
|
15 |
# Th MASSAPMV needs to be processed (manually) with modcrc
|
|
|
16 |
#
|
|
|
17 |
#
|
|
|
18 |
# Usage:
|
|
|
19 |
#
|
|
|
20 |
# Version Who Date Description
|
|
|
21 |
# 0.0.0.0 DDP 25-Jul-06 Initial Code
|
|
|
22 |
#
|
|
|
23 |
#......................................................................#
|
|
|
24 |
|
|
|
25 |
require 5.006_001;
|
|
|
26 |
use strict;
|
|
|
27 |
use warnings;
|
|
|
28 |
use Cwd;
|
|
|
29 |
use JatsError;
|
|
|
30 |
|
|
|
31 |
|
|
|
32 |
foreach my $file ( glob ('*@APMCFG*' ))
|
|
|
33 |
{
|
|
|
34 |
Message("Processing $file" );
|
|
|
35 |
open (DATA , "<", $file ) || Error ("Can't open $file" );
|
|
|
36 |
binmode (DATA);
|
|
|
37 |
|
|
|
38 |
my $data;
|
|
|
39 |
read DATA, $data, 8;
|
|
|
40 |
|
|
|
41 |
my ($systemVer, $numDevTypes) = unpack( 'H8 N', $data );
|
|
|
42 |
|
|
|
43 |
print "SystemVer: $systemVer\n";
|
|
|
44 |
print "numDevTypes: $numDevTypes\n";
|
|
|
45 |
|
|
|
46 |
foreach my $dev ( 1 .. $numDevTypes )
|
|
|
47 |
{
|
|
|
48 |
my $device;
|
|
|
49 |
read DATA, $device, 24;
|
|
|
50 |
|
|
|
51 |
my ($devType, $Reserved, $Version, $Tier, $numMods, $deleteBitMap) =
|
|
|
52 |
unpack( 'A9 A1 H8 H8 N H4', $device );
|
|
|
53 |
print "Type; $devType, Version: $Version, Tier: $Tier, numMods: $numMods\n";
|
|
|
54 |
|
|
|
55 |
foreach my $mnum ( 1 .. $numMods )
|
|
|
56 |
{
|
|
|
57 |
my $module;
|
|
|
58 |
read DATA, $module, 20;
|
|
|
59 |
my ($Tag, $mVersion, $Crc, $Size, $Type, $Special, $mReserved) =
|
|
|
60 |
unpack ('A8 H4 H4 N H4', $module );
|
|
|
61 |
|
|
|
62 |
print " ($mnum) Tag: $Tag, Version: $mVersion, Size: $Size, Crc: $Crc, Type: $Type\n";
|
|
|
63 |
|
|
|
64 |
#
|
|
|
65 |
# Sanity test
|
|
|
66 |
#
|
|
|
67 |
last if ( $mnum > 1000 );
|
|
|
68 |
}
|
|
|
69 |
}
|
|
|
70 |
close (DATA);
|
|
|
71 |
}
|
|
|
72 |
|
|
|
73 |
|
|
|
74 |
#
|
|
|
75 |
# Process the MASSAPMV.CFG files
|
|
|
76 |
# Note done yet: Note this a THX file with data embedded within that structure
|
|
|
77 |
# Its not a simple data structure.
|
|
|
78 |
#
|
|
|
79 |
#foreach my $file ( glob ('*MASSAPMV*' ))
|
|
|
80 |
foreach my $file ( glob ('bb.bin' ))
|
|
|
81 |
{
|
|
|
82 |
Message("Processing $file" );
|
|
|
83 |
open (DATA , "<", $file ) || Error ("Can't open $file" );
|
|
|
84 |
binmode (DATA);
|
|
|
85 |
|
|
|
86 |
# my $data;
|
|
|
87 |
# read DATA, $data, 12;
|
|
|
88 |
# my ($filename) =
|
|
|
89 |
# unpack ('A12', $data );
|
|
|
90 |
# print "Filename: $filename\n";
|
|
|
91 |
#
|
|
|
92 |
# read DATA, $data, 20;
|
|
|
93 |
# read DATA, $data, 8;
|
|
|
94 |
#
|
|
|
95 |
#
|
|
|
96 |
my $data;
|
|
|
97 |
|
|
|
98 |
#
|
|
|
99 |
# Skip the ModHeadData + Embedded data
|
|
|
100 |
# There is a variable length name string in here too
|
|
|
101 |
# Really need to process the ModHeadData properly
|
|
|
102 |
#
|
|
|
103 |
read DATA, $data, 16 * 4; # Not too sure why
|
|
|
104 |
|
|
|
105 |
read DATA, $data, 24;
|
|
|
106 |
my ($devType, $Reserved, $Version, $Tier, $numMods, $deleteBitMap) =
|
|
|
107 |
unpack( 'A9 A1 H8 H8 N H4', $data );
|
|
|
108 |
print "Type; $devType, Version: $Version, Tier: $Tier, numMods: $numMods\n";
|
|
|
109 |
|
|
|
110 |
$numMods = 1000; # Number of Modules is always zero.
|
|
|
111 |
foreach my $mnum ( 1 .. $numMods )
|
|
|
112 |
{
|
|
|
113 |
|
|
|
114 |
#
|
|
|
115 |
# Documented but does not exist in the file
|
|
|
116 |
#
|
|
|
117 |
# read DATA, $data, 14;
|
|
|
118 |
# my ( $isDownloaded, $cdFilename ) = unpack ('H2 A14', $data );
|
|
|
119 |
# print "IsDnLoaded: $isDownloaded, cdFileName: $cdFilename\n";
|
|
|
120 |
|
|
|
121 |
last if (read (DATA, $data, 20) != 20 );
|
|
|
122 |
|
|
|
123 |
|
|
|
124 |
# my @hex = unpack ( 'H2' x 20, $data );
|
|
|
125 |
# print "\n-- @hex\n";
|
|
|
126 |
my ($Tag, $mVersion, $Crc, $Size, $Type, $Special, $mReserved) =
|
|
|
127 |
unpack ('A8 H4 H4 N H4', $data );
|
|
|
128 |
|
|
|
129 |
print " ($mnum) Tag: $Tag, Version: $mVersion, Size: $Size, Crc: $Crc, Type: $Type\n";
|
|
|
130 |
|
|
|
131 |
#
|
|
|
132 |
# Sanity test
|
|
|
133 |
#
|
|
|
134 |
last if ( $mnum > 1000 );
|
|
|
135 |
}
|
|
|
136 |
|
|
|
137 |
close (DATA);
|
|
|
138 |
}
|
|
|
139 |
|