#include <event.h>
Defines | |
#define | _ASYNC_H 1 |
Functions | |
void | atomic_begin () |
void | atomic_end () |
int16_t | continuation () |
int16_t | sch_continuation (int16_t resid, void(*app_handler)(event_t event, void *cbargs, void *context), void *resource, void *context) |
int16_t | async_irqbind (int16_t intr_enum, void(*async_io_handler)(event_t event, void *cbargs, void *context), void *resource, void *context) |
int16_t | async_irqunbind (int16_t intr_enum) |
int16_t | continuation_close (int16_t id) |
#define _ASYNC_H 1 |
int16_t async_irqbind | ( | int16_t | intr_enum, | |
void(*)(event_t event, void *cbargs, void *context) | async_io_handler, | |||
void * | resource, | |||
void * | context | |||
) |
Bind a callback handler to a particular interrupt vector that are partially used by or shared with the kernel. Kernel services that requires interrupt context notification should use this to bind with notification handler. Note that this API is platform dependent and the handler will be fired within interrupt context. Once bind has called, subsequent call of this function will replace the old handler with a new handler.
[in] | intr_enum | platform dependent interrupt enumeration number. Refer to InterruptTypesEnum for details. |
[in] | async_handler | the continuation callback handler that will be fired in interrupt context. If NULL is passed here, the call will fail. |
[in] | resource | pass NULL, will be ignored |
[in] | context | pass NULL, will be igonred |
[in] | event | type is ASYNC_IO in EventsEnum. subtype defines which interrupt is firing using InterruptTypesEnum defined in platform specific header files. |
[in] | cbargs | return NULL |
[in] | context | return NULL |
int16_t async_irqunbind | ( | int16_t | intr_enum | ) |
Unbind a previously installed callback handler to a particular interrupt vector that are partially used by or shared with the kernel. Note that this API is platform dependent and the handler will be fired within interrupt context. Once unbind has called, subsequent interrupts firing will not be notified.
[in] | intr_enum | platform dependent interrupt enumeration number. Refer to InterruptTypesEnum for details. |
void atomic_begin | ( | ) |
Disable global interrupt for the start of a critical section.
void atomic_end | ( | ) |
Enable global interrupt for the end of a critical section.
int16_t continuation | ( | ) |
Request a unique resource identifier that enables scheduling a continatuion from the interrupt context to Arch Rock's application context. Note this call is safe to be invoked in the interrupt context.
int16_t continuation_close | ( | int16_t | id | ) |
A system call that closes a continuation identifier so that it may be reused. This is safe to be called within the interrupt context.
int16_t sch_continuation | ( | int16_t | resid, | |
void(*)(event_t event, void *cbargs, void *context) | app_handler, | |||
void * | resource, | |||
void * | context | |||
) |
To schedule a continatuion from the interrupt context to Arch Rock's application context. Note this call is safe to be invoked in the interrupt context.
[in] | resid | a valid resouce id return by continuation(). |
[in] | app_handler | the continuation callback handler that will be fired in application context. If NULL is passed here, the call will fail. |
[in] | resource | no requirement here. |
[in] | context | user context |
[in] | event | Type is SCH_CONTINUATION in EventsEnum. |
[in] | cbargs | return resource in sch_continuation(). |
[in] | context | return context in sch_continuation(). |
#include <sys/async.h> int16_t g_resid; void __TIMER1_OVF_vect() { // interrupt context code g_resid = continuation(); sch_continuation(g_resid, user_handler, NULL, NULL); } void user_handler(event_t event, void * cbaargs, void * context) { // ... user context action here }