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 / nios2_system.h / altera_avalon_pio.pm
blobafdbcae3682e6ffa157c5a9f835a47c1f705e83f
1 package altera_avalon_pio;
3 require PTF::SystemPTF;
4 require PTF::SystemPTF::Module;
5 use strict;
7 sub run {
8 my ($system, @pio_names) = @_;
10 print "#ifndef __ASSEMBLY__\n";
11 print "#include <asm/pio_struct.h>\n";
12 print "#endif\n\n";
14 foreach my $pio_name (@pio_names) {
15 my $module = $system->getModule ($pio_name);
17 # get all the relevant information
18 my $base_address = $module->getBaseAddress ();
19 $base_address = hex ($base_address) | 0x80000000;
20 my $irq = $module->getIRQ ();
22 print "/* Casting base addresses to the appropriate structure */\n";
24 # undefine all the old symbols first
25 print "#undef na_${pio_name}\n";
26 if (defined ($irq)) {
27 print "#undef na_${pio_name}_irq\n";
28 print "\n";
31 # define base address
32 $base_address = sprintf ("%#010x", $base_address);
33 printf ("%-41s %30s\n", "#define na_${pio_name}",
34 "((np_pio*) ${base_address})");
36 # define irq
37 if (defined ($irq)) {
38 printf ("%-41s %30s\n", "#define na_${pio_name}_irq",
39 $irq);
42 print "\n";