This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: MS_TICKS() revisited


Grant Edwards wrote:
> 
> I've modified my ms_ticks stuff so that there are two routines.
> Both return the current system time, but one delays for a
> millisecond and the other doesn't.
> 
> do_ms_tick()      // delays for 1ms, returns system time
> get_ms_ticks()    // returns system time
> 
> #define MS_TICKS()  get_ms_ticks()
> #define MS_TICKS_DELAY() -> do_ms_tick()
> 
> This saves a few milliseconds of overhead here and there
> (nothing worth worrying about), but mostly it makes it clear
> whether the caller wants to delay for a millisecond or just to
> read the system time.
> 
> Attached is a patch against CVS sources for anybody who wants it.
> 
> I've only done limited testing, so it's possible I'm missing a
> delay where I need one.  IOW, there may be an MS_TICKS() that
> should be MS_TICKS_DELAY() -- but I don't think so.

Thanks for the patch. One query before I apply it:

+#if !defined(CYGPKG_REDBOOT_NETWORKING)
+#define MS_TICKS_DELAY() hal_delay_us(1000)
+#endif
+

Any reason this isn't do_ms_tick() ?

> NB: this patch also includes a fix to net_io_getc_nonblock() so
>     that it always sets its return value properly.  AFAICT, the
>     old version worked OK because whatever happened to be left
>     in R0 when the function fell off the bottom always had a
>     non-zero.

I've already fixed this in the repository, so Gary, if you get there before
I do, be warned :-).

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]