aboutsummaryrefslogtreecommitdiffstats
path: root/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/arch
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-09-20 18:39:37 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-09-20 18:39:37 +0000
commita1053d5dc1e161f30debbbc12366364d5e2ec26b (patch)
treeea0b23a9f452393e20d859629016aa486d4b29c1 /demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/arch
parente8bbaf0cbaf3213f17eba846b9beac9741e16ba4 (diff)
downloadChibiOS-a1053d5dc1e161f30debbbc12366364d5e2ec26b.tar.gz
ChibiOS-a1053d5dc1e161f30debbbc12366364d5e2ec26b.tar.bz2
ChibiOS-a1053d5dc1e161f30debbbc12366364d5e2ec26b.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1174 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/arch')
-rw-r--r--demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/arch/sys_arch.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/arch/sys_arch.c b/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/arch/sys_arch.c
index 8248eed72..414b434a6 100644
--- a/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/arch/sys_arch.c
+++ b/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/arch/sys_arch.c
@@ -88,8 +88,10 @@ u32_t sys_arch_sem_wait(sys_sem_t sem, u32_t timeout) {
chSysLock();
time = chTimeNow();
- chSemWaitTimeoutS(sem, (systime_t)timeout);
- time = chTimeNow() - time;
+ if (chSemWaitTimeoutS(sem, (systime_t)timeout) != RDY_OK)
+ time = SYS_ARCH_TIMEOUT;
+ else
+ time = chTimeNow() - time;
chSysUnlock();
return time;
}
@@ -120,17 +122,23 @@ err_t sys_mbox_trypost(sys_mbox_t mbox, void *msg) {
}
u32_t sys_arch_mbox_fetch(sys_mbox_t mbox, void **msg, u32_t timeout) {
+ systime_t time;
- if (chMBFetchS(mbox, (msg_t *)msg, (systime_t)timeout) == RDY_TIMEOUT)
- return ERR_MEM;
- return ERR_OK;
+ chSysLock();
+ time = chTimeNow();
+ if (chMBFetchS(mbox, (msg_t *)msg, (systime_t)timeout) != RDY_OK)
+ time = SYS_ARCH_TIMEOUT;
+ else
+ time = chTimeNow() - time;
+ chSysUnlock();
+ return time;
}
u32_t sys_arch_mbox_tryfetch(sys_mbox_t mbox, void **msg) {
- if (chMBFetchS(mbox, (msg_t *)msg, TIME_IMMEDIATE) == RDY_TIMEOUT)
- return ERR_MEM;
- return ERR_OK;
+ if (chMBFetch(mbox, (msg_t *)msg, TIME_IMMEDIATE) == RDY_TIMEOUT)
+ return SYS_MBOX_EMPTY;
+ return 0;
}
struct sys_timeouts *sys_arch_timeouts(void) {