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
mbed-rtos/rtos/Mutex.cpp@0:e7ca326e76ee, 2013-04-04 (annotated)
- Committer:
- mkersh3
- Date:
- Thu Apr 04 05:26:09 2013 +0000
- Revision:
- 0:e7ca326e76ee
Ethernet Test for ECE4180 and others to find their IP Address and do a simple HTTP GET request over port 80.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mkersh3 | 0:e7ca326e76ee | 1 | #include "Mutex.h" |
mkersh3 | 0:e7ca326e76ee | 2 | |
mkersh3 | 0:e7ca326e76ee | 3 | #include <string.h> |
mkersh3 | 0:e7ca326e76ee | 4 | #include "error.h" |
mkersh3 | 0:e7ca326e76ee | 5 | |
mkersh3 | 0:e7ca326e76ee | 6 | namespace rtos { |
mkersh3 | 0:e7ca326e76ee | 7 | |
mkersh3 | 0:e7ca326e76ee | 8 | Mutex::Mutex() { |
mkersh3 | 0:e7ca326e76ee | 9 | #ifdef CMSIS_OS_RTX |
mkersh3 | 0:e7ca326e76ee | 10 | memset(_mutex_data, 0, sizeof(_mutex_data)); |
mkersh3 | 0:e7ca326e76ee | 11 | _osMutexDef.mutex = _mutex_data; |
mkersh3 | 0:e7ca326e76ee | 12 | #endif |
mkersh3 | 0:e7ca326e76ee | 13 | _osMutexId = osMutexCreate(&_osMutexDef); |
mkersh3 | 0:e7ca326e76ee | 14 | if (_osMutexId == NULL) { |
mkersh3 | 0:e7ca326e76ee | 15 | error("Error initializing the mutex object\n"); |
mkersh3 | 0:e7ca326e76ee | 16 | } |
mkersh3 | 0:e7ca326e76ee | 17 | } |
mkersh3 | 0:e7ca326e76ee | 18 | |
mkersh3 | 0:e7ca326e76ee | 19 | osStatus Mutex::lock(uint32_t millisec) { |
mkersh3 | 0:e7ca326e76ee | 20 | return osMutexWait(_osMutexId, millisec); |
mkersh3 | 0:e7ca326e76ee | 21 | } |
mkersh3 | 0:e7ca326e76ee | 22 | |
mkersh3 | 0:e7ca326e76ee | 23 | bool Mutex::trylock() { |
mkersh3 | 0:e7ca326e76ee | 24 | return (osMutexWait(_osMutexId, 0) == osOK); |
mkersh3 | 0:e7ca326e76ee | 25 | } |
mkersh3 | 0:e7ca326e76ee | 26 | |
mkersh3 | 0:e7ca326e76ee | 27 | osStatus Mutex::unlock() { |
mkersh3 | 0:e7ca326e76ee | 28 | return osMutexRelease(_osMutexId); |
mkersh3 | 0:e7ca326e76ee | 29 | } |
mkersh3 | 0:e7ca326e76ee | 30 | |
mkersh3 | 0:e7ca326e76ee | 31 | Mutex::~Mutex() { |
mkersh3 | 0:e7ca326e76ee | 32 | osMutexDelete(_osMutexId); |
mkersh3 | 0:e7ca326e76ee | 33 | } |
mkersh3 | 0:e7ca326e76ee | 34 | |
mkersh3 | 0:e7ca326e76ee | 35 | } |