add True Audio (TTA) codec
[kugel-rb.git] / tools / codecscan.pl
blobc21295d49f7aea6c9d3693652a144131d1fb5b60
1 #!/usr/bin/perl
3 $codecs="apps/codecs";
5 opendir(DIR, $codecs) || die "can't opendir $some_dir: $!";
6 my @maps = sort grep { /\.map/ && -f "$codecs/$_" } readdir(DIR);
7 closedir DIR;
9 print "Codec IRAM IBSS BSS Text \n";
12 for my $m (@maps) {
13 my ($iram, $ibss, $bss, $text)=scanmap($m);
14 printf("%-15s: %5d %5d %6d %6d\n",
15 $m, $iram, $ibss, $bss, $text);
18 sub scanmap {
19 my ($file)=@_;
21 open(F, "<$codecs/$file");
23 while(<F>) {
24 if(/[ \t]*0x([0-9a-f]+) *_plugin_start_addr/) {
25 #print "CODEC START: $1\n";
26 $codec = hex($1);
28 elsif(/[ \t]*0x([0-9a-f]+) *plugin_bss_start/) {
29 #print "CODEC BSS START: $1\n";
30 $codecbss = hex($1);
32 elsif(/[ \t]*0x([0-9a-f]+) *_plugin_end_addr/) {
33 #print "CODEC END: $1\n";
34 $bss = (hex($1) - $codecbss);
35 $codec = (hex($1) - $codec - $bss);
37 elsif(/[ \t]*0x([0-9a-f]+) *iramstart/) {
38 #print "IRAM START: $1\n";
39 $iram = hex($1);
41 elsif(/[ \t]*0x([0-9a-f]+) *iramend/) {
42 #print "IRAM END: $1\n";
43 $iram = (hex($1) - $iram);
45 elsif(/[ \t]*0x([0-9a-f]+) *iedata/) {
46 #print "IBSS START: $1\n";
47 $ibss = hex($1);
49 elsif(/[ \t]*0x([0-9a-f]+) *iend/) {
50 #print "IBSS END: $1\n";
51 $ibss = (hex($1) - $ibss);
55 close(F);
57 return ($iram, $ibss, $bss, $codec);