1 |
16 |
alirezamon |
use warnings;
|
2 |
|
|
use strict;
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
package wb_addr;
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
sub wb_addr_new {
|
12 |
|
|
# be backwards compatible with non-OO call
|
13 |
|
|
my $class = ("ARRAY" eq ref $_[0]) ? "wb_addr" : shift;
|
14 |
|
|
my $self;
|
15 |
|
|
|
16 |
|
|
$self = {};
|
17 |
|
|
wb_add_all_addr($self);
|
18 |
|
|
|
19 |
|
|
bless($self,$class);
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
return $self;
|
23 |
|
|
}
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
sub wb_add_all_addr{
|
27 |
|
|
my $self=shift;
|
28 |
|
|
wb_add_addr($self,'0xf000_0000', '0xffff_ffff ', 'Cached', 256, 'ROM');
|
29 |
|
|
wb_add_addr($self,'0xb800_0000', '0xbfff_ffff', 'Uncached', 128, 'custom devices');
|
30 |
|
|
wb_add_addr($self,'0xa600_0000', '0xb7ff_ffff', 'Uncached', 288, 'Reserved1');
|
31 |
|
|
wb_add_addr($self,'0xa500_0000', '0xa5ff_ffff', 'Uncached', 16, 'Debug');
|
32 |
|
|
wb_add_addr($self,'0xa400_0000', '0xa4ff_ffff', 'Uncached', 16, 'Digital Camera Ctrl');
|
33 |
|
|
wb_add_addr($self,'0xa300_0000', '0xa3ff_ffff', 'Uncached', 16, 'I2C Controller');
|
34 |
|
|
wb_add_addr($self,'0xa200_0000', '0xa2ff_ffff', 'Uncached', 16, 'TDM Controller');
|
35 |
|
|
wb_add_addr($self,'0xa100_0000', '0xa1ff_ffff', 'Uncached', 16, 'HDLC Controller');
|
36 |
|
|
wb_add_addr($self,'0xa000_0000', '0xa0ff_ffff', 'Uncached', 16, 'Real-Time Clock');
|
37 |
|
|
wb_add_addr($self,'0x9f00_0000', '0x9fff_ffff', 'Uncached', 16, 'Firewire Controller');
|
38 |
|
|
wb_add_addr($self,'0x9e00_0000', '0x9eff_ffff', 'Uncached', 16, 'IDE Controller');
|
39 |
|
|
wb_add_addr($self,'0x9d00_0000', '0x9dff_ffff', 'Uncached', 16, 'Audio Controller');
|
40 |
|
|
wb_add_addr($self,'0x9c00_0000', '0x9cff_ffff', 'Uncached', 16, 'USB Host Controller');
|
41 |
|
|
wb_add_addr($self,'0x9b00_0000', '0x9bff_ffff', 'Uncached', 16, 'USB Func Controller');
|
42 |
|
|
wb_add_addr($self,'0x9a00_0000', '0x9aff_ffff', 'Uncached', 16, 'General-Purpose DMA');
|
43 |
|
|
wb_add_addr($self,'0x9900_0000', '0x99ff_ffff', 'Uncached', 16, 'PCI Controller');
|
44 |
|
|
wb_add_addr($self,'0x9800_0000', '0x98ff_ffff', 'Uncached', 16, 'IrDA Controller');
|
45 |
|
|
wb_add_addr($self,'0x9700_0000', '0x97ff_ffff', 'Uncached', 16, 'Graphics Controller');
|
46 |
|
|
wb_add_addr($self,'0x9600_0000', '0x96ff_ffff', 'Uncached', 16, 'PWM/Timer/Counter Ctrl');
|
47 |
|
|
wb_add_addr($self,'0x9500_0000', '0x95ff_ffff', 'Uncached', 16, 'Traffic COP');
|
48 |
|
|
wb_add_addr($self,'0x9400_0000', '0x94ff_ffff', 'Uncached', 16, 'PS/2 Controller');
|
49 |
|
|
wb_add_addr($self,'0x9300_0000', '0x93ff_ffff', 'Uncached', 16, 'Memory Controller');
|
50 |
|
|
wb_add_addr($self,'0x9200_0000', '0x92ff_ffff', 'Uncached', 16, 'Ethernet Controller');
|
51 |
|
|
wb_add_addr($self,'0x9100_0000', '0x91ff_ffff', 'Uncached', 16, 'General-Purpose I/O');
|
52 |
|
|
wb_add_addr($self,'0x9000_0000', '0x90ff_ffff', 'Uncached', 16, 'UART16550 Controller');
|
53 |
|
|
wb_add_addr($self,'0x8000_0000', '0x8fff_ffff', 'Uncached', 256, 'PCI I/O');
|
54 |
|
|
wb_add_addr($self,'0x4000_0000', '0x7fff_ffff', 'Uncached', 1024, 'Reserved2');
|
55 |
|
|
wb_add_addr($self,'0x0000_0000','0x3fff_ffff', 'Cached', 1024, 'RAM');
|
56 |
|
|
|
57 |
|
|
}
|
58 |
|
|
|
59 |
|
|
|
60 |
|
|
sub wb_add_addr{
|
61 |
|
|
my($self,$start,$end,$cashed,$size,$name)=@_;
|
62 |
|
|
$self->{names}{$name}={};
|
63 |
|
|
$self->{names}{$name}{start}=$start;
|
64 |
|
|
$self->{names}{$name}{end}=$end;
|
65 |
|
|
$self->{names}{$name}{cashed}=$cashed;
|
66 |
|
|
$self->{names}{$name}{size}=$size;
|
67 |
|
|
|
68 |
|
|
}
|
69 |
|
|
|
70 |
|
|
sub wb_list_names{
|
71 |
|
|
my($self)=@_;
|
72 |
|
|
my @names;
|
73 |
|
|
foreach my $n ( keys %{$self->{names}}){
|
74 |
|
|
push (@names,$n);
|
75 |
|
|
}
|
76 |
|
|
return @names;
|
77 |
|
|
|
78 |
|
|
}
|
79 |
|
|
|
80 |
|
|
|
81 |
|
|
sub wb_get_addr_info{
|
82 |
|
|
my($self,$name)=@_;
|
83 |
|
|
my($start,$end,$cashed,$size);
|
84 |
|
|
if(exists ($self->{names}{$name})){
|
85 |
|
|
$start =$self->{names}{$name}{start};
|
86 |
|
|
$end =$self->{names}{$name}{end};
|
87 |
|
|
$cashed =$self->{names}{$name}{cashed};
|
88 |
|
|
$size =$self->{names}{$name}{size};
|
89 |
|
|
}
|
90 |
|
|
return ($start,$end,$cashed,$size);
|
91 |
|
|
|
92 |
|
|
}
|
93 |
|
|
|
94 |
|
|
1;
|