|
From: | address@hidden |
Subject: | Re: [lwip-devel] core/timers.c with NO_SYS? |
Date: | Sun, 12 Jun 2011 14:13:36 +0200 |
User-agent: | Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; de; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 |
Hi Leon, Leon Woestenberg wrote:
As I said, please don't let the name of that function confuse you. It's actually not a sys_arch layer function but a port function. In an embedded target, it's enough to set up a hardware counter to tick every millisecond and let sys_now() return that counter value. That has absolutely *nothing* to do with an OS layer. As such, the actual "bug" here, to me, is only a question of which name we give that function. I only chose sys_now() because it was already there and I didn't want to break old ports unnecessarily (which already might have implemented sys_now()).I still don't understand; how can it be we *must* implement a sys_arch layer function when NO_SYS is set?
Aside from that, how do you propose to implement a generic timer framework without knowing the time? You do need a port-dependent function to get the time for that.
If you see it that way, the architecture is already broken as SYS_ARCH_PROTECT() is used in mem.c, memp.c and pbuf.c (and is included in many more, where it does not seem to be needed). Mem.c even uses semaphores, so I guess it's not a core architecture module, as well. However, I think that even for NO_SYS==1 ports, SYS_ARCH_PROTECT may be needed when locking application against interrupt level. So to me, this is also not a strict OS function, rather a port function that locks interrupts. It may be implemented differently when using an OS (i.e. locking the scheduler, too), but it is also useful without an OS.This makes a lower layer (the core API) depend on an optional higher API abstraction layer (sys_arch). This breaks the architecture. This probably explains why NO_SYS_NO_TIMERS is there.... core/timers.c doesn't seem to be a core architecture module this way.
As such, it seems to me that we should sort out our sys.h/sys_arch.h handling instead of trying to argument away the need for a function returning the time or where it is defined.
BTW: Bug #33544 is also a result of a suboptimal sys.h layout which defines some things to u8_t or void for NO_SYS==1.
Simon
[Prev in Thread] | Current Thread | [Next in Thread] |