[PATCH 34/62] bfin libcpu and libbsp: Fix warnings

Joel Sherrill joel.sherrill at oarcorp.com
Wed Oct 15 20:00:24 UTC 2014


---
 c/src/lib/libbsp/bfin/TLL6527M/include/bsp.h       |  43 +++-
 c/src/lib/libbsp/bfin/TLL6527M/startup/bspstart.c  | 127 ++++-------
 c/src/lib/libbsp/bfin/bf537Stamp/console/console.c |   4 +-
 c/src/lib/libbsp/bfin/bf537Stamp/include/bsp.h     |  13 +-
 .../lib/libbsp/bfin/bf537Stamp/startup/bspstart.c  |   2 -
 c/src/lib/libbsp/bfin/eZKit533/include/bsp.h       |  33 ++-
 c/src/lib/libbsp/bfin/eZKit533/startup/bspstart.c  |  92 +++-----
 c/src/lib/libbsp/bfin/shared/start/start.S         |   5 +-
 c/src/lib/libcpu/bfin/clock/clock.c                |   2 +-
 c/src/lib/libcpu/bfin/clock/rtc.c                  |   3 +-
 c/src/lib/libcpu/bfin/serial/uart.c                | 234 ++++++---------------
 cpukit/score/cpu/bfin/rtems/bfin/bfin.h            |   1 +
 12 files changed, 223 insertions(+), 336 deletions(-)

diff --git a/c/src/lib/libbsp/bfin/TLL6527M/include/bsp.h b/c/src/lib/libbsp/bfin/TLL6527M/include/bsp.h
index ab57435..6efc30e 100644
--- a/c/src/lib/libbsp/bfin/TLL6527M/include/bsp.h
+++ b/c/src/lib/libbsp/bfin/TLL6527M/include/bsp.h
@@ -1,25 +1,23 @@
 /**
- * @file
+ * @file bsp.h
  * @ingroup bfin_tll6527m
  * @brief Global BSP definitions.
+ *
+ * This include file contains all board IO definitions for TLL6527M.
  */
 
-/**
- *@file bsp.h
- *  
- *  This include file contains all board IO definitions for TLL6527M.
- *
+/*
  * COPYRIGHT (c) 2010 by ECE Northeastern University.
  *
  * The license and distribution terms for this file may be
  * found in the file LICENSE in this distribution or at
  * http://www.rtems.org/license
  */
- 
 
 #ifndef _BSP_H
 #define _BSP_H
 
