diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-08-12 19:53:30 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-08-12 19:53:30 +0000 |
commit | 6620c1852d02136aff902e969b7f756c5a1b8632 (patch) | |
tree | 5403828170de337c7a158982b00422b8bbd979a6 /c/src/lib/libbsp/shared/src/irq-legacy.c | |
parent | 2009-08-12 Joel Sherrill <joel.sherrill@OARcorp.com> (diff) | |
download | rtems-6620c1852d02136aff902e969b7f756c5a1b8632.tar.bz2 |
2009-08-12 Joel Sherrill <joel.sherrill@oarcorp.com>
* src/irq-legacy.c: Spacing, tabs, and proper format for license
notice.
Diffstat (limited to '')
-rw-r--r-- | c/src/lib/libbsp/shared/src/irq-legacy.c | 237 |
1 files changed, 122 insertions, 115 deletions
diff --git a/c/src/lib/libbsp/shared/src/irq-legacy.c b/c/src/lib/libbsp/shared/src/irq-legacy.c index 0d77ae2f68..9f916235d0 100644 --- a/c/src/lib/libbsp/shared/src/irq-legacy.c +++ b/c/src/lib/libbsp/shared/src/irq-legacy.c @@ -14,8 +14,10 @@ * Germany * rtems@embedded-brains.de * - * The license and distribution terms for this file may be found in the file - * LICENSE in this distribution or at http://www.rtems.com/license/LICENSE. + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * */ #include <stdbool.h> @@ -26,172 +28,177 @@ #include <bsp/irq-generic.h> typedef struct { - rtems_irq_hdl handler; - void *arg; + rtems_irq_hdl handler; + void *arg; } bsp_interrupt_legacy_entry; typedef struct { - rtems_irq_hdl handler; - void *handler_arg; - bsp_interrupt_legacy_entry *legacy_handler_arg; + rtems_irq_hdl handler; + void *handler_arg; + bsp_interrupt_legacy_entry *legacy_handler_arg; } bsp_interrupt_legacy_iterate_entry; -static void bsp_interrupt_legacy_dispatch( rtems_vector_number vector, void *arg) +static void bsp_interrupt_legacy_dispatch(rtems_vector_number vector, void *arg) { - bsp_interrupt_legacy_entry *e = (bsp_interrupt_legacy_entry *) arg; - e->handler( e->arg); + bsp_interrupt_legacy_entry *e = (bsp_interrupt_legacy_entry *) arg; + e->handler(e->arg); } static void bsp_interrupt_legacy_per_handler_routine( - void *arg, - const char *info, - rtems_option options, - rtems_interrupt_handler handler, - void *handler_arg + void *arg, + const char *info, + rtems_option options, + rtems_interrupt_handler handler, + void *handler_arg ) { - bsp_interrupt_legacy_iterate_entry *ie = (bsp_interrupt_legacy_iterate_entry *) arg; - bsp_interrupt_legacy_entry *e = NULL; - - if (handler == bsp_interrupt_legacy_dispatch) { - e = (bsp_interrupt_legacy_entry *) handler_arg; - if (e->handler == ie->handler && e->arg == ie->handler_arg) { - ie->legacy_handler_arg = e; - } - } + bsp_interrupt_legacy_iterate_entry *ie = + (bsp_interrupt_legacy_iterate_entry *) arg; + bsp_interrupt_legacy_entry *e = NULL; + + if (handler == bsp_interrupt_legacy_dispatch) { + e = (bsp_interrupt_legacy_entry *) handler_arg; + if (e->handler == ie->handler && e->arg == ie->handler_arg) { + ie->legacy_handler_arg = e; + } + } } /** * @deprecated Obsolete. */ -int BSP_get_current_rtems_irq_handler( rtems_irq_connect_data *cd) +int BSP_get_current_rtems_irq_handler(rtems_irq_connect_data *cd) { - cd->hdl = NULL; - cd->handle = NULL; - cd->on = NULL; - cd->off = NULL; - cd->isOn = NULL; + cd->hdl = NULL; + cd->handle = NULL; + cd->on = NULL; + cd->off = NULL; + cd->isOn = NULL; - return 1; + return 1; } /** * @deprecated Use rtems_interrupt_handler_install() instead. */ -int BSP_install_rtems_irq_handler( const rtems_irq_connect_data *cd) +int BSP_install_rtems_irq_handler(const rtems_irq_connect_data *cd) { - rtems_status_code sc = RTEMS_SUCCESSFUL; - bsp_interrupt_legacy_entry *e = malloc( sizeof( bsp_interrupt_legacy_entry)); - - if (e == NULL) { - return 0; - } - - e->handler = cd->hdl; - e->arg = cd->handle; - - sc = rtems_interrupt_handler_install( - cd->name, - "Unique interrupt handler (installed with obsolete BSP_install_rtems_irq_handler())", - RTEMS_INTERRUPT_UNIQUE, - bsp_interrupt_legacy_dispatch, - e - ); - if (sc != RTEMS_SUCCESSFUL) { - free( e); - return 0; - } - - if (cd->on != NULL) { - cd->on( cd); - } - - return 1; + rtems_status_code sc = RTEMS_SUCCESSFUL; + bsp_interrupt_legacy_entry *e = malloc(sizeof( bsp_interrupt_legacy_entry)); + + if (e == NULL) { + return 0; + } + + e->handler = cd->hdl; + e->arg = cd->handle; + + sc = rtems_interrupt_handler_install( + cd->name, + "Unique interrupt handler " + "(installed with obsolete BSP_install_rtems_irq_handler())", + RTEMS_INTERRUPT_UNIQUE, + bsp_interrupt_legacy_dispatch, + e + ); + if (sc != RTEMS_SUCCESSFUL) { + free(e); + return 0; + } + + if (cd->on != NULL) { + cd->on(cd); + } + + return 1; } /** * @deprecated Use rtems_interrupt_handler_install() instead. */ -int BSP_install_rtems_shared_irq_handler( const rtems_irq_connect_data *cd) +int BSP_install_rtems_shared_irq_handler(const rtems_irq_connect_data *cd) { - rtems_status_code sc = RTEMS_SUCCESSFUL; - bsp_interrupt_legacy_entry *e = malloc( sizeof( bsp_interrupt_legacy_entry)); - - if (e == NULL) { - return 0; - } - - e->handler = cd->hdl; - e->arg = cd->handle; - - sc = rtems_interrupt_handler_install( - cd->name, - "Shared interrupt handler (installed with obsolete BSP_install_rtems_shared_irq_handler())", - RTEMS_INTERRUPT_SHARED, - bsp_interrupt_legacy_dispatch, - e - ); - if (sc != RTEMS_SUCCESSFUL) { - free( e); - return 0; - } - - if (cd->on != NULL) { - cd->on( cd); - } - - return 1; + rtems_status_code sc = RTEMS_SUCCESSFUL; + bsp_interrupt_legacy_entry *e = malloc(sizeof( bsp_interrupt_legacy_entry)); + + if (e == NULL) { + return 0; + } + + e->handler = cd->hdl; + e->arg = cd->handle; + + sc = rtems_interrupt_handler_install( + cd->name, + "Shared interrupt handler " + "(installed with obsolete BSP_install_rtems_shared_irq_handler())", + RTEMS_INTERRUPT_SHARED, + bsp_interrupt_legacy_dispatch, + e + ); + if (sc != RTEMS_SUCCESSFUL) { + free(e); + return 0; + } + + if (cd->on != NULL) { + cd->on(cd); + } + + return 1; } /** * @deprecated Use rtems_interrupt_handler_remove() instead. */ -int BSP_remove_rtems_irq_handler( const rtems_irq_connect_data *cd) +int BSP_remove_rtems_irq_handler(const rtems_irq_connect_data *cd) { - rtems_status_code sc = RTEMS_SUCCESSFUL; - bsp_interrupt_legacy_iterate_entry e = { - .handler = cd->hdl, - .handler_arg = cd->handle, - .legacy_handler_arg = NULL - }; + rtems_status_code sc = RTEMS_SUCCESSFUL; + bsp_interrupt_legacy_iterate_entry e = { + .handler = cd->hdl, + .handler_arg = cd->handle, + .legacy_handler_arg = NULL + }; - sc = rtems_interrupt_handler_iterate( cd->name, bsp_interrupt_legacy_per_handler_routine, &e); - if (sc != RTEMS_SUCCESSFUL) { - return 0; - } + sc = rtems_interrupt_handler_iterate( + cd->name, bsp_interrupt_legacy_per_handler_routine, &e); + if (sc != RTEMS_SUCCESSFUL) { + return 0; + } - if (e.legacy_handler_arg == NULL) { - return 0; - } + if (e.legacy_handler_arg == NULL) { + return 0; + } - if (cd->off != NULL) { - cd->off( cd); - } + if (cd->off != NULL) { + cd->off(cd); + } - sc = rtems_interrupt_handler_remove( cd->name, bsp_interrupt_legacy_dispatch, e.legacy_handler_arg); + sc = rtems_interrupt_handler_remove( + cd->name, bsp_interrupt_legacy_dispatch, e.legacy_handler_arg); - free( e.legacy_handler_arg); + free(e.legacy_handler_arg); - if (sc != RTEMS_SUCCESSFUL) { - return 0; - } + if (sc != RTEMS_SUCCESSFUL) { + return 0; + } - return 1; + return 1; } /** * @deprecated Use bsp_interrupt_initialize() instead. */ -int BSP_rtems_irq_mngt_set( rtems_irq_global_settings *config) +int BSP_rtems_irq_mngt_set(rtems_irq_global_settings *config) { - return 0; + return 0; } /** * @deprecated Obsolete. */ -int BSP_rtems_irq_mngt_get( rtems_irq_global_settings **config) +int BSP_rtems_irq_mngt_get(rtems_irq_global_settings **config) { - *config = NULL; - return 0; + *config = NULL; + return 0; } |