From c082b57502a37df0ada44c1ea8a10f768e2dc79a Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 5 Feb 2013 17:23:55 +0100 Subject: bsp/mpc55xx: Add and use BSP specific fatal codes --- .../libbsp/powerpc/mpc55xxevb/clock/clock-config.c | 8 ++++---- .../powerpc/mpc55xxevb/console/console-esci.c | 6 +++--- .../powerpc/mpc55xxevb/console/console-generic.c | 6 +++--- .../powerpc/mpc55xxevb/console/console-linflex.c | 16 ++++++++-------- c/src/lib/libbsp/powerpc/mpc55xxevb/include/bsp.h | 22 +++++++++++++++++++++- .../libbsp/powerpc/mpc55xxevb/startup/bspstart.c | 5 +++++ .../powerpc/mpc55xxevb/startup/start-clock.c | 2 +- 7 files changed, 45 insertions(+), 20 deletions(-) diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/clock/clock-config.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/clock/clock-config.c index f2489448b7..5134d80d28 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/clock/clock-config.c +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/clock/clock-config.c @@ -51,7 +51,7 @@ static void mpc55xx_clock_handler_install(rtems_isr_entry isr) NULL ); if (sc != RTEMS_SUCCESSFUL) { - rtems_fatal_error_occurred(0xdeadbeef); + mpc55xx_fatal(MPC55XX_FATAL_CLOCK_EMIOS_IRQ_INSTALL); } } @@ -71,12 +71,12 @@ static void mpc55xx_clock_initialize(void) if (prescaler > 0) { interval /= (uint64_t) prescaler; } else { - rtems_fatal_error_occurred(0xdeadbeef); + mpc55xx_fatal(MPC55XX_FATAL_CLOCK_EMIOS_PRESCALER); } /* Check interval */ if (interval == 0 || interval > MPC55XX_EMIOS_VALUE_MAX) { - rtems_fatal_error_occurred(0xdeadbeef); + mpc55xx_fatal(MPC55XX_FATAL_CLOCK_EMIOS_INTERVAL); } /* Configure eMIOS channel */ @@ -157,7 +157,7 @@ static void mpc55xx_clock_handler_install(rtems_isr_entry isr) NULL ); if (sc != RTEMS_SUCCESSFUL) { - rtems_fatal_error_occurred(0xdeadbeef); + mpc55xx_fatal(MPC55XX_FATAL_CLOCK_PIT_IRQ_INSTALL); } } diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-esci.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-esci.c index 83a4fa9f73..7cff92fcd9 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-esci.c +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-esci.c @@ -268,12 +268,12 @@ static int mpc55xx_esci_first_open(int major, int minor, void *arg) rv = rtems_termios_set_initial_baud(tty, BSP_DEFAULT_BAUD_RATE); if (rv != 0) { - rtems_fatal_error_occurred(0xdeadbeef); + mpc55xx_fatal(MPC55XX_FATAL_CONSOLE_ESCI_BAUD); } rv = mpc55xx_esci_set_attributes(minor, &tty->termios); if (rv != 0) { - rtems_fatal_error_occurred(0xdeadbeef); + mpc55xx_fatal(MPC55XX_FATAL_CONSOLE_ESCI_ATTRIBUTES); } sc = mpc55xx_interrupt_handler_install( @@ -285,7 +285,7 @@ static int mpc55xx_esci_first_open(int major, int minor, void *arg) self ); if (sc != RTEMS_SUCCESSFUL) { - rtems_fatal_error_occurred(0xdeadbeef); + mpc55xx_fatal(MPC55XX_FATAL_CONSOLE_ESCI_IRQ_INSTALL); } mpc55xx_esci_interrupts_clear_and_enable(self); diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-generic.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-generic.c index ad3b5485e9..2f71948f74 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-generic.c +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-generic.c @@ -80,7 +80,7 @@ rtems_device_driver console_initialize( rtems_device_minor_number console = console_generic_minor; if (count <= 0) { - rtems_fatal_error_occurred(0xdeadbeef); + mpc55xx_fatal(MPC55XX_FATAL_CONSOLE_GENERIC_COUNT); } rtems_termios_initialize(); @@ -90,13 +90,13 @@ rtems_device_driver console_initialize( sc = rtems_io_register_name(info->device_path, major, minor); if (sc != RTEMS_SUCCESSFUL) { - rtems_fatal_error_occurred(0xdeadbeef); + mpc55xx_fatal(MPC55XX_FATAL_CONSOLE_GENERIC_REGISTER); } } sc = rtems_io_register_name(CONSOLE_DEVICE_NAME, major, console); if (sc != RTEMS_SUCCESSFUL) { - rtems_fatal_error_occurred(0xdeadbeef); + mpc55xx_fatal(MPC55XX_FATAL_CONSOLE_GENERIC_REGISTER_CONSOLE); } console_generic_char_out_do_init(); diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-linflex.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-linflex.c index e4039f384e..0d5938126e 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-linflex.c +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/console/console-linflex.c @@ -261,12 +261,12 @@ static int mpc55xx_linflex_first_open(int major, int minor, void *arg) rv = rtems_termios_set_initial_baud(tty, BSP_DEFAULT_BAUD_RATE); if (rv != 0) { - rtems_fatal_error_occurred(0xdeadbeef); + mpc55xx_fatal(MPC55XX_FATAL_CONSOLE_LINFLEX_BAUD); } rv = mpc55xx_linflex_set_attributes(minor, &tty->termios); if (rv != 0) { - rtems_fatal_error_occurred(0xdeadbeef); + mpc55xx_fatal(MPC55XX_FATAL_CONSOLE_LINFLEX_ATTRIBUTES); } sc = mpc55xx_interrupt_handler_install( @@ -278,7 +278,7 @@ static int mpc55xx_linflex_first_open(int major, int minor, void *arg) self ); if (sc != RTEMS_SUCCESSFUL) { - rtems_fatal_error_occurred(0xdeadbeef); + mpc55xx_fatal(MPC55XX_FATAL_CONSOLE_LINFLEX_RX_IRQ_INSTALL); } sc = mpc55xx_interrupt_handler_install( @@ -290,7 +290,7 @@ static int mpc55xx_linflex_first_open(int major, int minor, void *arg) self ); if (sc != RTEMS_SUCCESSFUL) { - rtems_fatal_error_occurred(0xdeadbeef); + mpc55xx_fatal(MPC55XX_FATAL_CONSOLE_LINFLEX_TX_IRQ_INSTALL); } /* @@ -303,7 +303,7 @@ static int mpc55xx_linflex_first_open(int major, int minor, void *arg) self ); if (sc != RTEMS_SUCCESSFUL) { - rtems_fatal_error_occurred(0xdeadbeef); + mpc55xx_fatal(MPC55XX_FATAL_CONSOLE_LINFLEX_ERR_IRQ_INSTALL); } */ @@ -333,7 +333,7 @@ static int mpc55xx_linflex_last_close(int major, int minor, void* arg) self ); if (sc != RTEMS_SUCCESSFUL) { - rtems_fatal_error_occurred(0xdeadbeef); + mpc55xx_fatal(MPC55XX_FATAL_CONSOLE_LINFLEX_RX_IRQ_REMOVE); } sc = rtems_interrupt_handler_remove( @@ -342,7 +342,7 @@ static int mpc55xx_linflex_last_close(int major, int minor, void* arg) self ); if (sc != RTEMS_SUCCESSFUL) { - rtems_fatal_error_occurred(0xdeadbeef); + mpc55xx_fatal(MPC55XX_FATAL_CONSOLE_LINFLEX_TX_IRQ_REMOVE); } /* @@ -352,7 +352,7 @@ static int mpc55xx_linflex_last_close(int major, int minor, void* arg) self ); if (sc != RTEMS_SUCCESSFUL) { - rtems_fatal_error_occurred(0xdeadbeef); + mpc55xx_fatal(MPC55XX_FATAL_CONSOLE_LINFLEX_ERR_IRQ_REMOVE); } */ diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/include/bsp.h b/c/src/lib/libbsp/powerpc/mpc55xxevb/include/bsp.h index 4595d3d42c..a09fec4e88 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/include/bsp.h +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/include/bsp.h @@ -96,9 +96,29 @@ LINKER_SYMBOL(bsp_section_sysram_load_end) #define BSP_SYSRAM_SECTION __attribute__((section(".bsp_sysram"))) typedef enum { - MPC55XX_FATAL_FMPLL_LOCK + MPC55XX_FATAL_FMPLL_LOCK, + MPC55XX_FATAL_CLOCK_EMIOS_IRQ_INSTALL, + MPC55XX_FATAL_CLOCK_EMIOS_PRESCALER, + MPC55XX_FATAL_CLOCK_EMIOS_INTERVAL, + MPC55XX_FATAL_CLOCK_PIT_IRQ_INSTALL, + MPC55XX_FATAL_CONSOLE_GENERIC_COUNT, + MPC55XX_FATAL_CONSOLE_GENERIC_REGISTER, + MPC55XX_FATAL_CONSOLE_GENERIC_REGISTER_CONSOLE, + MPC55XX_FATAL_CONSOLE_ESCI_BAUD, + MPC55XX_FATAL_CONSOLE_ESCI_ATTRIBUTES, + MPC55XX_FATAL_CONSOLE_ESCI_IRQ_INSTALL, + MPC55XX_FATAL_CONSOLE_LINFLEX_BAUD, + MPC55XX_FATAL_CONSOLE_LINFLEX_ATTRIBUTES, + MPC55XX_FATAL_CONSOLE_LINFLEX_RX_IRQ_INSTALL, + MPC55XX_FATAL_CONSOLE_LINFLEX_TX_IRQ_INSTALL, + MPC55XX_FATAL_CONSOLE_LINFLEX_ERR_IRQ_INSTALL, + MPC55XX_FATAL_CONSOLE_LINFLEX_RX_IRQ_REMOVE, + MPC55XX_FATAL_CONSOLE_LINFLEX_TX_IRQ_REMOVE, + MPC55XX_FATAL_CONSOLE_LINFLEX_ERR_IRQ_REMOVE } mpc55xx_fatal_code; +void mpc55xx_fatal(rtems_fatal_code code) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE; + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspstart.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspstart.c index d0c3405298..6421b9785d 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspstart.c +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspstart.c @@ -59,6 +59,11 @@ void _BSP_Fatal_error(unsigned n) } } +void mpc55xx_fatal(rtems_fatal_code code) +{ + rtems_fatal(RTEMS_FATAL_SOURCE_BSP_SPECIFIC, code); +} + static void null_pointer_protection(void) { #ifdef MPC55XX_NULL_POINTER_PROTECTION diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-clock.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-clock.c index b8803f931c..19f71ac4fa 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-clock.c +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-clock.c @@ -38,7 +38,7 @@ } if (!lock) { - rtems_fatal(RTEMS_FATAL_SOURCE_BSP_SPECIFIC, MPC55XX_FATAL_FMPLL_LOCK); + mpc55xx_fatal(MPC55XX_FATAL_FMPLL_LOCK); } } #endif -- cgit v1.2.3