public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] MS_TICKS() revisited
@ 2001-02-09 11:14 Grant Edwards
  2001-02-09 11:50 ` Jonathan Larmour
  0 siblings, 1 reply; 11+ messages in thread
From: Grant Edwards @ 2001-02-09 11:14 UTC (permalink / raw)
  To: ecos-discuss

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.

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.

-- 
Grant Edwards
grante@visi.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [ECOS] MS_TICKS() revisited
  2001-02-09 11:14 [ECOS] MS_TICKS() revisited Grant Edwards
@ 2001-02-09 11:50 ` Jonathan Larmour
  2001-02-09 11:57   ` Grant Edwards
  2001-02-11 12:18   ` Gary Thomas
  0 siblings, 2 replies; 11+ messages in thread
From: Jonathan Larmour @ 2001-02-09 11:50 UTC (permalink / raw)
  To: Grant Edwards; +Cc: ecos-discuss

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [ECOS] MS_TICKS() revisited
  2001-02-09 11:50 ` Jonathan Larmour
@ 2001-02-09 11:57   ` Grant Edwards
  2001-02-09 12:03     ` Jonathan Larmour
  2001-02-11 12:18   ` Gary Thomas
  1 sibling, 1 reply; 11+ messages in thread
From: Grant Edwards @ 2001-02-09 11:57 UTC (permalink / raw)
  To: Jonathan Larmour; +Cc: ecos-discuss

On Fri, Feb 09, 2001 at 07:50:04PM +0000, Jonathan Larmour wrote:

> 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() ?

IIRC, I was thinking at the time that do_ms_tick() was part of
the networking package.  It isn't, so it probably should be
do_ms_tick().  Now that I think of it, it might be a better
idea to move the definitions for MS_TICKS() and
MS_TICKS_DELAY() from net.h into a more general spot like
redboot.h.  Then we don't need that chunk at all.

-- 
Grant Edwards
grante@visi.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [ECOS] MS_TICKS() revisited
  2001-02-09 11:57   ` Grant Edwards
@ 2001-02-09 12:03     ` Jonathan Larmour
  2001-02-09 12:12       ` Grant Edwards
  0 siblings, 1 reply; 11+ messages in thread
From: Jonathan Larmour @ 2001-02-09 12:03 UTC (permalink / raw)
  To: Grant Edwards; +Cc: ecos-discuss, Gary Thomas

Grant Edwards wrote:
> 
> On Fri, Feb 09, 2001 at 07:50:04PM +0000, Jonathan Larmour wrote:
> 
> > 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() ?
> 
> IIRC, I was thinking at the time that do_ms_tick() was part of
> the networking package.  It isn't, so it probably should be
> do_ms_tick().  Now that I think of it, it might be a better
> idea to move the definitions for MS_TICKS() and
> MS_TICKS_DELAY() from net.h into a more general spot like
> redboot.h.  Then we don't need that chunk at all.

I think that would be fine. If Gary T also agrees (CC'd) could you resubmit
your patch with that change?

Thanks!

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [ECOS] MS_TICKS() revisited
  2001-02-09 12:03     ` Jonathan Larmour
@ 2001-02-09 12:12       ` Grant Edwards
  2001-02-09 14:03         ` Jonathan Larmour
  0 siblings, 1 reply; 11+ messages in thread
From: Grant Edwards @ 2001-02-09 12:12 UTC (permalink / raw)
  To: Jonathan Larmour; +Cc: ecos-discuss, Gary Thomas

