MOXA linux-2.6.x / linux-2.6.19-uc1 from UC-7110-LX-BOOTLOADER-1.9_VERSION-4.2.tgz
[linux-2.6.19-moxart.git] / arch / nios2nommu / scripts / PTF / SystemPTF / CPU.pm
blobea10598668dc59c5f98dc85399e6711cb8b3b48e
1 package CPU;
3 use PTF::PTFSection;
5 sub new {
6 my $invocant = shift;
7 my $class = ref($invocant) || $invocant;
8 my $self = {
9 @_,
12 # if no ptf section was passed in, then return undef
13 $self->{ptf} or return;
15 bless ($self, $class);
16 return $self;
19 sub getClass {
20 my ($self) = @_;
22 return $self->{ptf}->getAssignment ('class');
25 sub getVersion {
26 my ($self) = @_;
28 return $self->{ptf}->getAssignment ('class_version');
31 sub getConstant {
32 my ($self, $name) = @_;
34 # get WSA
35 $wsa = $self->{ptf}->getSection('WIZARD_SCRIPT_ARGUMENTS', '');
36 $wsa or return;
38 # get constants section
39 $constants = $wsa->getSection('CONSTANTS', '');
40 $constants or return;
42 # get section for specific constant
43 $constant = $constants->getSection ('CONSTANT', $name);
44 $constant or return;
46 # get value of constant
47 $value = $constant->getAssignment ('value');
48 return $value;
51 sub getWSAAssignment {
52 my ($self, $name) = @_;
54 # get WSA
55 $wsa = $self->{ptf}->getSection('WIZARD_SCRIPT_ARGUMENTS', '');
56 $wsa or return;
58 # get value of WSA Assignment
59 $value = $wsa->getAssignment ($name);
60 return $value;
63 sub getResetLocationOffset {
64 my ($self) = @_;
66 $wsa = $self->{ptf}->getSection('WIZARD_SCRIPT_ARGUMENTS', '');
67 $wsa or return;
69 my $location = $wsa->getAssignment ('reset_slave');
70 my $offset = $wsa->getAssignment ('reset_offset');
72 return ($location, $offset);
75 sub isEnabled {
76 my ($self) = @_;
78 $sbi = $self->{ptf}->getSection('SYSTEM_BUILDER_INFO', '');
79 $sbi or return;
81 my $enabled = $sbi->getAssignment ('Is_Enabled');
82 if ($enabled eq "1") {
83 return 1;
84 } else {
85 return 0;