Changeset 6307b1a in rtems


Ignore:
Timestamp:
Jun 20, 2013, 9:57:34 AM (7 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
37220fac
Parents:
ade27c6
git-author:
Sebastian Huber <sebastian.huber@…> (06/20/13 09:57:34)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/21/13 08:26:10)
Message:

bsps: Add fatal errors for shared console driver

Location:
c/src/lib/libbsp/shared
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/shared/console.c

    rade27c6 r6307b1a  
    1717
    1818#include <bsp.h>
     19#include <bsp/generic-fatal.h>
    1920#include <rtems/libio.h>
    2021#include <stdlib.h>
     
    2324
    2425#include <rtems/termiostypes.h>
    25 #include <rtems/error.h>  /* rtems_panic */
    2626#include <libchip/serial.h>
    2727#include "console_private.h"
     
    4949  Console_Port_Tbl   = malloc( Console_Port_Count * sizeof( console_tbl * ) );
    5050  if (Console_Port_Tbl == NULL)
    51     rtems_panic("No memory for console pointers");
     51    bsp_generic_fatal( BSP_GENERIC_FATAL_CONSOLE_NO_MEMORY_0 );
    5252
    5353  for (i=0 ; i < Console_Port_Count ; i++)
     
    7676   */
    7777  if ( console_initialized ) {
    78     printk( "Attempt to register console devices after driver initialized\n" );
    79     rtems_fatal_error_occurred( 0xdead0001 );
     78    bsp_generic_fatal( BSP_GENERIC_FATAL_CONSOLE_MULTI_INIT );
    8079  }
    8180
     
    9089  );
    9190  if ( Console_Port_Tbl == NULL ) {
    92     printk( "Unable to allocate pointer table for registering console devices\n" );
    93     rtems_fatal_error_occurred( 0xdead0002 );
     91    bsp_generic_fatal( BSP_GENERIC_FATAL_CONSOLE_NO_MEMORY_1 );
    9492  }
    9593
    9694  Console_Port_Data  = calloc( Console_Port_Count, sizeof( console_data ) );
    9795  if ( Console_Port_Data == NULL ) {
    98     printk( "Unable to allocate data table for console devices\n" );
    99     rtems_fatal_error_occurred( 0xdead0003 );
     96    bsp_generic_fatal( BSP_GENERIC_FATAL_CONSOLE_NO_MEMORY_2 );
    10097  }
    10198
     
    258255    Console_Port_Data  = calloc( Console_Port_Count, sizeof( console_data ) );
    259256    if ( Console_Port_Data == NULL ) {
    260       printk( "Unable to allocate data table for console devices\n" );
    261       rtems_fatal_error_occurred( 0xdead0003 );
     257      bsp_generic_fatal( BSP_GENERIC_FATAL_CONSOLE_NO_MEMORY_3 );
    262258    }
    263259  }
     
    294290        status = rtems_io_register_name( port->sDeviceName, major, minor );
    295291        if (status != RTEMS_SUCCESSFUL) {
    296           printk( "Unable to register %s\n",  port->sDeviceName );
    297           rtems_fatal_error_occurred(status);
     292          bsp_generic_fatal( BSP_GENERIC_FATAL_CONSOLE_REGISTER_DEV_0 );
    298293        }
    299294      }
     
    306301        status = rtems_io_register_name( "dev/console", major, minor );
    307302        if (status != RTEMS_SUCCESSFUL) {
    308           printk( "Unable to register /dev/console\n" );
    309           rtems_fatal_error_occurred(status);
     303          bsp_generic_fatal( BSP_GENERIC_FATAL_CONSOLE_REGISTER_DEV_1 );
    310304        }
    311305      }
  • c/src/lib/libbsp/shared/console_select.c

    rade27c6 r6307b1a  
    2020
    2121#include <bsp.h>
     22#include <bsp/generic-fatal.h>
    2223#include <rtems/libio.h>
    2324#include <stdlib.h>
     
    7273   *  Error No devices were found.  We will want to bail here.
    7374   */
    74   rtems_fatal_error_occurred(RTEMS_IO_ERROR);
     75  bsp_generic_fatal(BSP_GENERIC_FATAL_CONSOLE_NO_DEV);
    7576}
    7677
  • c/src/lib/libbsp/shared/include/generic-fatal.h

    rade27c6 r6307b1a  
    2828  BSP_GENERIC_FATAL_EXCEPTION_INITIALIZATION,
    2929  BSP_GENERIC_FATAL_INTERRUPT_INITIALIZATION,
    30   BSP_GENERIC_FATAL_SPURIOUS_INTERRUPT
     30  BSP_GENERIC_FATAL_SPURIOUS_INTERRUPT,
     31  BSP_GENERIC_FATAL_CONSOLE_MULTI_INIT,
     32  BSP_GENERIC_FATAL_CONSOLE_NO_MEMORY_0,
     33  BSP_GENERIC_FATAL_CONSOLE_NO_MEMORY_1,
     34  BSP_GENERIC_FATAL_CONSOLE_NO_MEMORY_2,
     35  BSP_GENERIC_FATAL_CONSOLE_NO_MEMORY_3,
     36  BSP_GENERIC_FATAL_CONSOLE_REGISTER_DEV_0,
     37  BSP_GENERIC_FATAL_CONSOLE_REGISTER_DEV_1,
     38  BSP_GENERIC_FATAL_CONSOLE_NO_DEV
    3139} bsp_generic_fatal_code;
    3240
Note: See TracChangeset for help on using the changeset viewer.