Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

Linux kernel patch to use FIFOed Avalon Uart

This patch is needed to generate nios2_system.h correctly when using fifoed avalon uart (http://www.niosforum.com/pages/project_details.php?p_id=89&t_id=18)

--- ../uClinux-dist-nios2/linux-2.6.x/arch/nios2nommu/scripts/nios2_system.h/fifoed_avalon_uart.pm      1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.x/arch/nios2nommu/scripts/nios2_system.h/fifoed_avalon_uart.pm    2007-03-09 12:36:34.000000000 +0100
@@ -0,0 +1,44 @@
+package fifoed_avalon_uart;
+
+use base qw(BasicModule);
+use strict;
+
+sub required_module_names {
+       ("uart0", "uart1", "uart2", "uart3")
+}
+
+sub required_class_name {
+       "fifoed_avalon_uart";
+}
+
+sub base_address_cast {
+       "np_uart"
+}
+
+sub print_prefix {
+       my ($class, $system) = @_;
+
+       print "#ifndef __ASSEMBLY__\n";
+       print "#include <asm/uart_struct.h>\n";
+       print "#endif\n\n";
+}
+
+sub translate {
+       my $class = shift;
+       my ($system, $required_module_name, $module_name) = @_;
+
+       $class->SUPER::translate (@_);
+
+       if (!defined ($fifoed_avalon_uart::default_uart)) {
+               print "/* The default uart is always the first one found in the PTF file */\n";
+               print "#define nasys_printf_uart na_$required_module_name\n\n";
+               $fifoed_avalon_uart::default_uart = $required_module_name;
+       }
+
+}
+
+sub run {
+       fifoed_avalon_uart->run2 (@_);
+}
+
+1;

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Great!! and Thanks a lot.

    I checked in my local svn, and will update the wiki next.