+#ifndef ASM
 
 #ifdef __cplusplus
 extern "C" {
@@ -95,16 +93,39 @@ extern "C" {
 
 /** @} */
 
-rtems_isr_entry set_vector(                     ///< @brief returns old vector */
-  rtems_isr_entry     handler,                  ///< @brief isr routine        */
-  rtems_vector_number vector,                   ///< @brief vector number      */
-  int                 type                      ///< @brief RTEMS or RAW intr  */
+/**
+ * @brief Install an interrupt handler
+ *
+ * This method installs an interrupt handle.
+ *
+ * @param[in] handler is the isr routine
+ * @param[in] vector is the vector number
+ * @param[in] type indicates whether RTEMS or RAW intr
+ *
+ * @return returns old vector
+ */
+rtems_isr_entry set_vector(
+  rtems_isr_entry     handler,
+  rtems_vector_number vector,
+  int                 type
 );
 
+/*
+ *  Internal BSP methods that are used across file boundaries
+ */
+void Init_RTC(void);
+
+/*
+ * Prototype for methods in .S files that are referenced from C.
+ */
+void bfin_null_isr(void);
+
 /** @} */
 
 #ifdef __cplusplus
 }
 #endif
 
+#endif /* !ASM */
+
 #endif
diff --git a/c/src/lib/libbsp/bfin/TLL6527M/startup/bspstart.c b/c/src/lib/libbsp/bfin/TLL6527M/startup/bspstart.c
index 38c2df4..335e646 100644
--- a/c/src/lib/libbsp/bfin/TLL6527M/startup/bspstart.c
+++ b/c/src/lib/libbsp/bfin/TLL6527M/startup/bspstart.c
@@ -1,6 +1,6 @@
 /*  bspstart.c for TLL6527M
  *
- *  This routine does the bulk of the system initialisation.
+ *  This routine does the bulk of the system initialization.
  */
 
 /*
@@ -11,7 +11,6 @@
  * http://www.rtems.org/license
  */
 
-
 #include <bsp.h>
 #include <bsp/bootcard.h>
 #include <cplb.h>
@@ -61,62 +60,12 @@ const unsigned int _icplbs_table[16][2] = {
   { 0xffffffff, 0xffffffff }/* end of section - termination */
 };
 
-void Init_PLL (void);
-void Init_EBIU (void);
-void Init_Flags(void);
-void Init_RTC (void);
-void initCPLB(void);
-
-
-void null_isr(void);
-
 /*
- *  Function:   bsp_pretasking_hook
- *  Created:    95/03/10
- *
- *  Description:
- *      BSP pretasking hook.  Called just before drivers are initialized.
- *      Used to setup libc and install any BSP extensions.
- *
- *  NOTES:
- *      Must not use libc (to do io) from here, since drivers are
- *      not yet initialized.
- *
+ * Init_PLL
+ * 
+ * Routine to initialize the PLL. The TLL6527M uses a 25 Mhz XTAL.
  */
-
-void bsp_pretasking_hook(void)
-{
-  bfin_interrupt_init();
-}
-
-void bsp_start( void )
-{
-  /* BSP Hardware Initialization*/
-  Init_RTC();   /* Blackfin Real Time Clock initialization */  
-  Init_PLL();   /* PLL initialization */
-  Init_EBIU();  /* EBIU initialization */
-  Init_Flags(); /* GPIO initialization */
-
-  /*
-   *  Allocate the memory for the RTEMS Work Space.  This can come from
-   *  a variety of places: hard coded address, malloc'ed from outside
-   *  RTEMS world (e.g. simulator or primitive memory manager), or (as
-   *  typically done by stock BSPs) by subtracting the required amount
-   *  of work space from the last physical address on the CPU board.
-   */
-  int i=0;
-  for (i=5;i<16;i++) {
-    set_vector((rtems_isr_entry)null_isr, i, 1);
-  }
-  
-}
-
- /*
-  * Init_PLL
-  * 
-  * Routine to initialize the PLL. The TLL6527M uses a 25 Mhz XTAL.
-  */
-void Init_PLL (void)
+static void Init_PLL (void)
 {
   unsigned short msel = 0;
   unsigned short ssel = 0;
@@ -138,13 +87,12 @@ void Init_PLL (void)
   asm("sti r0;");
 }
 
- /*
-  * Init_EBIU
-  * 
-  * Configure extern memory
-  */
-
-void Init_EBIU (void)
+/*
+ * Init_EBIU
+ * 
+ * Configure extern memory
+ */
+static void Init_EBIU (void)
 {
   /* Check if SDRAM is already enabled */
   if ( 0 != (*(uint16_t *)EBIU_SDSTAT & EBIU_SDSTAT_SDRS) ){
@@ -160,12 +108,12 @@ void Init_EBIU (void)
   }
 }
 
- /*
-  * Init_Flags
-  * 
-  * Enable LEDs port
-  */
-void Init_Flags(void)
+/*
+ * Init_Flags
+ * 
+ * Enable LEDs port
+ */
+static void Init_Flags(void)
 {
   *((uint16_t*)PORTH_FER)    = 0x0;
   *((uint16_t*)PORTH_MUX)    = 0x0;
@@ -173,22 +121,33 @@ void Init_Flags(void)
   *((uint16_t*)PORTHIO_SET)  = 0x1<<15;
 }
 
+/*
+ *  bsp_pretasking_hook
+ */
+void bsp_pretasking_hook(void)
+{
+  bfin_interrupt_init();
+}
 
+void bsp_start( void )
+{
+  int i;
 
-void initCPLB(void) {
-
-       int i = 0;
-       unsigned int *addr;
-       unsigned int *data;
-        
-       addr = (unsigned int *)0xffe00100;
-       data = (unsigned int *)0xffe00200;
-
-       while ( dcplbs_table[i][0] != 0xffffffff ) {
-               *addr = dcplbs_table[i][0];
-               *data = dcplbs_table[i][1];
+  /* BSP Hardware Initialization*/
+  Init_RTC();   /* Blackfin Real Time Clock initialization */  
+  Init_PLL();   /* PLL initialization */
+  Init_EBIU();  /* EBIU initialization */
+  Init_Flags(); /* GPIO initialization */
 
-               addr++;
-               data++;
-       } 
+  /*
+   *  Allocate the memory for the RTEMS Work Space.  This can come from
+   *  a variety of places: hard coded address, malloc'ed from outside
+   *  RTEMS world (e.g. simulator or primitive memory manager), or (as
+   *  typically done by stock BSPs) by subtracting the required amount
+   *  of work space from the last physical address on the CPU board.
+   */
+  for (i=5;i<16;i++) {
+    set_vector((rtems_isr_entry)bfin_null_isr, i, 1);
+  }
+  
 }
diff --git a/c/src/lib/libbsp/bfin/bf537Stamp/console/console.c b/c/src/lib/libbsp/bfin/bf537Stamp/console/console.c
index 81f8ce2..68d32ce 100644
--- a/c/src/lib/libbsp/bfin/bf537Stamp/console/console.c
+++ b/c/src/lib/libbsp/bfin/bf537Stamp/console/console.c
@@ -1,5 +1,7 @@
 /*  Console driver for bf537Stamp
- *
+ */
+
+/*
  *  Copyright (c) 2008 Kallisti Labs, Los Gatos, CA, USA
  *             written by Allan Hessenflow <allanh at kallisti.com>
  *
diff --git a/c/src/lib/libbsp/bfin/bf537Stamp/include/bsp.h b/c/src/lib/libbsp/bfin/bf537Stamp/include/bsp.h
index 0b48971..4261c44 100644
--- a/c/src/lib/libbsp/bfin/bf537Stamp/include/bsp.h
+++ b/c/src/lib/libbsp/bfin/bf537Stamp/include/bsp.h
@@ -15,6 +15,8 @@
 #ifndef _BSP_H
 #define _BSP_H
 
+#ifndef ASM
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -89,7 +91,9 @@ void setLED(uint8_t value);
 /*
  * Helper Function to use the EzKits LEDS
  */
-uint8_t getLED(void);
+uint8_t getLEDs(void);
+void setLEDs(uint8_t value);
+uint8_t getButtons(void);
 
 rtems_isr_entry set_vector(                     /* returns old vector */
   rtems_isr_entry     handler,                  /* isr routine        */
@@ -98,6 +102,11 @@ rtems_isr_entry set_vector(                     /* returns old vector */
 );
 
 /*
+ *  Internal BSP methods that are used across file boundaries
+ */
+void Init_RTC(void);
+
+/*
  * Network driver configuration
  */
 struct rtems_bsdnet_ifconfig;
@@ -110,4 +119,6 @@ extern int bf537Stamp_network_driver_attach(struct rtems_bsdnet_ifconfig *, int)
 }
 #endif
 
+#endif /* !ASM */
+
 #endif
diff --git a/c/src/lib/libbsp/bfin/bf537Stamp/startup/bspstart.c b/c/src/lib/libbsp/bfin/bf537Stamp/startup/bspstart.c
index cf7fbf1..8e77656 100644
--- a/c/src/lib/libbsp/bfin/bf537Stamp/startup/bspstart.c
+++ b/c/src/lib/libbsp/bfin/bf537Stamp/startup/bspstart.c
@@ -65,8 +65,6 @@ static bfin_mmu_config_t mmuRegions = {
     }
 };
 
-void Init_RTC(void);
-
 static void initPLL(void);
 static void initEBIU(void);
 static void initGPIO(void);
diff --git a/c/src/lib/libbsp/bfin/eZKit533/include/bsp.h b/c/src/lib/libbsp/bfin/eZKit533/include/bsp.h
index 78906db..3eb0635 100644
--- a/c/src/lib/libbsp/bfin/eZKit533/include/bsp.h
+++ b/c/src/lib/libbsp/bfin/eZKit533/include/bsp.h
@@ -21,6 +21,8 @@
 #ifndef _BSP_H
 #define _BSP_H
 
+#ifndef ASM
+
 #include <libcpu/bf533.h>
 
 #ifdef __cplusplus
@@ -126,12 +128,33 @@ void setLED (uint8_t value);
  */
 uint8_t getLED (void);
 
-rtems_isr_entry set_vector(                     ///< @brief returns old vector */
-  rtems_isr_entry     handler,                  ///< @brief isr routine        */
-  rtems_vector_number vector,                   ///< @brief vector number      */
-  int                 type                      ///< @brief RTEMS or RAW intr  */
+/**
+ * @brief Install an interrupt handler
+ *
+ * This method installs an interrupt handle.
+ *
+ * @param[in] handler is the isr routine
+ * @param[in] vector is the vector number
+ * @param[in] type indicates whether RTEMS or RAW intr
+ *
+ * @return returns old vector
+ */
+rtems_isr_entry set_vector(
+  rtems_isr_entry     handler,
+  rtems_vector_number vector,
+  int                 type
 );
 
+/*
+ *  Internal BSP methods that are used across file boundaries
+ */
+void Init_RTC(void);
+
+/*
+ * Prototype for methods in .S files that are referenced from C.
+ */
+void bfin_null_isr(void);
+
 /** @} */
 
 /** @} */
@@ -140,4 +163,6 @@ rtems_isr_entry set_vector(                     ///< @brief returns old vector *
 }
 #endif
 
+#endif /* !ASM */
+
 #endif
diff --git a/c/src/lib/libbsp/bfin/eZKit533/startup/bspstart.c b/c/src/lib/libbsp/bfin/eZKit533/startup/bspstart.c
index 503fb6e..6c7f1d5 100644
--- a/c/src/lib/libbsp/bfin/eZKit533/startup/bspstart.c
+++ b/c/src/lib/libbsp/bfin/eZKit533/startup/bspstart.c
@@ -59,47 +59,12 @@ const unsigned int _icplbs_table[16][2] = {
 };
 
 /*
- *  Use the shared implementations of the following routines
- */
-
-void Init_PLL (void);
-void Init_EBIU (void);
-void Init_Flags(void);
-void Init_RTC (void);
-
-void null_isr(void);
-
-/*
- *      BSP pretasking hook.  Called just before drivers are initialized.
- *      Used to setup libc and install any BSP extensions.
- */
-
-void bsp_pretasking_hook(void)
-{
-  bfin_interrupt_init();
-}
-
-void bsp_start( void )
-{
-  /* BSP Hardware Initialization*/
-  Init_RTC();   /* Blackfin Real Time Clock initialization */
-  Init_PLL();   /* PLL initialization */
-  Init_EBIU();  /* EBIU initialization */
-  Init_Flags(); /* GPIO initialization */
-
-  int i=0;
-  for (i=5;i<16;i++) {
-    set_vector((rtems_isr_entry)null_isr, i, 1);
-  }
-}
-
-/*
  * Init_PLL
  *
  * Routine to initialize the PLL. The Ezkit uses a 27 Mhz XTAL.
  * See "../eZKit533/include/bsp.h" for more information.
  */
-void Init_PLL (void)
+static void Init_PLL (void)
 {
   unsigned int n;
 
@@ -117,13 +82,12 @@ void Init_PLL (void)
   for (n=0; n<200; n++) {}
 }
 
- /*
-  * Init_EBIU
-  *
-  * Configure extern memory
-  */
-
-void Init_EBIU (void)
+/*
+ * Init_EBIU
+ *
+ * Configure extern memory
+ */
+static void Init_EBIU (void)
 {
   /* Configure FLASH */
   *((uint32_t*)EBIU_AMBCTL0)  = 0x7bb07bb0L;
@@ -142,7 +106,7 @@ void Init_EBIU (void)
  *
  * Enable LEDs port
  */
-void Init_Flags(void)
+static void Init_Flags(void)
 {
   *((uint16_t*)FIO_INEN)    = 0x0100;
   *((uint16_t*)FIO_DIR)     = 0x0000;
@@ -154,6 +118,29 @@ void Init_Flags(void)
 }
 
 /*
+ * BSP pretasking hook.  Called just before drivers are initialized.
+ * Used to setup libc and install any BSP extensions.
+ */
+void bsp_pretasking_hook(void)
+{
+  bfin_interrupt_init();
+}
+
+void bsp_start( void )
+{
+  /* BSP Hardware Initialization*/
+  Init_RTC();   /* Blackfin Real Time Clock initialization */
+  Init_PLL();   /* PLL initialization */
+  Init_EBIU();  /* EBIU initialization */
+  Init_Flags(); /* GPIO initialization */
+
+  int i=0;
+  for (i=5;i<16;i++) {
+    set_vector((rtems_isr_entry)bfin_null_isr, i, 1);
+  }
+}
+
+/*
  * Helper Function to use the EzKits LEDS.
  * Can be used by the Application.
  */
@@ -169,20 +156,3 @@ uint8_t getLED (void)
 {
   return *((uint8_t*)FlashA_PortB_Data);
 }
-
-void initCPLB(void)
-{
-  int i = 0;
-  unsigned int *addr;
-  unsigned int *data;
-
-  addr = (unsigned int *)0xffe00100;
-  data = (unsigned int *)0xffe00200;
-
-  while ( dcplbs_table[i][0] != 0xffffffff ) {
-    *addr = dcplbs_table[i][0];
-    *data = dcplbs_table[i][1];
-    addr++;
-    data++;
-  }
-}
diff --git a/c/src/lib/libbsp/bfin/shared/start/start.S b/c/src/lib/libbsp/bfin/shared/start/start.S
index 5106d02..3440f5c 100644
--- a/c/src/lib/libbsp/bfin/shared/start/start.S
+++ b/c/src/lib/libbsp/bfin/shared/start/start.S
@@ -1,6 +1,7 @@
 
 #include <rtems/bfin/bfin.h>
 
+#include <bsp.h>
 #include <bspopts.h>
 
 #ifndef LO
@@ -88,7 +89,7 @@ __start:
     P3 = P4;
     jump    (p0)        /* Should not return.  */
 
-.global _null_isr
-_null_isr:
+.global _bfin_null_isr
+_bfin_null_isr:
     rti;
 
diff --git a/c/src/lib/libcpu/bfin/clock/clock.c b/c/src/lib/libcpu/bfin/clock/clock.c
index 391347c..787dcd6 100644
--- a/c/src/lib/libcpu/bfin/clock/clock.c
+++ b/c/src/lib/libcpu/bfin/clock/clock.c
@@ -37,7 +37,7 @@ static rtems_isr clockISR(rtems_vector_number vector) {
   } while (
     _Thread_Heir == _Thread_Executing
       && _Thread_Executing->Start.entry_point
-        == rtems_configuration_get_idle_task()
+        == (Thread_Entry) rtems_configuration_get_idle_task()
   );
 #else
   rtems_clock_tick();
diff --git a/c/src/lib/libcpu/bfin/clock/rtc.c b/c/src/lib/libcpu/bfin/clock/rtc.c
index 9efcb89..4af18a2 100644
--- a/c/src/lib/libcpu/bfin/clock/rtc.c
+++ b/c/src/lib/libcpu/bfin/clock/rtc.c
@@ -1,4 +1,5 @@
-/*  Real Time Clock Driver for Blackfin
+/*
+ * Real Time Clock Driver for Blackfin
  */
 
 /*
diff --git a/c/src/lib/libcpu/bfin/serial/uart.c b/c/src/lib/libcpu/bfin/serial/uart.c
index b8cd89b..79f0941 100644
--- a/c/src/lib/libcpu/bfin/serial/uart.c
+++ b/c/src/lib/libcpu/bfin/serial/uart.c
@@ -1,5 +1,7 @@
 /*  UART driver for Blackfin
- *
+ */
+
+/*
  *  Copyright (c) 2008 Kallisti Labs, Los Gatos, CA, USA
  *             written by Allan Hessenflow <allanh at kallisti.com>
  *
@@ -8,7 +10,6 @@
  *  http://www.rtems.org/license/LICENSE.
  */
  
-
 #include <rtems.h>
 #include <rtems/libio.h>
 #include <rtems/termiostypes.h>
@@ -22,11 +23,10 @@
 /* flags */
 #define BFIN_UART_XMIT_BUSY 0x01
 
-
 static bfin_uart_config_t *uartsConfig;
 
-
-static int pollRead(int minor) {
+static int pollRead(int minor)
+{
   int c;
   uint32_t base;
 
@@ -44,7 +44,8 @@ static int pollRead(int minor) {
   return c;
 }
 
-char bfin_uart_poll_read(rtems_device_minor_number minor) {
+char bfin_uart_poll_read(rtems_device_minor_number minor)
+{
   int c;
 
   do {
@@ -54,7 +55,8 @@ char bfin_uart_poll_read(rtems_device_minor_number minor) {
   return c;
 }
 
-void bfin_uart_poll_write(int minor, char c) {
+void bfin_uart_poll_write(int minor, char c)
+{
   uint32_t base;
 
   base = uartsConfig->channels[minor].uart_baseAddress;
@@ -64,61 +66,13 @@ void bfin_uart_poll_write(int minor, char c) {
   *(uint16_t volatile *) (base + UART_THR_OFFSET) = c;
 }
 
-/* begin BISON */
-void debug_write_char(char c) {
-  bfin_uart_poll_write(0, c);
-}
-
-void debug_write_string(char *s) {
-
-  while (s && *s) {
-    if (*s == '\n')
-      debug_write_char('\r');
-    debug_write_char(*s++);
-  }
-}
-
-void debug_write_crlf(void) {
-
-  debug_write_char('\r');
-  debug_write_char('\n');
-}
-
-void debug_write_nybble(int nybble) {
-
-  nybble &= 0x0f;
-  debug_write_char((nybble > 9) ? 'a' + (nybble - 10) : '0' + nybble);
-}
-
-void debug_write_byte(int byte) {
-
-  byte &= 0xff;
-  debug_write_nybble(byte >> 4);
-  debug_write_nybble(byte & 0x0f);
-}
-
-void debug_write_half(int half) {
-
-  half &= 0xffff;
-  debug_write_byte(half >> 8);
-  debug_write_byte(half & 0xff);
-}
-
-void debug_write_word(int word) {
-
-  word &= 0xffffffff;
-  debug_write_half(word >> 16);
-  debug_write_half(word & 0xffff);
-}
-/* end BISON */
-
 /*
  *  Console Termios Support Entry Points
  *
  */
 
-static ssize_t pollWrite(int minor, const char *buf, size_t len) {
-
+static ssize_t pollWrite(int minor, const char *buf, size_t len)
+{
   size_t count;
   for ( count = 0; count < len; count++ )
     bfin_uart_poll_write(minor, *buf++);
@@ -126,13 +80,13 @@ static ssize_t pollWrite(int minor, const char *buf, size_t len) {
   return count;
 }
 
-
 /**
  * Routine to initialize the hardware. It initialize the DMA,
  * interrupt if required.
  * @param channel channel information
  */
-static void initializeHardware(bfin_uart_channel_t *channel) {
+static void initializeHardware(bfin_uart_channel_t *channel)
+{
   uint16_t divisor        = 0;
   uint32_t base           = 0;
   uint32_t tx_dma_base    = 0;
@@ -188,8 +142,6 @@ static void initializeHardware(bfin_uart_channel_t *channel) {
     * We use polling or interrupts only sending one char at a time :(
     */
   }
-
-  return;
 }
 
 
@@ -199,7 +151,8 @@ static void initializeHardware(bfin_uart_channel_t *channel) {
  * @param termios
  * @return
  */
-static int setAttributes(int minor, const struct termios *termios) {
+static int setAttributes(int minor, const struct termios *termios)
+{
   uint32_t base;
   int baud;
   uint16_t divisor;
@@ -207,96 +160,46 @@ static int setAttributes(int minor, const struct termios *termios) {
 
   base = uartsConfig->channels[minor].uart_baseAddress;
   switch (termios->c_cflag & CBAUD) {
-  case B0:
-    baud = 0;
-    break;
-  case B50:
-    baud = 50;
-    break;
-  case B75:
-    baud = 75;
-    break;
-  case B110:
-    baud = 110;
-    break;
-  case B134:
-    baud = 134;
-    break;
-  case B150:
-    baud = 150;
-    break;
-  case B200:
-    baud = 200;
-    break;
-  case B300:
-    baud = 300;
-    break;
-  case B600:
-    baud = 600;
-    break;
-  case B1200:
-    baud = 1200;
-    break;
-  case B1800:
-    baud = 1800;
-    break;
-  case B2400:
-    baud = 2400;
-    break;
-  case B4800:
-    baud = 4800;
-    break;
-  case B9600:
-    baud = 9600;
-    break;
-  case B19200:
-    baud = 19200;
-    break;
-  case B38400:
-    baud = 38400;
-    break;
-  case B57600:
-    baud = 57600;
-    break;
-  case B115200:
-    baud = 115200;
-    break;
-  case B230400:
-    baud = 230400;
-    break;
-  case B460800:
-    baud = 460800;
-    break;
-  default:
-    baud = -1;
-    break;
+    case B0:      baud = 0;      break;
+    case B50:     baud = 50;     break;
+    case B75:     baud = 75;     break;
+    case B110:    baud = 110;    break;
+    case B134:    baud = 134;    break;
+    case B150:    baud = 150;    break;
+    case B200:    baud = 200;    break;
+    case B300:    baud = 300;    break;
+    case B600:    baud = 600;    break;
+    case B1200:   baud = 1200;   break;
+    case B1800:   baud = 1800;   break;
+    case B2400:   baud = 2400;   break;
+    case B4800:   baud = 4800;   break;
+    case B9600:   baud = 9600;   break;
+    case B19200:  baud = 19200;  break;
+    case B38400:  baud = 38400;  break;
+    case B57600:  baud = 57600;  break;
+    case B115200: baud = 115200; break;
+    case B230400: baud = 230400; break;
+    case B460800: baud = 460800; break;
+    default: baud = -1; break;
   }
   if (baud > 0 && uartsConfig->channels[minor].uart_baud)
     baud = uartsConfig->channels[minor].uart_baud;
   switch (termios->c_cflag & CSIZE) {
-  case CS5:
-    lcr = UART_LCR_WLS_5;
-    break;
-  case CS6:
-    lcr = UART_LCR_WLS_6;
-    break;
-  case CS7:
-    lcr = UART_LCR_WLS_7;
-    break;
-  case CS8:
+  case CS5: lcr = UART_LCR_WLS_5; break;
+  case CS6: lcr = UART_LCR_WLS_6; break;
+  case CS7: lcr = UART_LCR_WLS_7; break;
   default:
-    lcr = UART_LCR_WLS_8;
-    break;
+  case CS8: lcr = UART_LCR_WLS_8; break;
   }
   switch (termios->c_cflag & (PARENB | PARODD)) {
-  case PARENB:
-    lcr |= UART_LCR_PEN | UART_LCR_EPS;
-    break;
-  case PARENB | PARODD:
-  lcr |= UART_LCR_PEN;
-  break;
-  default:
-    break;
+    case PARENB:
+      lcr |= UART_LCR_PEN | UART_LCR_EPS;
+      break;
+    case PARENB | PARODD:
+      lcr |= UART_LCR_PEN;
+      break;
+    default:
+      break;
   }
   if (termios->c_cflag & CSTOPB)
     lcr |= UART_LCR_STB;
@@ -320,7 +223,8 @@ static int setAttributes(int minor, const struct termios *termios) {
  * @param len Length of buffer to be transmitted.
  * @return
  */
-static ssize_t uart_interruptWrite(int minor, const char *buf, size_t len) {
+static ssize_t uart_interruptWrite(int minor, const char *buf, size_t len)
+{
   uint32_t              base      = 0;
   bfin_uart_channel_t*  channel   = NULL;
 
@@ -351,17 +255,15 @@ static ssize_t uart_interruptWrite(int minor, const char *buf, size_t len) {
 }
 
 /**
-* This function implements RX ISR
-*/
+ * This function implements RX ISR
+ */
 void bfinUart_rxIsr(void *_arg)
 {
   /**
    * TODO: UART RX ISR implementation.
    */
-
 }
 
-
 /**
  * This function implements TX ISR. The function gets called when the TX FIFO is
  * empty. It clears the interrupt and dequeues the character. It only tx one
@@ -370,7 +272,8 @@ void bfinUart_rxIsr(void *_arg)
  * TODO: error handling.
  * @param _arg gets the channel information.
  */
-void bfinUart_txIsr(void *_arg) {
+void bfinUart_txIsr(void *_arg)
+{
   bfin_uart_channel_t*  channel = NULL;
   uint32_t              base    = 0;
 
@@ -390,13 +293,8 @@ void bfinUart_txIsr(void *_arg) {
   channel->flags &= ~BFIN_UART_XMIT_BUSY;
 
   rtems_termios_dequeue_characters(channel->termios, channel->length);
-
-  return;
 }
 
-
-
-
 /**
  * interrupt based DMA write Routine. It configure the DMA to write len bytes.
  * The DMA supports 64K data only.
@@ -406,7 +304,8 @@ void bfinUart_txIsr(void *_arg) {
  * @param len length of data items to be written
  * @return data already written
  */
-static ssize_t uart_DmaWrite(int minor, const char *buf, size_t len) {
+static ssize_t uart_DmaWrite(int minor, const char *buf, size_t len)
+{
   uint32_t              base        = 0;
   bfin_uart_channel_t*  channel     = NULL;
   uint32_t              tx_dma_base = 0;
@@ -443,14 +342,14 @@ static ssize_t uart_DmaWrite(int minor, const char *buf, size_t len) {
   return 0;
 }
 
-
 /**
  * RX DMA ISR.
  * The polling route is used for receiving the characters. This is a place
  * holder for future implementation.
  * @param _arg
  */
-void bfinUart_rxDmaIsr(void *_arg) {
+void bfinUart_rxDmaIsr(void *_arg)
+{
 /**
  * TODO: Implementation of RX DMA
  */
@@ -467,7 +366,8 @@ void bfinUart_rxDmaIsr(void *_arg) {
  * @param _arg argument passed to the interrupt handler. It contains the
  * channel argument.
  */
-void bfinUart_txDmaIsr(void *_arg) {
+void bfinUart_txDmaIsr(void *_arg)
+{
   bfin_uart_channel_t*  channel     = NULL;
   uint32_t              tx_dma_base = 0;
 
@@ -495,19 +395,16 @@ void bfinUart_txDmaIsr(void *_arg) {
      * This routine must not be called.
      */
   }
-
-  return;
 }
 
 /**
  * Function called during exit
  */
-void uart_exit(void)
+static void uart_exit(void)
 {
   /**
    * TODO: Flushing of quques
    */
-
 }
 
 /**
@@ -571,7 +468,6 @@ rtems_device_driver bfin_uart_open(rtems_device_major_number major,
       TERMIOS_IRQ_DRIVEN           /* outputUsesInterrupts */
   };
 
-
   if ( NULL == uartsConfig || 0 > minor || minor >= uartsConfig->num_channels) {
     return RTEMS_INVALID_NUMBER;
   }
@@ -598,15 +494,17 @@ rtems_device_driver bfin_uart_open(rtems_device_major_number major,
   return sc;
 }
 
-
 /**
 * Uart initialization function.
 * @param major major number of the device
 * @param config configuration parameters
 * @return rtems status code
 */
-rtems_status_code bfin_uart_initialize(rtems_device_major_number major,
-    bfin_uart_config_t *config) {
+rtems_status_code bfin_uart_initialize(
+  rtems_device_major_number major,
+  bfin_uart_config_t *config
+)
+{
   rtems_status_code sc = RTEMS_NOT_DEFINED;
   int               i  = 0;
 
diff --git a/cpukit/score/cpu/bfin/rtems/bfin/bfin.h b/cpukit/score/cpu/bfin/rtems/bfin/bfin.h
index cce3b2f..4ba0b2b 100644
--- a/cpukit/score/cpu/bfin/rtems/bfin/bfin.h
+++ b/cpukit/score/cpu/bfin/rtems/bfin/bfin.h
@@ -6,6 +6,7 @@
  * This file defines Macros for MMR register common to all Blackfin
  * Processors.
  */
+
 /*
  *  COPYRIGHT (c) 2006 by Atos Automacao Industrial Ltda.
  *             modified by Alain Schaefer <alain.schaefer at easc.ch>
-- 
1.9.3




More information about the devel mailing list