aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2010-12-07 13:42:38 -0200
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-12-07 13:42:38 -0200
commit4edcb2e3fdc2f68deac715bf63993d79522ba44b (patch)
treec9a8892b5ddab0e18ff44f4d1e15a7ed8d3d3560
parentbf3bec79b6d2075426976609374cff9ed62eaf6a (diff)
parse_sn9c201.pl: Add a handler for register aliases
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rwxr-xr-xcontrib/sn9c201/parse_sn9c201.pl25
1 files changed, 23 insertions, 2 deletions
diff --git a/contrib/sn9c201/parse_sn9c201.pl b/contrib/sn9c201/parse_sn9c201.pl
index 34cbf806..c8aa3f1e 100755
--- a/contrib/sn9c201/parse_sn9c201.pl
+++ b/contrib/sn9c201/parse_sn9c201.pl
@@ -26,6 +26,19 @@ use Getopt::Long;
my $debug = 0;
GetOptions('d' => \$debug);
+# FIXME: How to handle multiple registers being changed at the same time?
+
+my %reg_map = (
+ 0x1180 => "SN9C201_R1180_HSTART_LOW",
+ 0x1181 => "SN9C201_R1181_HSTART_HIGH",
+ 0x1182 => "SN9C201_R1182_VSTART_LOW",
+ 0x1183 => "SN9C201_R1183_VSTART_HIGH",
+ 0x1184 => "SN9C201_R1184_HSIZE"
+ 0x1185 => "SN9C201_R1184_VSIZE"
+ 0x11b8 => "SN9C201_R11B8_CLK_CTRL",
+);
+
+
sub i2c_reg($)
{
my %decode;
@@ -173,10 +186,18 @@ while (<>) {
} else {
printf("%s, Req %3d, wValue: 0x%04x, wIndex 0x%04x, wlen %d: %s\n",
type_req($reqtype), $req, $wvalue, $windex, $wlen, $payload) if ($debug);
+
+ my $reg;
+ if (defined($reg_map{$wvalue})) {
+ $reg = $reg_map{$wvalue};
+ } else {
+ $reg = sprintf "0x%04x", $wvalue;
+ }
+
if ($reqtype == 0xc1) {
- printf "reg_r(gspcadev, 0x%04x);\t/* read %s*/\n", $wvalue, $payload;
+ printf "reg_r(gspcadev, %s);\t/* read %s*/\n", $reg, $payload;
} elsif ($reqtype == 0x41) {
- printf "reg_w(gspcadev, 0x%04x, { %s });*/\n", $wvalue, $payload;
+ printf "reg_w(gspcadev, %s, { %s });*/\n", $reg, $payload;
}
}
}

Privacy Policy