From effceea22915a087c1c85ff30d2e62110413edaf Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Thu, 23 Oct 2008 13:13:00 +0000 Subject: Remove the event object in the kernel since it's rather extraneous at the moment. This makes the codecs and the plugins incompatible, so update fully. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18867 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/config.h | 1 - firmware/export/kernel.h | 18 -------- firmware/kernel.c | 117 ----------------------------------------------- 3 files changed, 136 deletions(-) (limited to 'firmware') diff --git a/firmware/export/config.h b/firmware/export/config.h index 73ecca1495..e425bf98e5 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -409,7 +409,6 @@ #endif /* SIMULATOR */ #define HAVE_SEMAPHORE_OBJECTS -#define HAVE_EVENT_OBJECTS #ifdef TOSHIBA_GIGABEAT_F #define HAVE_WAKEUP_OBJECTS diff --git a/firmware/export/kernel.h b/firmware/export/kernel.h index 1824962dfd..51eb635004 100644 --- a/firmware/export/kernel.h +++ b/firmware/export/kernel.h @@ -176,17 +176,6 @@ struct semaphore }; #endif -#ifdef HAVE_EVENT_OBJECTS -struct event -{ - struct thread_entry *queues[2]; /* waiters for each state */ - unsigned char automatic; /* event performs auto-reset */ - unsigned char state; /* state: 1 = signaled */ - IF_COP( struct corelock cl; ) /* multiprocessor sync */ -}; -#endif - - #ifdef HAVE_WAKEUP_OBJECTS struct wakeup { @@ -286,13 +275,6 @@ extern void semaphore_init(struct semaphore *s, int max, int start); extern void semaphore_wait(struct semaphore *s); extern void semaphore_release(struct semaphore *s); #endif /* HAVE_SEMAPHORE_OBJECTS */ -#ifdef HAVE_EVENT_OBJECTS -#define EVENT_AUTOMATIC 0x10 -#define EVENT_MANUAL 0x00 -extern void event_init(struct event *e, unsigned int flags); -extern void event_wait(struct event *e, unsigned int for_state); -extern void event_set_state(struct event *e, unsigned int state); -#endif /* HAVE_EVENT_OBJECTS */ #ifdef HAVE_WAKEUP_OBJECTS extern void wakeup_init(struct wakeup *w); diff --git a/firmware/kernel.c b/firmware/kernel.c index 10efb87cf4..fb9c5e2449 100644 --- a/firmware/kernel.c +++ b/firmware/kernel.c @@ -1264,122 +1264,6 @@ void semaphore_release(struct semaphore *s) } #endif /* HAVE_SEMAPHORE_OBJECTS */ -/**************************************************************************** - * Simple event functions ;) - ****************************************************************************/ -#ifdef HAVE_EVENT_OBJECTS -void event_init(struct event *e, unsigned int flags) -{ - e->queues[STATE_NONSIGNALED] = NULL; - e->queues[STATE_SIGNALED] = NULL; - e->state = flags & STATE_SIGNALED; - e->automatic = (flags & EVENT_AUTOMATIC) ? 1 : 0; - corelock_init(&e->cl); -} - -void event_wait(struct event *e, unsigned int for_state) -{ - struct thread_entry *current; - - corelock_lock(&e->cl); - - if(e->automatic != 0) - { - /* wait for false always satisfied by definition - or if it just changed to false */ - if(e->state == STATE_SIGNALED || for_state == STATE_NONSIGNALED) - { - /* automatic - unsignal */ - e->state = STATE_NONSIGNALED; - corelock_unlock(&e->cl); - return; - } - /* block until state matches */ - } - else if(for_state == e->state) - { - /* the state being waited for is the current state */ - corelock_unlock(&e->cl); - return; - } - - /* block until state matches what callers requests */ - current = cores[CURRENT_CORE].running; - - IF_COP( current->obj_cl = &e->cl; ) - current->bqp = &e->queues[for_state]; - - disable_irq(); - block_thread(current); - - corelock_unlock(&e->cl); - - /* turn control over to next thread */ - switch_thread(); -} - -void event_set_state(struct event *e, unsigned int state) -{ - unsigned int result; - int oldlevel; - - corelock_lock(&e->cl); - - if(e->state == state) - { - /* no change */ - corelock_unlock(&e->cl); - return; - } - - IF_PRIO( result = THREAD_OK; ) - - oldlevel = disable_irq_save(); - - if(state == STATE_SIGNALED) - { - if(e->automatic != 0) - { - /* no thread should have ever blocked for nonsignaled */ - KERNEL_ASSERT(e->queues[STATE_NONSIGNALED] == NULL, - "set_event_state->queue[NS]:S\n"); - /* pass to next thread and keep unsignaled - "pulse" */ - result = wakeup_thread(&e->queues[STATE_SIGNALED]); - e->state = (result & THREAD_OK) ? STATE_NONSIGNALED : STATE_SIGNALED; - } - else - { - /* release all threads waiting for signaled */ - e->state = STATE_SIGNALED; - IF_PRIO( result = ) - thread_queue_wake(&e->queues[STATE_SIGNALED]); - } - } - else - { - /* release all threads waiting for nonsignaled */ - - /* no thread should have ever blocked if automatic */ - KERNEL_ASSERT(e->queues[STATE_NONSIGNALED] == NULL || - e->automatic == 0, "set_event_state->queue[NS]:NS\n"); - - e->state = STATE_NONSIGNALED; - IF_PRIO( result = ) - thread_queue_wake(&e->queues[STATE_NONSIGNALED]); - } - - restore_irq(oldlevel); - - corelock_unlock(&e->cl); - -#ifdef HAVE_PRIORITY_SCHEDULING - if(result & THREAD_SWITCH) - switch_thread(); -#endif -} -#endif /* HAVE_EVENT_OBJECTS */ - - #ifdef HAVE_WAKEUP_OBJECTS /**************************************************************************** * Lightweight IRQ-compatible wakeup object @@ -1456,4 +1340,3 @@ int wakeup_signal(struct wakeup *w) return ret; } #endif /* HAVE_WAKEUP_OBJECTS */ - -- cgit v1.2.3