diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-11-04 15:06:17 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-11-04 15:06:17 +0000 |
commit | b2b05acab34c802ba98b0a0f43814e16e326b17d (patch) | |
tree | cd4c6e3db3fd87de860d307245a96b93c7faa4e9 | |
parent | 981e11216a3e1534a403c6844b06f164480c3ff9 (diff) | |
download | ChibiOS-b2b05acab34c802ba98b0a0f43814e16e326b17d.tar.gz ChibiOS-b2b05acab34c802ba98b0a0f43814e16e326b17d.tar.bz2 ChibiOS-b2b05acab34c802ba98b0a0f43814e16e326b17d.zip |
Simplified timeout handling in MAC driver.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10935 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r-- | os/hal/src/hal_mac.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/os/hal/src/hal_mac.c b/os/hal/src/hal_mac.c index 2ae0b677d..03c02cf76 100644 --- a/os/hal/src/hal_mac.c +++ b/os/hal/src/hal_mac.c @@ -151,7 +151,6 @@ msg_t macWaitTransmitDescriptor(MACDriver *macp, MACTransmitDescriptor *tdp,
sysinterval_t timeout) {
msg_t msg;
- systime_t now;
osalDbgCheck((macp != NULL) && (tdp != NULL));
osalDbgAssert(macp->state == MAC_ACTIVE, "not active");
@@ -159,15 +158,11 @@ msg_t macWaitTransmitDescriptor(MACDriver *macp, while (((msg = mac_lld_get_transmit_descriptor(macp, tdp)) != MSG_OK) &&
(timeout > (sysinterval_t)0)) {
osalSysLock();
- now = osalOsGetSystemTimeX();
msg = osalThreadEnqueueTimeoutS(&macp->tdqueue, timeout);
if (msg == MSG_TIMEOUT) {
osalSysUnlock();
break;
}
- if (timeout != TIME_INFINITE) {
- timeout -= (osalOsGetSystemTimeX() - now);
- }
osalSysUnlock();
}
return msg;
@@ -211,23 +206,17 @@ msg_t macWaitReceiveDescriptor(MACDriver *macp, MACReceiveDescriptor *rdp,
sysinterval_t timeout) {
msg_t msg;
- systime_t now;
osalDbgCheck((macp != NULL) && (rdp != NULL));
osalDbgAssert(macp->state == MAC_ACTIVE, "not active");
- while (((msg = mac_lld_get_receive_descriptor(macp, rdp)) != MSG_OK) &&
- (timeout > (sysinterval_t)0)) {
+ while (((msg = mac_lld_get_receive_descriptor(macp, rdp)) != MSG_OK)) {
osalSysLock();
- now = osalOsGetSystemTimeX();
msg = osalThreadEnqueueTimeoutS(&macp->rdqueue, timeout);
if (msg == MSG_TIMEOUT) {
osalSysUnlock();
break;
}
- if (timeout != TIME_INFINITE) {
- timeout -= (osalOsGetSystemTimeX() - now);
- }
osalSysUnlock();
}
return msg;
|