--- In "marcolamonato" <> wrote:
>
> --- In Jim Jackson <jj@> wrote:
> >
> >
> >
> >
> > On Tue, 18 Mar 2008, marcolamonato wrote:
> >
> > > Hi,
> > >
> > > I've got a TS-7250 with RTC installed
> > >
> > > 1) can I print the machine clock time with the micro-second
> > > resolution?
> > >
> > > 2) how?
> > >
> > > So far, I've only been able to have a 10-usec resolution, with the
> > > following C code:
> > >
> > > /* Variables */
> > > time_t actual_date;
> > > struct tm *actual_time_tm;
> > > struct timeval tp;
> > > long milli;
> > >
> > > /* Time Print */
> > > actual_date = time(NULL);
> > > actual_time_tm = gmtime(&actual_date);
> > > gettimeofday(&tp,(struct timezone *)NULL);
> > > milli=tp.tv_usec/1000;/* For 3 digit resolution */
> > > printf("\nTime: %02d:%02d:%02d.%03d\n", actual_time_tm->tm_hour,
> > > actual_time_tm->tm_min, actual_time_tm->tm_sec, milli);
> > >
> > >
> > > This prints out something like:
> > > "Time: 09:06:05.770"
> > > "Time: 09:06:05.780"
> > > "Time: 09:06:05.850"
> > >
> >
> > I think you mean 10millisec resolution!
> >
> > Actually you are not printing out the time form the RTC.
> >
> > On boot the linux kernel reads the RTC, or queries an NTP server,
> or uses
> > rdate or similar, to set the system time. By arranging the hardware
> to give a
> > tick and with quite a complicated tick adjust system, the kernel
> keeps time
> > while running.
> >
> > The "tick" is traditionally, 2.4 kernel, configured when the kenrel
> is
> > compiled to 100Hz. You can rebuild a kernel with a more accurate
> tick,
> > but it up the kernel load - the tick is used by the kernel for
> scheduling etc.
> >
> > There is a spare timer counter on the 9302 that's available for
> use - you'd
> > have to write a kernel driver for it. There is an example kernel
> driver by
> > Phillip McCarley, that uses the timer/counter to do faster sampling
> with the
> > MAX197 ADC. It is in the file area of the group. Look for ADC
> kernel driver.
> >
>
>
> Jim,
>
> yes, you're right, milliseconds, sorry!
>
> I'll have a look at the file you suggested, thanks for your valuable
> help!
>
> Marco
>
Hi --
Another option, if you use a 2.6 kernel, is to use the -RT patch,
which includes HRT (High resolution timers). On top of lower
latencies, this gives you hrt with normal library system calls
(nanosleep, posix timers, etc).
More details:
http://rt.wiki.kernel.org/index.php/High_resolution_timers
http://rt.wiki.kernel.org/index.php/CONFIG_PREEMPT_RT_Patch
[Note that only the ep93xx TS boards can use this; the orion TS-7800
is not supported by the CONFIG_PREEMPT_RT patch AFAIK]
Regards, ...... Charlie
========================================================================
Groups related to ts-7000
========================================================================
lpc2000 (98 common members)
http://groups.yahoo.com/group/lpc2000?v=1&t=ipt&ch=email&pub=groups&slk=aftr0&sec=recg
Microprocessors/Microcontrollers: The NXP (formerly Philips) LPC2000 family of
ARM M...
nslu2-general (82 common members)
http://groups.yahoo.com/group/nslu2-general?v=1&t=ipt&ch=email&pub=groups&slk=aftr1&sec=recg
Computers & Internet/Hardware: This is the general support group for the NSLU2
ma...
msp430 (64 common members)
http://groups.yahoo.com/group/msp430?v=1&t=ipt&ch=email&pub=groups&slk=aftr2&sec=recg
Computers & Internet/Hardware: Welcome to the MSP430 User's Group! The purpose
of...
motherboardmemorycpu (54 common members)
http://groups.yahoo.com/group/motherboardmemorycpu?v=1&t=ipt&ch=email&pub=groups&slk=aftr3&sec=recg
Computers & Internet/Hardware: The purpose of the group will be to share
informat...
handyboard (52 common members)
http://groups.yahoo.com/group/handyboard?v=1&t=ipt&ch=email&pub=groups&slk=aftr4&sec=recg
Computers & Internet/Hardware: The Handy Board is a 68HC11-based controller
board...
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|