sam7fc/include/rtos/semaphore.h

23 lines
481 B
C
Raw Normal View History

2008-02-23 00:25:31 +01:00
#ifndef _SEMSPHORE_H_
#define _SEMSPHORE_H_
#include <stdint.h>
#include "rtos/context.h"
#include "rtos/spinlock.h"
struct semaphore {
struct context *sleep_queue;
struct spinlock lock;
int32_t count;
2008-02-23 00:25:31 +01:00
};
uint8_t sem_wait(struct semaphore *sem);
2008-02-23 00:25:31 +01:00
void sem_post(struct semaphore *sem);
void sem_interrupt(struct semaphore *sem, struct context *c);
int32_t sem_get_count(struct semaphore *sem);
void sem_init(struct semaphore *sem, int32_t count);
2008-02-23 00:25:31 +01:00
#endif /* _SEMSPHORE_H_ */