From 92ce2849695350a1ce477eb07e9f5465547e1305 Mon Sep 17 00:00:00 2001 From: n1481 Date: Fri, 2 Dec 2011 08:19:29 +0000 Subject: [PATCH] =?UTF-8?q?=E3=83=AD=E3=82=B8=E3=82=A2=E3=83=8A=E3=81=AE?= =?UTF-8?q?=E3=82=AB=E3=83=BC=E3=83=89=E3=83=90=E3=82=B9=E8=A6=B3=E6=B8=AC?= =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=82=92=E3=82=A2=E3=82=AF?= =?UTF-8?q?=E3=82=BB=E3=82=B9=E3=83=AD=E3=82=B0=E3=81=AB=E5=A4=89=E6=8F=9B?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=83=84=E3=83=BC=E3=83=AB=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlToolsRED@577 7061adef-622a-194b-ae81-725974e89856 --- .../AccessLogConverter/read_command_text.bat | 3 + .../AccessLogConverter/read_command_text.pl | 67 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 build/tools/AccessLogConverter/read_command_text.bat create mode 100755 build/tools/AccessLogConverter/read_command_text.pl diff --git a/build/tools/AccessLogConverter/read_command_text.bat b/build/tools/AccessLogConverter/read_command_text.bat new file mode 100644 index 0000000..2c0d5e0 --- /dev/null +++ b/build/tools/AccessLogConverter/read_command_text.bat @@ -0,0 +1,3 @@ +C:\cygwin\bin\perl.exe "%~dp0read_command_text.pl" "%~1" > "%~dpn1_out.txt" + +pause \ No newline at end of file diff --git a/build/tools/AccessLogConverter/read_command_text.pl b/build/tools/AccessLogConverter/read_command_text.pl new file mode 100755 index 0000000..c2b832e --- /dev/null +++ b/build/tools/AccessLogConverter/read_command_text.pl @@ -0,0 +1,67 @@ +#!/usr/bin/perl -- + +use strict; + +my $file = $ARGV[0] or die "Usage: $0 [TXT File]\n\n"; + +open IN, $file or die "Cannot open $file.\n"; + +my $start = 0; +my $size = 0; + +my $step = 0; +my $addr = 0; + +my $bkup = 0; + +while () { + my @data = split /\t/; + # pre-read + if ( $step == 0 ) { + $step = 1 if ( $data[2] == 1 && $data[3] == 1 ); + # backup access + if ( $data[2] == 1 && $data[3] == 0 ) + { + $bkup = 1; + } + } + # read + elsif ( $step == 1 ) { + if ( $data[4] =~ /B7/ ) { + $step++; + $addr = 0; # initialize + } else { + $step = 0; # restart + } + } + # first address + elsif ( $step == 2 || $step == 3 || $step == 4 || $step == 5 ) { + $addr = $addr*256 + hex($data[4]); + if ( $step == 5 ) { + if ( $start + $size == $addr && $bkup == 0 ) { + $size += 512; + } else { + printf "Read: 0x%08x-0x%08x (%6d bytes)\n", $start, $start+$size-1, $size if ($start); + $start = $addr; + $size = 512; + if ( $bkup == 1 ) { + print "<>\n" ; + $bkup = 0; + } + } + $step = 0; # restart + } else { + $step++; + } + } +} +close IN; + +if ($start) { + printf "Read: 0x%08x-0x%08x (%6d bytes)\n", $start, $start+$size-1, $size +} else { + printf "Never read.\n"; +} +if ( $bkup == 1 ) { + print "<>\n" ; +}