aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/cx231xx
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2017-09-12 11:03:22 -0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-09-12 11:03:22 -0300
commit25f2a457f9a6615883a81c71c4e6d2dfe4f308b1 (patch)
treeedd5f8893d0eb4c9371d3d8dde977f6dedb6a4c0 /contrib/cx231xx
parentf07b90a87a92bd3df088c7f4a40fc46a26f7c630 (diff)
contrib: move parsers to a separate directory
In order to organize the tree, let's place the USB parsers on a separate directory. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'contrib/cx231xx')
-rwxr-xr-xcontrib/cx231xx/parse_cx231xx.pl197
-rwxr-xr-xcontrib/cx231xx/parse_cx231xx_tda18271.pl133
2 files changed, 0 insertions, 330 deletions
diff --git a/contrib/cx231xx/parse_cx231xx.pl b/contrib/cx231xx/parse_cx231xx.pl
deleted file mode 100755
index f6975bf7..00000000
--- a/contrib/cx231xx/parse_cx231xx.pl
+++ /dev/null
@@ -1,197 +0,0 @@
-#!/usr/bin/perl
-
-# Copyright (C) 2010 Mauro Carvalho Chehab
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# This small script parses register dumps generated by cx231xx driver
-# with debug options enabled, generating a source code with the results
-# of the dump.
-#
-# To use it, you may modprobe cx231xx with reg_debug=1, and do:
-# dmesg | ./parse_em28xx.pl
-#
-# Also, there are other utilities that produce similar outputs, and it
-# is not hard to parse some USB analyzers log into the expected format.
-#
-
-use strict;
-
-my %cfg_reg_map = (
- 0x0 => "BOARD_CFG_STAT",
- 0x4 => "TS_MODE_REG",
- 0x8 => "TS1_CFG_REG",
- 0xc => "TS1_LENGTH_REG",
- 0x10 => "TS2_CFG_REG",
- 0x14 => "TS2_LENGTH_REG",
- 0x18 => "EP_MODE_SET",
- 0x1c => "CIR_PWR_PTN1",
- 0x20 => "CIR_PWR_PTN2",
- 0x24 => "CIR_PWR_PTN3",
- 0x28 => "CIR_PWR_MASK0",
- 0x2c => "CIR_PWR_MASK1",
- 0x30 => "CIR_PWR_MASK2",
- 0x34 => "CIR_GAIN",
- 0x38 => "CIR_CAR_REG",
- 0x40 => "CIR_OT_CFG1",
- 0x44 => "CIR_OT_CFG2",
- 0x68 => "GBULK_BIT_EN",
- 0x74 => "PWR_CTL_EN",
-);
-
-sub parse_i2c($$$$$$)
-{
- my $reqtype = shift;
- my $req = shift;
- my $wvalue = shift;
- my $windex = shift;
- my $wlen = shift;
- my $payload = shift;
-
- my $daddr = $wvalue >> 9;
- my $reserved = ($wvalue >>6 ) & 0x07;
- my $period = ($wvalue >> 4) & 0x03;
- my $addr_len = ($wvalue >> 2) & 0x03;
- my $nostop = ($wvalue >>1) & 0x01;
- my $sync = $wvalue & 0x01;
-
- if ($nostop) {
- $nostop="nostop ";
- } else {
- $nostop="";
- }
- if ($sync) {
- $sync="sync ";
- } else {
- $sync="";
- }
- my $type;
- my $i2c_channel;
- if ($reqtype > 128) {
- $type = "IN ";
- $i2c_channel = $req - 4;
- } else {
- $type = "OUT";
- $i2c_channel = $req;
- }
- if ($period == 0) {
- $period = "1Mbps";
- } elsif ($period == 1) {
- $period = "400kbps";
- } elsif ($period == 2) {
- $period = "100kbps";
- } else {
- $period = "???kbps";
- }
- printf("$type i2c channel#%d daddr 0x%02x %s addr_len %d %s%slen %d = ",
- $i2c_channel, $daddr, $period, $addr_len, $nostop, $sync,
- $wlen);
- if ($addr_len == 1) {
- printf("(saddr)%02x ", $windex & 0xff);
- } elsif ($addr_len == 2) {
- printf("(saddr)%04x ", $windex);
- }
- printf("$payload\n");
-}
-
-sub parse_gpio($$$$$$)
-{
- my $reqtype = shift;
- my $req = shift;
- my $wvalue = shift;
- my $windex = shift;
- my $wlen = shift;
- my $payload = shift;
-
- my $type;
- if ($req == 8) {
- $type .= "SET gpio";
- } elsif ($req == 9) {
- $type .= "GET gpio";
- } elsif ($req == 0xa) {
- $type .= "SET gpie";
- } elsif ($req == 0xb) {
- $type .= "GET gpie";
- }
-
- my $gpio_bit = ($wvalue << 16) | $windex;
-
- $payload =~ s/([a-f\d].)\s([a-f\d].)\s([a-f\d].)\s([a-f\d].)/0x$4$3$2$1/;
-
- printf("$type: Reqtype %3d Req %3d len %d wvalue 0x%04x windex 0x%02x => direction=0x%04x val = %s\n",
- $reqtype, $req, $wlen, $wvalue, $windex, $gpio_bit, $payload);
-}
-
-while (<>) {
- tr/A-F/a-f/;
- if (m/([4c]0) ([0-9a-f].) ([0-9a-f].) ([0-9a-f].) ([0-9a-f].) ([0-9a-f].) ([0-9a-f].) ([0-9a-f].)[\<\>\s]+(.*)/) {
- my $reqtype = hex($1);
- my $req = hex($2);
- my $wvalue = hex("$4$3");
- my $windex = hex("$6$5");
- my $wlen = hex("$8$7");
- my $payload = $9;
-
- if ($reqtype > 128 && (($req >= 4) && ($req <= 6))) {
- parse_i2c($reqtype, $req, $wvalue, $windex, $wlen, $payload);
- } elsif ($req < 3) {
- parse_i2c($reqtype, $req, $wvalue, $windex, $wlen, $payload);
- } elsif ($req >= 8 && $req <= 0xb) {
- parse_gpio($reqtype, $req, $wvalue, $windex, $wlen, $payload);
- } elsif ($req == 0xc) {
- my $cfg_len;
- if ($wvalue == 1) {
- $cfg_len = 1;
- } elsif($wvalue == 3) {
- $cfg_len = 2;
- } elsif($wvalue == 7) {
- $cfg_len = 3;
- } elsif($wvalue == 0xf) {
- $cfg_len = 4;
- } else {
- printf("Invalid get len for ");
- printf("Reqtype: %3d, Req %3d, wValue: 0x%04x, wIndex 0x%04x, wlen %d: %s\n",
- $reqtype, $req, $wvalue, $windex, $wlen, $payload);
- }
-
- if ($cfg_len) {
- my $reg = $windex;
- $reg = $cfg_reg_map{$windex} if defined($cfg_reg_map{$windex});
-
- printf "cx231xx_write_ctrl_reg(dev, $reg, $payload, $cfg_len);\n";
- }
- } elsif ($req == 0xd) {
- my $cfg_len;
- if ($wvalue == 1) {
- $cfg_len = 1;
- } elsif($wvalue == 3) {
- $cfg_len = 2;
- } elsif($wvalue == 7) {
- $cfg_len = 3;
- } elsif($wvalue == 0xf) {
- $cfg_len = 4;
- } else {
- printf("Invalid get len for ");
- printf("Reqtype: %3d, Req %3d, wValue: 0x%04x, wIndex 0x%04x, wlen %d: %s\n",
- $reqtype, $req, $wvalue, $windex, $wlen, $payload);
- }
- if ($cfg_len) {
- my $reg = $windex;
- $reg = $cfg_reg_map{$windex} if defined($cfg_reg_map{$windex});
-
- printf "cx231xx_read_ctrl_reg(dev, $reg, $cfg_len);\t\t/* read %s */\n",
- $payload;
- }
- } else {
- printf("Reqtype: %3d, Req %3d, wValue: 0x%04x, wIndex 0x%04x, wlen %d: %s\n",
- $reqtype, $req, $wvalue, $windex, $wlen, $payload);
- }
- }
-}
diff --git a/contrib/cx231xx/parse_cx231xx_tda18271.pl b/contrib/cx231xx/parse_cx231xx_tda18271.pl
deleted file mode 100755
index 17c0cb94..00000000
--- a/contrib/cx231xx/parse_cx231xx_tda18271.pl
+++ /dev/null
@@ -1,133 +0,0 @@
-#!/usr/bin/perl
-
-# Copyright (C) 2016 Mauro Carvalho Chehab
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# This small script parses register dumps generated by parse_cx231xx.pl
-# for tda18271 tuner, like:
-# OUT i2c channel#2 daddr 0x60 100kbps addr_len 1 sync len 1 = (saddr)25 37 02
-
-use strict;
-
-my %tda18271_reg = (
- 0x00 => "ID byte (R_ID)",
- 0x01 => "Thermo byte (R_TM)",
- 0x02 => "Power level byte (R_PL)",
- 0x03 => "Easy Prog byte 1 (R_EP1)",
- 0x04 => "Easy Prog byte 2 (R_EP2)",
- 0x05 => "Easy Prog byte 3 (R_EP3)",
- 0x06 => "Easy Prog byte 4 (R_EP4)",
- 0x07 => "Easy Prog byte 5 (R_EP5)",
- 0x08 => "Cal Post-Divider byte (R_CPD)",
- 0x09 => "Cal Divider byte 1 (R_CD1)",
- 0x0a => "Cal Divider byte 2 (R_CD2)",
- 0x0b => "Cal Divider byte 3 (R_CD3)",
- 0x0c => "Main Post-Divider byte (R_MPD)",
- 0x0d => "Main Divider byte 1 (R_MD1)",
- 0x0e => "Main Divider byte 2 (R_MD2)",
- 0x0f => "Main Divider byte 3 (R_MD3)",
- 0x10 => "Extended byte 1 (R_EB1)",
- 0x11 => "Extended byte 2 (R_EB2)",
- 0x12 => "Extended byte 3 (R_EB3)",
- 0x13 => "Extended byte 4 (R_EB4)",
- 0x14 => "Extended byte 5 (R_EB5)",
- 0x15 => "Extended byte 6 (R_EB6)",
- 0x16 => "Extended byte 7 (R_EB7)",
- 0x17 => "Extended byte 8 (R_EB8)",
- 0x18 => "Extended byte 9 (R_EB9)",
- 0x19 => "Extended byte 10 (R_EB10)",
- 0x1a => "Extended byte 11 (R_EB11)",
- 0x1b => "Extended byte 12 (R_EB12)",
- 0x1c => "Extended byte 13 (R_EB13)",
- 0x1d => "Extended byte 14 (R_EB14)",
- 0x1e => "Extended byte 15 (R_EB15)",
- 0x1f => "Extended byte 16 (R_EB16)",
- 0x20 => "Extended byte 17 (R_EB17)",
- 0x21 => "Extended byte 18 (R_EB18)",
- 0x22 => "Extended byte 19 (R_EB19)",
- 0x23 => "Extended byte 20 (R_EB20)",
- 0x24 => "Extended byte 21 (R_EB21)",
- 0x25 => "Extended byte 22 (R_EB22)",
- 0x26 => "Extended byte 23 (R_EB23)",
-);
-
-
-# OUT i2c channel#2 daddr 0x60 100kbps addr_len 1 sync len 1 = (saddr)25 37 02
-
-my $mb86a20s_cont;
-
-while (<>) {
- my $org_line = $_;
-
- if (m/(IN|OUT)\s+i2c\s+channel#\d\s+daddr\s+0x10.*\=\s*\(saddr\)([\da-f].)\s+(.*)/) {
- my $type = $1;
- my $reg = $2;
- my $val = $3;
- my $err = "";
-
- if ($val =~ s/eRROR (.*)//) {
- $err = "\t// ERROR $1";
- }
-
- if ($reg eq "08" && $val eq "01") {
- print "\t// INCOMPLETE!!!\n" if ($mb86a20s_cont);
- printf "\n";
- $mb86a20s_cont = 0;
- }
-
- printf "(%-3s)mb86a20s:\t", $type if (!$mb86a20s_cont);
-
- if ($type eq "OUT") {
- printf "{ 0x%s, 0x%s },", $reg, $val;
- } else {
- printf "{ 0x%s } = 0x%s,", $reg, $val;
- }
-
- if ($reg eq "04" || $reg eq "50" ||
- $reg eq "28" || $reg eq "29" || $reg eq "2a") {
- print " ";
- $mb86a20s_cont = 1;
- } else {
- $mb86a20s_cont = 0;
- print "$err\n";
- }
- }
-
- if (m/(IN|OUT)\s+i2c\s+channel#\d\s+daddr\s+0x60.*\=\s*\(saddr\)([\da-f].)\s+(.*)/) {
- my $type = $1;
- my $vals = $3;
- my $regval = hex($2);
- my $err = "";
-
- if ($vals =~ s/eRROR (.*)//) {
- $err = "\t// ERROR $1";
- }
-
-
- print "\t// INCOMPLETE!!!\n" if ($mb86a20s_cont);
-
- my $j = 0;
- while ($j + 2 <= length($vals)) {
- my $reg;
- my $val = hex(substr($vals, $j, 2));
-
- if (defined($tda18271_reg{$regval})) {
- $reg = $tda18271_reg{$regval};
- } else {
- $reg = sprintf "REG 0x%02x", $regval;
- }
- printf "(%-3s)tda18271_dump_regs: %s = 0x%02x$err\n", $type, $reg, $val;
- $regval++;
- $j += 3;
- }
- }
- print $_ if (m/cx231xx/);
-}

Privacy Policy