On Fri, Feb 09, 2001 at 08:03:29PM +0000, Jonathan Larmour wrote:
> Grant Edwards wrote:
> > > 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() ?
> > 
> > IIRC, I was thinking at the time that do_ms_tick() was part of
> > the networking package.  It isn't, so it probably should be
> > do_ms_tick().  Now that I think of it, it might be a better
> > idea to move the definitions for MS_TICKS() and
> > MS_TICKS_DELAY() from net.h into a more general spot like
> > redboot.h.  Then we don't need that chunk at all.
> 
> I think that would be fine. If Gary T also agrees (CC'd) could you resubmit
> your patch with that change?

Uh, wait, that piece of pre-processor code is in a file
(net_io.c) that is part of the networking package, so we can
ditch it without moving the definitions out of net.h.

I've no idea why I thought that needed to be there.  :/

-- 
Grant Edwards
grante@visi.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [ECOS] MS_TICKS() revisited
  2001-02-09 12:12       ` Grant Edwards
@ 2001-02-09 14:03         ` Jonathan Larmour
  2001-02-09 14:04           ` Grant Edwards
  0 siblings, 1 reply; 11+ messages in thread
From: Jonathan Larmour @ 2001-02-09 14:03 UTC (permalink / raw)
  To: Grant Edwards; +Cc: ecos-discuss

Grant Edwards wrote:
> 
> Uh, wait, that piece of pre-processor code is in a file
> (net_io.c) that is part of the networking package, so we can
> ditch it without moving the definitions out of net.h.

Ack.

I've checked your patch in with appropriate changes. It'll show up in the
next anoncvs snapshot. Thanks!

One teeny favour though: in future can you write a ChangeLog entry? It
saves time and means I don't misrepresent your change :).

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [ECOS] MS_TICKS() revisited
  2001-02-09 14:03         ` Jonathan Larmour
@ 2001-02-09 14:04           ` Grant Edwards
  0 siblings, 0 replies; 11+ messages in thread
From: Grant Edwards @ 2001-02-09 14:04 UTC (permalink / raw)
  To: Jonathan Larmour; +Cc: ecos-discuss

On Fri, Feb 09, 2001 at 10:03:07PM +0000, Jonathan Larmour wrote:
> Grant Edwards wrote:
> > 
> > Uh, wait, that piece of pre-processor code is in a file
> > (net_io.c) that is part of the networking package, so we can
> > ditch it without moving the definitions out of net.h.
> 
> Ack.
> 
> I've checked your patch in with appropriate changes. It'll show up in the
> next anoncvs snapshot. Thanks!
> 
> One teeny favour though: in future can you write a ChangeLog entry? It
> saves time and means I don't misrepresent your change :).

Sure.  I should have thought of that.

-- 
Grant Edwards
grante@visi.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [ECOS] MS_TICKS() revisited
  2001-02-09 11:50 ` Jonathan Larmour
  2001-02-09 11:57   ` Grant Edwards
@ 2001-02-11 12:18   ` Gary Thomas
  2001-02-12  7:30     ` [ECOS] " Grant Edwards
  1 sibling, 1 reply; 11+ messages in thread
From: Gary Thomas @ 2001-02-11 12:18 UTC (permalink / raw)
  To: Jonathan Larmour; +Cc: ecos-discuss, Grant Edwards

On 09-Feb-2001 Jonathan Larmour wrote:
>> 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 :-).
> 

I think there are some uses of 'MS_TICKS()' [the old one] that you've
missed.  In particular, in the xyzModem code - this gets used to allow
time to pass.  Also, ping, and some others I'm sure.

When I get a chance, I'll verify these changes.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [ECOS] Re: MS_TICKS() revisited
  2001-02-11 12:18   ` Gary Thomas
@ 2001-02-12  7:30     ` Grant Edwards
  2001-02-12  7:33       ` Gary Thomas
  0 siblings, 1 reply; 11+ messages in thread
From: Grant Edwards @ 2001-02-12  7:30 UTC (permalink / raw)
  To: Gary Thomas; +Cc: Jonathan Larmour, ecos-discuss

Gary Thomas writes:

> I think there are some uses of 'MS_TICKS()' [the old one] that you've
> missed.  In particular, in the xyzModem code - this gets used to allow
> time to pass.  Also, ping, and some others I'm sure.

In my snapshot of RedBoot (probably a month or two old now), the only
files that contain uses of MS_TICK\x13() are in the sorc/net directory:
arp.c, bootp.c, timers.c, udp.c and net_io.c.  The xyzModem stuff
doesn't, and I'm not sure what "ping" is (in regards to RedBoot, that
is). 

-- 
Grant Edwards
grante@visi.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [ECOS] Re: MS_TICKS() revisited
  2001-02-12  7:30     ` [ECOS] " Grant Edwards
@ 2001-02-12  7:33       ` Gary Thomas
  2001-02-12  9:55         ` Jonathan Larmour
  0 siblings, 1 reply; 11+ messages in thread
From: Gary Thomas @ 2001-02-12  7:33 UTC (permalink / raw)
  To: Grant Edwards; +Cc: ecos-discuss

On 12-Feb-2001 Grant Edwards wrote:
> 
> Gary Thomas writes:
> 
>> I think there are some uses of 'MS_TICKS()' [the old one] that you've
>> missed.  In particular, in the xyzModem code - this gets used to allow
>> time to pass.  Also, ping, and some others I'm sure.
> 
> In my snapshot of RedBoot (probably a month or two old now), the only
> files that contain uses of MS_TICK\x13() are in the sorc/net directory:
> arp.c, bootp.c, timers.c, udp.c and net_io.c.  The xyzModem stuff
> doesn't, and I'm not sure what "ping" is (in regards to RedBoot, that
> is). 

'ping' is a new RedBoot command I added - more or less the functionality
of the desktop program used to check connectivity between network devices.

If your snapshot is more than two weeks old, you won't have it.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [ECOS] Re: MS_TICKS() revisited
  2001-02-12  7:33       ` Gary Thomas
@ 2001-02-12  9:55         ` Jonathan Larmour
  0 siblings, 0 replies; 11+ messages in thread
From: Jonathan Larmour @ 2001-02-12  9:55 UTC (permalink / raw)
  To: Gary Thomas; +Cc: Grant Edwards, ecos-discuss

Gary Thomas wrote:
> 
> 'ping' is a new RedBoot command I added - more or less the functionality
> of the desktop program used to check connectivity between network devices.
> 
> If your snapshot is more than two weeks old, you won't have it.

It's probably not in anoncvs yet. Because of meetings, I've not had a
chance to update it. I'll see if I can today.

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2001-02-12  9:55 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-09 11:14 [ECOS] MS_TICKS() revisited Grant Edwards
2001-02-09 11:50 ` Jonathan Larmour
2001-02-09 11:57   ` Grant Edwards
2001-02-09 12:03     ` Jonathan Larmour
2001-02-09 12:12       ` Grant Edwards
2001-02-09 14:03         ` Jonathan Larmour
2001-02-09 14:04           ` Grant Edwards
2001-02-11 12:18   ` Gary Thomas
2001-02-12  7:30     ` [ECOS] " Grant Edwards
2001-02-12  7:33       ` Gary Thomas
2001-02-12  9:55         ` Jonathan Larmour

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).