build mimo version of the broadcom wl driver as well
[openwrt.git] / package / broadcom-wl / src / kmod / patchtable.pl
1 #!/usr/bin/perl
2 use strict;
3
4 my $TABLE = pack("V", 0xbadc0ded);
5 my $TABLE_SIZE = 512;
6 my $SLT1 = "\x01\x00\x00\x00";
7 my $SLT2 = "\x02\x00\x00\x00";
8 my $ACKW = "\x03\x00\x00\x00";
9 my $PTABLE_END = "\xff\xff\xff\xff";
10
11 my $addr = "";
12 my $opcode = "";
13 my $function = "";
14
15 sub add_entry {
16 my $key = shift;
17 my $value = shift;
18 my $default = shift;
19
20 $TABLE .= $key;
21 $TABLE .= pack("V", $value);
22 $TABLE .= pack("V", $default);
23 }
24
25 while (<>) {
26 $addr = $opcode = "";
27 /^\w{8}\s*<(.*)>:$/ and $function = $1;
28 /^\s*(\w+):\s*(\w{8})\s*/ and do {
29 $addr = $1;
30 $opcode = $2;
31 };
32
33 ($function eq 'wlc_update_slot_timing') and do {
34 # li a2,9 -- short slot time
35 ($opcode eq '24060009') and add_entry($SLT1, hex($addr), hex($opcode));
36 # li v0,519 -- 510 + short slot time
37 ($opcode eq '24020207') and add_entry($SLT2, hex($addr), hex($opcode));
38
39 # li a2,20 -- long slot time
40 ($opcode eq '24060014') and add_entry($SLT1, hex($addr), hex($opcode));
41 # li v0,530 -- 510 + long slot time
42 ($opcode eq '24020212') and add_entry($SLT2, hex($addr), hex($opcode));
43 };
44 ($function eq 'wlc_d11hdrs') and do {
45 # ori s6,s6,0x1 -- ack flag (new)
46 ($opcode eq '36d60001') and add_entry($ACKW, hex($addr), hex($opcode));
47 # ori s3,s3,0x1 -- ack flag (old)
48 ($opcode eq '36730001') and add_entry($ACKW, hex($addr), hex($opcode));
49 }
50 }
51
52 $TABLE .= $PTABLE_END;
53 $TABLE .= ("\x00" x ($TABLE_SIZE - length($TABLE)));
54 print $TABLE;
This page took 0.053484 seconds and 5 git commands to generate.