|
ginnOS
The reference: libc, the libraries and the kernel
|
#include "kernel/sync/completion.h"#include "arch/arch.h"#include "kernel/klog/klog.h"#include "kernel/process/process.h"#include "kernel/scheduler/scheduler.h"Macros | |
| #define | CHECK_MS 50u |
| #define | SPINS_PER_MS 20000u |
| #define | SPIN_BEFORE_SLEEP 200u |
Functions | |
| void | completion_init (completion_t *completion, const char *name, bool use_irq) |
| initialize a completion. | |
| void | completion_signal (completion_t *completion) |
| the device has something to report. | |
| bool | completion_wait_until (completion_t *completion, completion_ready_t ready, void *context, uint32_t timeout_ms) |
| wait until ready(context) returns true. | |
| #define CHECK_MS 50u |
| #define SPINS_PER_MS 20000u |
| #define SPIN_BEFORE_SLEEP 200u |
| void completion_init | ( | completion_t * | completion, |
| const char * | name, | ||
| bool | use_irq ) |
initialize a completion.
call once (it registers a timed queue).
| use_irq | true if the driver has an interrupt handler. |
| void completion_signal | ( | completion_t * | completion | ) |
the device has something to report.
safe in an interrupt handler.
| bool completion_wait_until | ( | completion_t * | completion, |
| completion_ready_t | ready, | ||
| void * | context, | ||
| uint32_t | timeout_ms ) |
wait until ready(context) returns true.
| timeout_ms | how long the device may take. |