![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Ethernet test for ECE 4180 and others to find your IP address and do a simple HTTP GET request over port 80.
Dependencies: mbed Socket lwip-eth lwip-sys lwip
Diff: mbed-rtos/rtos/Mutex.cpp
- Revision:
- 0:e7ca326e76ee
diff -r 000000000000 -r e7ca326e76ee mbed-rtos/rtos/Mutex.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos/rtos/Mutex.cpp Thu Apr 04 05:26:09 2013 +0000 @@ -0,0 +1,35 @@ +#include "Mutex.h" + +#include <string.h> +#include "error.h" + +namespace rtos { + +Mutex::Mutex() { +#ifdef CMSIS_OS_RTX + memset(_mutex_data, 0, sizeof(_mutex_data)); + _osMutexDef.mutex = _mutex_data; +#endif + _osMutexId = osMutexCreate(&_osMutexDef); + if (_osMutexId == NULL) { + error("Error initializing the mutex object\n"); + } +} + +osStatus Mutex::lock(uint32_t millisec) { + return osMutexWait(_osMutexId, millisec); +} + +bool Mutex::trylock() { + return (osMutexWait(_osMutexId, 0) == osOK); +} + +osStatus Mutex::unlock() { + return osMutexRelease(_osMutexId); +} + +Mutex::~Mutex() { + osMutexDelete(_osMutexId); +} + +}