nexus: Add DISABLE_INTERRUPT_EXTENSION

Add an easy way to avoid the interrupt extension API for BSPs that do
not support it.
This commit is contained in:
Sebastian Huber 2014-08-29 11:15:00 +02:00
parent 7e982cf603
commit e96e008c66

View File

@ -52,6 +52,8 @@
#include <rtems/bsd/bsd.h> #include <rtems/bsd/bsd.h>
#include <rtems/irq-extension.h> #include <rtems/irq-extension.h>
/* #define DISABLE_INTERRUPT_EXTENSION */
RTEMS_STATIC_ASSERT(SYS_RES_MEMORY == RTEMS_BSD_RES_MEMORY, RTEMS_BSD_RES_MEMORY); RTEMS_STATIC_ASSERT(SYS_RES_MEMORY == RTEMS_BSD_RES_MEMORY, RTEMS_BSD_RES_MEMORY);
RTEMS_STATIC_ASSERT(SYS_RES_IRQ == RTEMS_BSD_RES_IRQ, RTEMS_BSD_RES_IRQ); RTEMS_STATIC_ASSERT(SYS_RES_IRQ == RTEMS_BSD_RES_IRQ, RTEMS_BSD_RES_IRQ);
@ -69,6 +71,7 @@ nexus_probe(device_t dev)
device_set_desc(dev, "RTEMS Nexus device"); device_set_desc(dev, "RTEMS Nexus device");
#ifndef DISABLE_INTERRUPT_EXTENSION
status = rtems_interrupt_server_initialize( status = rtems_interrupt_server_initialize(
BSD_TASK_PRIORITY_INTERRUPT, BSD_TASK_PRIORITY_INTERRUPT,
BSD_MINIMUM_TASK_STACK_SIZE, BSD_MINIMUM_TASK_STACK_SIZE,
@ -77,6 +80,7 @@ nexus_probe(device_t dev)
NULL NULL
); );
BSD_ASSERT(status == RTEMS_SUCCESSFUL); BSD_ASSERT(status == RTEMS_SUCCESSFUL);
#endif
mem_rman.rm_start = 0; mem_rman.rm_start = 0;
mem_rman.rm_end = ~0UL; mem_rman.rm_end = ~0UL;
@ -197,6 +201,7 @@ nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags,
driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep) driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep)
{ {
int err; int err;
#ifndef DISABLE_INTERRUPT_EXTENSION
struct nexus_intr *ni; struct nexus_intr *ni;
ni = malloc(sizeof(*ni), M_TEMP, M_WAITOK); ni = malloc(sizeof(*ni), M_TEMP, M_WAITOK);
@ -232,6 +237,9 @@ nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags,
} else { } else {
err = ENOMEM; err = ENOMEM;
} }
#else
err = EINVAL;
#endif
return (err); return (err);
} }
@ -241,6 +249,7 @@ nexus_teardown_intr(device_t dev, device_t child, struct resource *res,
void *cookie) void *cookie)
{ {
int err; int err;
#ifndef DISABLE_INTERRUPT_EXTENSION
struct nexus_intr *ni; struct nexus_intr *ni;
rtems_status_code sc; rtems_status_code sc;
rtems_interrupt_handler rh; rtems_interrupt_handler rh;
@ -260,6 +269,9 @@ nexus_teardown_intr(device_t dev, device_t child, struct resource *res,
rman_get_start(res), device_get_nameunit(child), rman_get_start(res), device_get_nameunit(child),
RTEMS_INTERRUPT_UNIQUE, rh, ra); RTEMS_INTERRUPT_UNIQUE, rh, ra);
err = sc == RTEMS_SUCCESSFUL ? 0 : EINVAL; err = sc == RTEMS_SUCCESSFUL ? 0 : EINVAL;
#else
err = EINVAL;
#endif
return (err); return (err);
} }