Ignore:
Timestamp:
Oct 14, 2014, 4:03:38 PM (5 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, master
Children:
c7e77ee
Parents:
c28f503
git-author:
Joel Sherrill <joel.sherrill@…> (10/14/14 16:03:38)
git-committer:
Joel Sherrill <joel.sherrill@…> (10/16/14 13:58:47)
Message:

bfin libcpu and libbsp: Fix warnings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libcpu/bfin/serial/uart.c

    rc28f503 red6365a  
    11/*  UART driver for Blackfin
    2  *
     2 */
     3
     4/*
    35 *  Copyright (c) 2008 Kallisti Labs, Los Gatos, CA, USA
    46 *             written by Allan Hessenflow <allanh@kallisti.com>
     
    911 */
    1012 
    11 
    1213#include <rtems.h>
    1314#include <rtems/libio.h>
     
    2324#define BFIN_UART_XMIT_BUSY 0x01
    2425
    25 
    2626static bfin_uart_config_t *uartsConfig;
    2727
    28 
    29 static int pollRead(int minor) {
     28static int pollRead(int minor)
     29{
    3030  int c;
    3131  uint32_t base;
     
    4545}
    4646
    47 char bfin_uart_poll_read(rtems_device_minor_number minor) {
     47char bfin_uart_poll_read(rtems_device_minor_number minor)
     48{
    4849  int c;
    4950
     
    5556}
    5657
    57 void bfin_uart_poll_write(int minor, char c) {
     58void bfin_uart_poll_write(int minor, char c)
     59{
    5860  uint32_t base;
    5961
     
    6567}
    6668
    67 /* begin BISON */
    68 void debug_write_char(char c) {
    69   bfin_uart_poll_write(0, c);
    70 }
    71 
    72 void debug_write_string(char *s) {
    73 
    74   while (s && *s) {
    75     if (*s == '\n')
    76       debug_write_char('\r');
    77     debug_write_char(*s++);
    78   }
    79 }
    80 
    81 void debug_write_crlf(void) {
    82 
    83   debug_write_char('\r');
    84   debug_write_char('\n');
    85 }
    86 
    87 void debug_write_nybble(int nybble) {
    88 
    89   nybble &= 0x0f;
    90   debug_write_char((nybble > 9) ? 'a' + (nybble - 10) : '0' + nybble);
    91 }
    92 
    93 void debug_write_byte(int byte) {
    94 
    95   byte &= 0xff;
    96   debug_write_nybble(byte >> 4);
    97   debug_write_nybble(byte & 0x0f);
    98 }
    99 
    100 void debug_write_half(int half) {
    101 
    102   half &= 0xffff;
    103   debug_write_byte(half >> 8);
    104   debug_write_byte(half & 0xff);
    105 }
    106 
    107 void debug_write_word(int word) {
    108 
    109   word &= 0xffffffff;
    110   debug_write_half(word >> 16);
    111   debug_write_half(word & 0xffff);
    112 }
    113 /* end BISON */
    114 
    11569/*
    11670 *  Console Termios Support Entry Points
     
    11872 */
    11973
    120 static ssize_t pollWrite(int minor, const char *buf, size_t len) {
    121 
     74static ssize_t pollWrite(int minor, const char *buf, size_t len)
     75{
    12276  size_t count;
    12377  for ( count = 0; count < len; count++ )
     
    12781}
    12882
    129 
    13083/**
    13184 * Routine to initialize the hardware. It initialize the DMA,
     
    13386 * @param channel channel information
    13487 */
    135 static void initializeHardware(bfin_uart_channel_t *channel) {
     88static void initializeHardware(bfin_uart_channel_t *channel)
     89{
    13690  uint16_t divisor        = 0;
    13791  uint32_t base           = 0;
     
    189143    */
    190144  }
    191 
    192   return;
    193145}
    194146
     
    200152 * @return
    201153 */
    202 static int setAttributes(int minor, const struct termios *termios) {
     154static int setAttributes(int minor, const struct termios *termios)
     155{
    203156  uint32_t base;
    204157  int baud;
     
    208161  base = uartsConfig->channels[minor].uart_baseAddress;
    209162  switch (termios->c_cflag & CBAUD) {
    210   case B0:
    211     baud = 0;
    212     break;
    213   case B50:
    214     baud = 50;
    215     break;
    216   case B75:
    217     baud = 75;
    218     break;
    219   case B110:
    220     baud = 110;
    221     break;
    222   case B134:
    223     baud = 134;
    224     break;
    225   case B150:
    226     baud = 150;
    227     break;
    228   case B200:
    229     baud = 200;
    230     break;
    231   case B300:
    232     baud = 300;
    233     break;
    234   case B600:
    235     baud = 600;
    236     break;
    237   case B1200:
    238     baud = 1200;
    239     break;
    240   case B1800:
    241     baud = 1800;
    242     break;
    243   case B2400:
    244     baud = 2400;
    245     break;
    246   case B4800:
    247     baud = 4800;
    248     break;
    249   case B9600:
    250     baud = 9600;
    251     break;
    252   case B19200:
    253     baud = 19200;
    254     break;
    255   case B38400:
    256     baud = 38400;
    257     break;
    258   case B57600:
    259     baud = 57600;
    260     break;
    261   case B115200:
    262     baud = 115200;
    263     break;
    264   case B230400:
    265     baud = 230400;
    266     break;
    267   case B460800:
    268     baud = 460800;
    269     break;
    270   default:
    271     baud = -1;
    272     break;
     163    case B0:      baud = 0;      break;
     164    case B50:     baud = 50;     break;
     165    case B75:     baud = 75;     break;
     166    case B110:    baud = 110;    break;
     167    case B134:    baud = 134;    break;
     168    case B150:    baud = 150;    break;
     169    case B200:    baud = 200;    break;
     170    case B300:    baud = 300;    break;
     171    case B600:    baud = 600;    break;
     172    case B1200:   baud = 1200;   break;
     173    case B1800:   baud = 1800;   break;
     174    case B2400:   baud = 2400;   break;
     175    case B4800:   baud = 4800;   break;
     176    case B9600:   baud = 9600;   break;
     177    case B19200:  baud = 19200;  break;
     178    case B38400:  baud = 38400;  break;
     179    case B57600:  baud = 57600;  break;
     180    case B115200: baud = 115200; break;
     181    case B230400: baud = 230400; break;
     182    case B460800: baud = 460800; break;
     183    default: baud = -1; break;
    273184  }
    274185  if (baud > 0 && uartsConfig->channels[minor].uart_baud)
    275186    baud = uartsConfig->channels[minor].uart_baud;
    276187  switch (termios->c_cflag & CSIZE) {
    277   case CS5:
    278     lcr = UART_LCR_WLS_5;
    279     break;
    280   case CS6:
    281     lcr = UART_LCR_WLS_6;
    282     break;
    283   case CS7:
    284     lcr = UART_LCR_WLS_7;
    285     break;
    286   case CS8:
     188  case CS5: lcr = UART_LCR_WLS_5; break;
     189  case CS6: lcr = UART_LCR_WLS_6; break;
     190  case CS7: lcr = UART_LCR_WLS_7; break;
    287191  default:
    288     lcr = UART_LCR_WLS_8;
    289     break;
     192  case CS8: lcr = UART_LCR_WLS_8; break;
    290193  }
    291194  switch (termios->c_cflag & (PARENB | PARODD)) {
    292   case PARENB:
    293     lcr |= UART_LCR_PEN | UART_LCR_EPS;
    294     break;
    295   case PARENB | PARODD:
    296   lcr |= UART_LCR_PEN;
    297   break;
    298   default:
    299     break;
     195    case PARENB:
     196      lcr |= UART_LCR_PEN | UART_LCR_EPS;
     197      break;
     198    case PARENB | PARODD:
     199      lcr |= UART_LCR_PEN;
     200      break;
     201    default:
     202      break;
    300203  }
    301204  if (termios->c_cflag & CSTOPB)
     
    321224 * @return
    322225 */
    323 static ssize_t uart_interruptWrite(int minor, const char *buf, size_t len) {
     226static ssize_t uart_interruptWrite(int minor, const char *buf, size_t len)
     227{
    324228  uint32_t              base      = 0;
    325229  bfin_uart_channel_t*  channel   = NULL;
     
    352256
    353257/**
    354 * This function implements RX ISR
    355 */
     258 * This function implements RX ISR
     259 */
    356260void bfinUart_rxIsr(void *_arg)
    357261{
     
    359263   * TODO: UART RX ISR implementation.
    360264   */
    361 
    362 }
    363 
     265}
    364266
    365267/**
     
    371273 * @param _arg gets the channel information.
    372274 */
    373 void bfinUart_txIsr(void *_arg) {
     275void bfinUart_txIsr(void *_arg)
     276{
    374277  bfin_uart_channel_t*  channel = NULL;
    375278  uint32_t              base    = 0;
     
    391294
    392295  rtems_termios_dequeue_characters(channel->termios, channel->length);
    393 
    394   return;
    395 }
    396 
    397 
    398 
     296}
    399297
    400298/**
     
    407305 * @return data already written
    408306 */
    409 static ssize_t uart_DmaWrite(int minor, const char *buf, size_t len) {
     307static ssize_t uart_DmaWrite(int minor, const char *buf, size_t len)
     308{
    410309  uint32_t              base        = 0;
    411310  bfin_uart_channel_t*  channel     = NULL;
     
    444343}
    445344
    446 
    447345/**
    448346 * RX DMA ISR.
     
    451349 * @param _arg
    452350 */
    453 void bfinUart_rxDmaIsr(void *_arg) {
     351void bfinUart_rxDmaIsr(void *_arg)
     352{
    454353/**
    455354 * TODO: Implementation of RX DMA
     
    468367 * channel argument.
    469368 */
    470 void bfinUart_txDmaIsr(void *_arg) {
     369void bfinUart_txDmaIsr(void *_arg)
     370{
    471371  bfin_uart_channel_t*  channel     = NULL;
    472372  uint32_t              tx_dma_base = 0;
     
    496396     */
    497397  }
    498 
    499   return;
    500398}
    501399
     
    503401 * Function called during exit
    504402 */
    505 void uart_exit(void)
     403static void uart_exit(void)
    506404{
    507405  /**
    508406   * TODO: Flushing of quques
    509407   */
    510 
    511408}
    512409
     
    572469  };
    573470
    574 
    575471  if ( NULL == uartsConfig || 0 > minor || minor >= uartsConfig->num_channels) {
    576472    return RTEMS_INVALID_NUMBER;
     
    599495}
    600496
    601 
    602497/**
    603498* Uart initialization function.
     
    606501* @return rtems status code
    607502*/
    608 rtems_status_code bfin_uart_initialize(rtems_device_major_number major,
    609     bfin_uart_config_t *config) {
     503rtems_status_code bfin_uart_initialize(
     504  rtems_device_major_number major,
     505  bfin_uart_config_t *config
     506)
     507{
    610508  rtems_status_code sc = RTEMS_NOT_DEFINED;
    611509  int               i  = 0;
Note: See TracChangeset for help on using the changeset viewer.