From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonathan Larmour To: Grant Edwards Cc: ecos-discuss@sources.redhat.com Subject: Re: [ECOS] MS_TICKS() revisited Date: Fri, 09 Feb 2001 11:50:00 -0000 Message-id: <3A8449EC.9545FBB6@redhat.com> References: <20010209131835.A4738@visi.com> X-SW-Source: 2001-02/msg00156.html 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