forked from Imagelibrary/rtems
bsp/mpc55xx: Add and use BSP specific fatal codes
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
}
|
||||
|
||||
if (!lock) {
|
||||
rtems_fatal(RTEMS_FATAL_SOURCE_BSP_SPECIFIC, MPC55XX_FATAL_FMPLL_LOCK);
|
||||
mpc55xx_fatal(MPC55XX_FATAL_FMPLL_LOCK);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user