[PATCH 28/34] nios2/nios2_iss: Fix warnings

Joel Sherrill joel.sherrill at oarcorp.com
Mon Oct 20 20:34:30 UTC 2014


---
 c/src/lib/libbsp/nios2/nios2_iss/console/console.c | 54 ++++++----------------
 .../lib/libbsp/nios2/nios2_iss/startup/bspstart.c  |  5 +-
 c/src/lib/libbsp/nios2/nios2_iss/timer/timer.c     | 20 ++++----
 3 files changed, 28 insertions(+), 51 deletions(-)

diff --git a/c/src/lib/libbsp/nios2/nios2_iss/console/console.c b/c/src/lib/libbsp/nios2/nios2_iss/console/console.c
index 7e50874..9197c64 100644
--- a/c/src/lib/libbsp/nios2/nios2_iss/console/console.c
+++ b/c/src/lib/libbsp/nios2/nios2_iss/console/console.c
@@ -20,36 +20,28 @@
 #include <bsp/console-polled.h>
 #include <rtems/libio.h>
 
-/* #define JTAG_UART_REGS ((altera_avalon_jtag_uart_regs*)NIOS2_IO_BASE(JTAG_UART_BASE)) */
+/* #define JTAG_UART_REGS \
+        ((altera_avalon_jtag_uart_regs*)NIOS2_IO_BASE(JTAG_UART_BASE)) */
 
 /*  is_character_ready
  *
  *  If a character is available, this routine reads it and stores
- *  it in
- *  reads the character and stores
- *
- *  Input parameters: NONE
- *
- *  Output parameters:  NONE
- *
- *  Return values:
+ *  it in reads the character and stores
  */
-
-bool is_character_ready(
+static bool is_character_ready(
   char *ch
 )
 {
-    altera_avalon_jtag_uart_regs *ajur = NIOS2_IO_BASE(JTAG_UART_BASE);
-    unsigned int data = ajur->data;
+  altera_avalon_jtag_uart_regs *ajur = NIOS2_IO_BASE(JTAG_UART_BASE);
+  unsigned int data = ajur->data;
 
-    if (data & ALTERA_AVALON_JTAG_UART_DATA_RVALID_MSK)
-    {
-        *ch = (data & ALTERA_AVALON_JTAG_UART_DATA_DATA_MSK)
-              >> ALTERA_AVALON_JTAG_UART_DATA_DATA_OFST;
-        return true;
-    };
+  if (data & ALTERA_AVALON_JTAG_UART_DATA_RVALID_MSK) {
+    *ch = (data & ALTERA_AVALON_JTAG_UART_DATA_DATA_MSK)
+	  >> ALTERA_AVALON_JTAG_UART_DATA_DATA_OFST;
+    return true;
+  }
 
-    return false;
+  return false;
 }
 
 void console_initialize_hardware(void)
@@ -58,51 +50,36 @@ void console_initialize_hardware(void)
 
 /*
  *  This routine reads a character from the SOURCE.
- *
- *  Input parameters: NONE
- *
- *  Output parameters:  NONE
- *
- *  Return values:
- *    character read from SOURCE
  */
-
 int console_inbyte_nonblocking(
   int port
 )
 {
   char ch;
+
   /*
    *  Wait until a character is available.
    */
-
   if (is_character_ready(&ch))
     return ch;
   return -1;
 }
 
 /*
- *  This routine transmits a character out the SOURCE.  It may support
- *  XON/XOFF flow control.
- *
- *  Input parameters:
- *    ch  - character to be transmitted
- *
- *  Output parameters:  NONE
+ *  This routine transmits a character out the SOURCE.
  */
-
 void console_outbyte_polled(
   int  port,
   char ch
 )
 {
   altera_avalon_jtag_uart_regs *ajur = NIOS2_IO_BASE(JTAG_UART_BASE);
+
   /*
    *  Wait for the transmitter to be ready.
    *  Check for flow control requests and process.
    *  Then output the character.
    */
-
   while ((ajur->control & ALTERA_AVALON_JTAG_UART_CONTROL_WSPACE_MSK) == 0);
 
   ajur->data = ch;
@@ -114,7 +91,6 @@ void console_outbyte_polled(
 
 #include <rtems/bspIo.h>
 
-
 static void ISS_output_char(char c) { console_outbyte_polled( 0, c ); }
 
 BSP_output_char_function_type           BSP_output_char = ISS_output_char;
diff --git a/c/src/lib/libbsp/nios2/nios2_iss/startup/bspstart.c b/c/src/lib/libbsp/nios2/nios2_iss/startup/bspstart.c
index a465506..c619e58 100644
--- a/c/src/lib/libbsp/nios2/nios2_iss/startup/bspstart.c
+++ b/c/src/lib/libbsp/nios2/nios2_iss/startup/bspstart.c
@@ -16,10 +16,9 @@
 
 #include <sys/cdefs.h>
 
-#include <rtems.h>
-#include <rtems/score/nios2-utility.h>
-
 #include <bsp.h>
+#include <rtems/score/nios2-utility.h>
+#include <bsp/bootcard.h>
 
 void bsp_start( void )
 {
diff --git a/c/src/lib/libbsp/nios2/nios2_iss/timer/timer.c b/c/src/lib/libbsp/nios2/nios2_iss/timer/timer.c
index e37c821..fbb20d8 100644
--- a/c/src/lib/libbsp/nios2/nios2_iss/timer/timer.c
+++ b/c/src/lib/libbsp/nios2/nios2_iss/timer/timer.c
@@ -1,13 +1,15 @@
-/*  timer.c
- *
- *  This file manages the benchmark timer used by the RTEMS Timing Test
- *  Suite.  Each measured time period is demarcated by calls to
- *  benchmark_timer_initialize() and benchmark_timer_read().  benchmark_timer_read() usually returns
- *  the number of microseconds since benchmark_timer_initialize() exitted.
+/*
+ * This file manages the benchmark timer used by the RTEMS Timing Test
+ * Suite.  Each measured time period is demarcated by calls to
+ * benchmark_timer_initialize() and benchmark_timer_read(). 
+ * benchmark_timer_read() usually returns the number of microseconds
+ * since benchmark_timer_initialize() exitted.
  *
  *  NOTE: It is important that the timer start/stop overhead be
  *        determined when porting or modifying this code.
- *
+ */
+
+/*
  *  COPYRIGHT (c) 2005-2006 Kolja Waschk rtemsdev/ixo.de
  *  Derived from no_cpu/no_bsp/timer/timer.c 1.9,
  *  COPYRIGHT (c) 1989-1999.
@@ -30,7 +32,7 @@ bool benchmark_timer_find_average_overhead;
 
 #define TIMER_REGS ((altera_avalon_timer_regs*)NIOS2_IO_BASE(TIMER_BASE))
 
-void timerisr( void )
+static rtems_isr timerisr(rtems_vector_number vector)
 {
   TIMER_REGS->status = 0;
   Timer_interrupts++;
@@ -42,7 +44,7 @@ void benchmark_timer_initialize( void )
 
   TIMER_REGS->control = ALTERA_AVALON_TIMER_CONTROL_STOP_MSK;
 
-  set_vector((nios2_isr_entry *)timerisr, TIMER_VECTOR, 1);
+  set_vector(timerisr, TIMER_VECTOR, 1);
 
   /* Enable interrupt processing */
 
-- 
1.9.3



More information about the devel mailing list