summaryrefslogtreecommitdiff
path: root/package/broadcom-wl/src/kmod/patchtable.pl
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2006-10-13 22:51:49 +0200
committerFelix Fietkau <nbd@openwrt.org>2016-03-20 17:29:15 +0100
commit60c1f0f64d23003a19a07d6b9638542130f6641d (patch)
tree8fb2787f4c49baded97cd55e0c371fe1cffce2b6 /package/broadcom-wl/src/kmod/patchtable.pl
parentd58a09110ccfa95f06c983fe796806f2e035c9d2 (diff)
parentb3ce218b51746d3a576221ea542facf3a1703ab2 (diff)
downloadmtk-20170518-60c1f0f64d23003a19a07d6b9638542130f6641d.zip
mtk-20170518-60c1f0f64d23003a19a07d6b9638542130f6641d.tar.gz
mtk-20170518-60c1f0f64d23003a19a07d6b9638542130f6641d.tar.bz2
finally move buildroot-ng to trunk
Diffstat (limited to 'package/broadcom-wl/src/kmod/patchtable.pl')
-rw-r--r--package/broadcom-wl/src/kmod/patchtable.pl61
1 files changed, 61 insertions, 0 deletions
diff --git a/package/broadcom-wl/src/kmod/patchtable.pl b/package/broadcom-wl/src/kmod/patchtable.pl
new file mode 100644
index 0000000..6999735
--- /dev/null
+++ b/package/broadcom-wl/src/kmod/patchtable.pl
@@ -0,0 +1,61 @@
+#!/usr/bin/perl
+#
+# Copyright (C) 2006 OpenWrt.org
+# Copyright (C) 2006 Felix Fietkau
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+use strict;
+
+my $TABLE = pack("V", 0xbadc0ded);
+my $TABLE_SIZE = 512;
+my $SLT1 = "\x01\x00\x00\x00";
+my $SLT2 = "\x02\x00\x00\x00";
+my $ACKW = "\x03\x00\x00\x00";
+my $PTABLE_END = "\xff\xff\xff\xff";
+
+my $addr = "";
+my $opcode = "";
+my $function = "";
+
+sub add_entry {
+ my $key = shift;
+ my $value = shift;
+ my $default = shift;
+
+ $TABLE .= $key;
+ $TABLE .= pack("V", $value);
+ $TABLE .= pack("V", $default);
+}
+
+while (<>) {
+ $addr = $opcode = "";
+ /^\w{8}\s*<(.*)>:$/ and $function = $1;
+ /^\s*(\w+):\s*(\w{8})\s*/ and do {
+ $addr = $1;
+ $opcode = $2;
+ };
+
+ ($function eq 'wlc_update_slot_timing') and do {
+ # li a2,9 -- short slot time
+ ($opcode eq '24060009') and add_entry($SLT1, hex($addr), hex($opcode));
+ # li v0,519 -- 510 + short slot time
+ ($opcode eq '24020207') and add_entry($SLT2, hex($addr), hex($opcode));
+
+ # li a2,20 -- long slot time
+ ($opcode eq '24060014') and add_entry($SLT1, hex($addr), hex($opcode));
+ # li v0,530 -- 510 + long slot time
+ ($opcode eq '24020212') and add_entry($SLT2, hex($addr), hex($opcode));
+ };
+ ($function eq 'wlc_d11hdrs') and do {
+ # ori s6,s6,0x1 -- ack flag (new)
+ ($opcode eq '36d60001') and add_entry($ACKW, hex($addr), hex($opcode));
+ # ori s3,s3,0x1 -- ack flag (old)
+ ($opcode eq '36730001') and add_entry($ACKW, hex($addr), hex($opcode));
+ }
+}
+
+$TABLE .= $PTABLE_END;
+$TABLE .= ("\x00" x ($TABLE_SIZE - length($TABLE)));
+print $TABLE;