sam7fc/include/rtos/context.h

28 lines
565 B
C

#ifndef _CONTEXT_H_
#define _CONTEXT_H_
#include <stdint.h>
#include "rtos/spinlock.h"
enum state_t {
CONTEXT_NULL = 0x00,
CONTEXT_RUNNING,
CONTEXT_READY,
CONTEXT_INTERRUPTED,
CONTEXT_SLEEP,
CONTEXT_SLEEP_QUEUE,
};
struct context {
state_t state;
uint8_t priority;
uint32_t spinlock_held;
uint32_t dummy;
};
uint32_t context_wait_priority_queue(struct spinlock *lock, struct context **queue);
uint32_t context_signal_queue(struct context **queue);
uint32_t context_interrupt_queue(struct context *c, struct context **queue);
#endif /* _CONTEXT_H_ */