* questions about port and timer functions
@ 1998-01-12 23:47 herzer
1998-01-16 2:56 ` Benjamin Riefenstahl
0 siblings, 1 reply; 6+ messages in thread
From: herzer @ 1998-01-12 23:47 UTC (permalink / raw)
To: gnu-win32
Hello,
I have written a data acquisation program with DJGPP. Now I want to
port it to Windows NT and give him a fancy outfit (with Tcl/TK). But
yesterday in the evening these questions appeared:
1. How can I do port I/O with gnu-win32 (like in-, outportb in
DJGPP). I didn't find any include file which contains a definition
for these functions. What libraries do I need?
2. Is there a function which returns a time signal with precision of
0.001 s or better?
Thank you for helping!
Armin
Armin Herzer
FH Ravensburg-Weingarten
Postfach 1261
88241 Weingarten
Germany
phone: 49-751-501-417
fax: 49-751-501-448
email: herzer@fbp.fh-weingarten.de
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: questions about port and timer functions
1998-01-12 23:47 questions about port and timer functions herzer
@ 1998-01-16 2:56 ` Benjamin Riefenstahl
1998-01-17 21:08 ` Patrick J. Fay
0 siblings, 1 reply; 6+ messages in thread
From: Benjamin Riefenstahl @ 1998-01-16 2:56 UTC (permalink / raw)
To: gnu-win32
Hi Armin,
herzer@rz-nov5.rz.fh-weingarten.de wrote:
> I have written a data acquisation program with DJGPP. Now I want to
> port it to Windows NT and give him a fancy outfit (with Tcl/TK). But
> yesterday in the evening these questions appeared:
>
> 1. How can I do port I/O with gnu-win32 (like in-, outportb in
> DJGPP).
You can not use the hardware ports in a WinNT 32 bit program. You can do
it in Win95, but there are no guarantees that this will work in future
versions. You're supposed to write device drivers for this, or use
existing facilities like the serial ports.
> I didn't find any include file which contains a definition
> for these functions. What libraries do I need?
You would probably have to write them yourself in inline assembly.
> 2. Is there a function which returns a time signal with precision of
> 0.001 s or better?
Look at the Win32 multimedia timers. They are the only thing that
actually comes near that precision. The standard Win32 functions like
GetSystemTime() have the resolution but not the actual granularity.
so long, benny
======================================
Benjamin Riefenstahl (benny@crocodial.de)
Crocodial Communications EntwicklungsGmbH
Ophagen 16a, D-20257 Hamburg, Germany
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: questions about port and timer functions
1998-01-16 2:56 ` Benjamin Riefenstahl
@ 1998-01-17 21:08 ` Patrick J. Fay
1998-01-18 16:07 ` Benjamin Riefenstahl
1998-01-19 10:32 ` Rolf Welde Skeie
0 siblings, 2 replies; 6+ messages in thread
From: Patrick J. Fay @ 1998-01-17 21:08 UTC (permalink / raw)
To: Benjamin Riefenstahl; +Cc: gnu-win32
On Fri, 16 Jan 1998, Benjamin Riefenstahl wrote:
> Hi Armin,
>
>
> herzer@rz-nov5.rz.fh-weingarten.de wrote:
> > I have written a data acquisation program with DJGPP. Now I want to
...snip...
>
> Look at the Win32 multimedia timers. They are the only thing that
> actually comes near that precision. The standard Win32 functions like
> GetSystemTime() have the resolution but not the actual granularity.
The routine below will time to the clock tick level (at least on
a pentium pro). Note that you have to put in the clock frequency.
rdtsc returns the hardware clock ticks as an 8 byte integer.
dclock converts the clock ticks to double precision seconds.
To compile 'gcc tst.c -o tstc'
/* begin tst.c */
#include <stdio.h>
long long rdtsc(void)
{
asm( "rdtsc");
}
double dclock(void)
{
double dtime;
static double rfrequency=1.0/200e6;
long long tsc;
tsc = rdtsc( );
dtime = tsc * rfrequency;
return( dtime );
}
int main()
{
double mytim;
double t1,t2;
t1=dclock();
while(dclock()-t1<10.0){;}
t2=dclock();
printf("did we go 10 secs? time=%f\n",t2-t1);
return 0;
}
/* end tst.c */
Pat
>
>
> so long, benny
> ======================================
> Benjamin Riefenstahl (benny@crocodial.de)
> Crocodial Communications EntwicklungsGmbH
> Ophagen 16a, D-20257 Hamburg, Germany
> -
> For help on using this list (especially unsubscribing), send a message to
> "gnu-win32-request@cygnus.com" with one line of text: "help".
>
Patrick Fay, Ph.D., Intel Corp. email: pfay@co.intel.com
Los Alamos National Lab wk: (505) 665-9141
CTI M.S. B296 fax: (505) 667-5921
Los Alamos NM 87545 ASCI-RED http://www.acl.lanl.gov/~pfay/teraflop
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: questions about port and timer functions
1998-01-17 21:08 ` Patrick J. Fay
@ 1998-01-18 16:07 ` Benjamin Riefenstahl
1998-01-19 10:32 ` Rolf Welde Skeie
1 sibling, 0 replies; 6+ messages in thread
From: Benjamin Riefenstahl @ 1998-01-18 16:07 UTC (permalink / raw)
To: gnu-win32; +Cc: herzer
Hi Patrick,
Patrick J. Fay wrote:
[suggests asm( "rdtsc" ) for timing]
Yeah, right I forgot about that one. That is Pentium only IRC, but than
Pentiums are fairly standard these days and certainly o.k. for lab
tests. How do you calculate that frequency constant? Is there a direct
method to determine that?
There is also QueryPerformanceCounter() which is probably just a wrapper
around rdtsc. It has the additional advantage that you can use
QueryPerformanceFrequency() to get at the frequency.
so long, benny
======================================
Benjamin Riefenstahl (benny@crocodial.de)
Crocodial Communications EntwicklungsGmbH
Ophagen 16a, D-20257 Hamburg, Germany
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: questions about port and timer functions
1998-01-17 21:08 ` Patrick J. Fay
1998-01-18 16:07 ` Benjamin Riefenstahl
@ 1998-01-19 10:32 ` Rolf Welde Skeie
1 sibling, 0 replies; 6+ messages in thread
From: Rolf Welde Skeie @ 1998-01-19 10:32 UTC (permalink / raw)
To: Patrick J. Fay; +Cc: Benjamin Riefenstahl, gnu-win32
Patrick J. Fay wrote:
> The routine below will time to the clock tick level (at least on
> a pentium pro). Note that you have to put in the clock frequency.
A sidenote: on a SMP you can get corrupt values as the clock is
associated with the *current* cpu you are running on. You have
to be sure that you always use the same cpu...
Any takers on a MT-safe implementation?
--
Rolf Welde Skeie Senior Design Engineer
_ mailto:rws@scali.no __ http://www.scali.com ____
Tel (+47) 6384 6705 Scali AS
Fax (+47) 6384 4005 Hvamstubben 17 =
Home (+44) 2255 0822 2013 Skjetten = = =
Mob (+47) 9095 4406 NORWAY = = = =
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: questions about port and timer functions
@ 1998-01-21 5:01 herzer
0 siblings, 0 replies; 6+ messages in thread
From: herzer @ 1998-01-21 5:01 UTC (permalink / raw)
To: gnu-win32, benny, pfay, rws
Hi,
Thanks to all who replied to my question!
It seems that I need something like a 'driver'. This driver does
nothing else than give me access to the desired port(s). There was a
library shipped with the board, but I do not want to use these
functions (call it learning how write a very simple 'driver').
In other words: I want my own routine (or 'driver' in this case) which
grants me port access.
Does anyone have an example for such a 'driver' routine?
The next days I will test the timer code! I am very interested to
hear more things about possible SMP conflicts in this case!
Armin Herzer
FH Ravensburg-Weingarten
Postfach 1261
88241 Weingarten
Germany
phone: 49-751-501-417
fax: 49-751-501-448
email: herzer@fbp.fh-weingarten.de
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~1998-01-21 5:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-01-12 23:47 questions about port and timer functions herzer
1998-01-16 2:56 ` Benjamin Riefenstahl
1998-01-17 21:08 ` Patrick J. Fay
1998-01-18 16:07 ` Benjamin Riefenstahl
1998-01-19 10:32 ` Rolf Welde Skeie
1998-01-21 5:01 herzer
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).