mirror of https://github.com/ARMmbed/mbed-os.git
commit
493e3788e3
|
@ -19,7 +19,12 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "UARTSerial.h"
|
#include "UARTSerial.h"
|
||||||
#include "platform/mbed_poll.h"
|
#include "platform/mbed_poll.h"
|
||||||
|
|
||||||
|
#if MBED_CONF_RTOS_PRESENT
|
||||||
|
#include "rtos/Thread.h"
|
||||||
|
#else
|
||||||
#include "platform/mbed_wait_api.h"
|
#include "platform/mbed_wait_api.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
||||||
|
@ -277,6 +282,17 @@ void UARTSerial::tx_irq(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UARTSerial::wait_ms(uint32_t millisec)
|
||||||
|
{
|
||||||
|
/* wait_ms implementation for RTOS spins until exact microseconds - we
|
||||||
|
* want to just sleep until next tick.
|
||||||
|
*/
|
||||||
|
#if MBED_CONF_RTOS_PRESENT
|
||||||
|
rtos::Thread::wait(millisec);
|
||||||
|
#else
|
||||||
|
::wait_ms(millisec);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
} //namespace mbed
|
} //namespace mbed
|
||||||
|
|
||||||
#endif //(DEVICE_SERIAL && DEVICE_INTERRUPTIN)
|
#endif //(DEVICE_SERIAL && DEVICE_INTERRUPTIN)
|
||||||
|
|
|
@ -166,6 +166,8 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
void wait_ms(uint32_t millisec);
|
||||||
|
|
||||||
/** SerialBase lock override */
|
/** SerialBase lock override */
|
||||||
virtual void lock(void);
|
virtual void lock(void);
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ int poll(pollfh fhs[], unsigned nfhs, int timeout)
|
||||||
#ifdef MBED_CONF_RTOS_PRESENT
|
#ifdef MBED_CONF_RTOS_PRESENT
|
||||||
// TODO - proper blocking
|
// TODO - proper blocking
|
||||||
// wait for condition variable, wait queue whatever here
|
// wait for condition variable, wait queue whatever here
|
||||||
rtos::Thread::yield();
|
rtos::Thread::wait(1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
|
|
Loading…
Reference in New Issue