Add support new target: ST Nucleo-L152RE Official mbed Real Time Operating System based on the RTX implementation of the CMSIS-RTOS API open standard.
Fork of mbed-rtos by
rtos/Semaphore.cpp
- Committer:
- emilmont
- Date:
- 2012-11-23
- Revision:
- 6:350b53afb889
- Child:
- 8:88a1a9c26ae3
File content as of revision 6:350b53afb889:
#include "Semaphore.h"
#include <string.h>
#include "error.h"
namespace rtos {
Semaphore::Semaphore(int32_t count) {
#ifdef CMSIS_OS_RTX
memset(_semaphore_data, 0, sizeof(_semaphore_data));
_osSemaphoreDef.semaphore = _semaphore_data;
#endif
_osSemaphoreId = osSemaphoreCreate(&_osSemaphoreDef, count);
}
int32_t Semaphore::wait(uint32_t millisec) {
return osSemaphoreWait(_osSemaphoreId, millisec);
}
osStatus Semaphore::release(void) {
return osSemaphoreRelease(_osSemaphoreId);
}
Semaphore::~Semaphore() {
osSemaphoreDelete(_osSemaphoreId);
}
}
