All of lore.kernel.org
 help / color / mirror / Atom feed
* time question
@ 2001-08-27  7:25 Bart Vandewoestyne
  2001-08-27  7:34 ` Bart Vandewoestyne
  2001-08-27 19:22 ` Randy.Dunlap
  0 siblings, 2 replies; 5+ messages in thread
From: Bart Vandewoestyne @ 2001-08-27  7:25 UTC (permalink / raw)
  To: linux-kernel

I'm trying to port the DOS driver for a data aquisition card to linux
(http::/mc303.ulyssis.org).  It is my first linux driver writing
attempt. Somewhere in the code i have the following lines of DOS-code
that do some busy waiting:

_bios_timeofday(_TIME_GETCLOCK,&tb); l = tb;
  while(l-tb < 2) _bios_timeofday(_TIME_GETCLOCK,&l);

What is the best linux equivalent for this?

Thanks,
mc303

-- 
Ing. Bart Vandewoestyne			 Bart.Vandewoestyne@pandora.be
Hugo Verrieststraat 48			       GSM: +32 (0)478 397 697
B-8550 Zwevegem			 http://users.pandora.be/vandewoestyne
----------------------------------------------------------------------
"Any fool can know, the point is to understand." - Albert Einstein

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

* Re: time question
  2001-08-27  7:25 time question Bart Vandewoestyne
@ 2001-08-27  7:34 ` Bart Vandewoestyne
  2001-08-27 19:22 ` Randy.Dunlap
  1 sibling, 0 replies; 5+ messages in thread
From: Bart Vandewoestyne @ 2001-08-27  7:34 UTC (permalink / raw)
  To: linux-kernel

Bart Vandewoestyne wrote:
> 
> I'm trying to port the DOS driver for a data aquisition card to linux
> (http::/mc303.ulyssis.org).  It is my first linux driver writing
> attempt. Somewhere in the code i have the following lines of DOS-code
> that do some busy waiting:
> 
> _bios_timeofday(_TIME_GETCLOCK,&tb); l = tb;
>   while(l-tb < 2) _bios_timeofday(_TIME_GETCLOCK,&l);
> 
> What is the best linux equivalent for this?

Sorry, the URL should be: http://mc303.ulyssis.org/heim/

Greetings,
Bart

-- 
Ing. Bart Vandewoestyne			 Bart.Vandewoestyne@pandora.be
Hugo Verrieststraat 48			       GSM: +32 (0)478 397 697
B-8550 Zwevegem			 http://users.pandora.be/vandewoestyne
----------------------------------------------------------------------
"Any fool can know, the point is to understand." - Albert Einstein

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

* Re: time question
  2001-08-27  7:25 time question Bart Vandewoestyne
  2001-08-27  7:34 ` Bart Vandewoestyne
@ 2001-08-27 19:22 ` Randy.Dunlap
  1 sibling, 0 replies; 5+ messages in thread
From: Randy.Dunlap @ 2001-08-27 19:22 UTC (permalink / raw)
  To: Bart Vandewoestyne; +Cc: linux-kernel

Bart Vandewoestyne wrote:
> 
> I'm trying to port the DOS driver for a data aquisition card to linux
> (http::/mc303.ulyssis.org).  It is my first linux driver writing
> attempt. Somewhere in the code i have the following lines of DOS-code
> that do some busy waiting:
> 
> _bios_timeofday(_TIME_GETCLOCK,&tb); l = tb;
>   while(l-tb < 2) _bios_timeofday(_TIME_GETCLOCK,&l);
> 
> What is the best linux equivalent for this?

I don't have a DOS system + development tools handy.
Can you tell me what _bios_timeofday(_TIME_GETCLOCK, ptr) compiles/
assembles to?  I.e., what software interrupt, and what the AH
register is set to on entry?

I'm guessing that this code is just doing a 2-tick delay
(18.2 ticks per second), using int. 0x1a, AH=00
(http://www.ctyme.com/intr/rb-2271.htm).
This means that each tick is approximately 55 ms,
so the code is delaying for about 110 ms.


Take a look at the new Linux Device Drivers book (second edition),
in the "Flow of Time" chapeter:
http://www.xml.com/ldd/chapter/book/ch06.html
You may get some answers there.

To begin with, you could try using
  mdelay(110);

Is this busy-waiting loop used seldom or often?
If seldom, then using mdelay() might be OK.
If often, then a sleep queue seems to be preferred.
Read the LDD Time chapter.

You might also try kernelnewbies.org for introductory kernel
questions.  See the FAQ and the /documents/ directory.

>From your list of questions:

1. What kind of device do I need? Right now I am trying a
character device, but is this indeed what we need???

A: Yes.  If it's not a block device and not a network device,
it's usually a character device.

2. If I need a character device, what linux-existing driver is good
to look at and learn from it? 

A: I'm not aware of other data acq drivers in the kernel, but that's
just not my area.  Are there any (anyone)?

3. How should I translate the assembler code of the DOS driver?
Can I use linux native system calls?
To what linux sytem calls can I map the inplI and outplI functions?

A:  Sure, you can use native Linux system calls, if you know which
ones to use.  However, some calls may actually be (g)lib calls instead
of system calls.

inplI():  same as inpl() on your web page (since bswap is
commented).  Maps to:
  value = inl(port);

outplI():  Only difference here is the 16-bit word-order of the
32-bit value to write to the I/O port.  I'd suggest just getting
the data order correct in the calling function and using
  outl(value, port);
in Linux drivers.


~Randy

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

* time question
@ 2010-01-07  4:35 rainbowczj rainbowczj
  2010-01-10 16:46 ` Russell King - ARM Linux
  0 siblings, 1 reply; 5+ messages in thread
From: rainbowczj rainbowczj @ 2010-01-07  4:35 UTC (permalink / raw)
  To: linux-arm-kernel

Hi.

I am study the time of the arm , I  have a question:

    In  the \arm\kernel\times.c . there is a function pointer int
(*set_rtc)(void).it is the hook for setting the RTC's idea of the current
time. but I can't find which function to this pointer. somebody can tell me
where I can find it and how to set the RTC. thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100107/eb28a350/attachment-0001.htm>

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

* time question
  2010-01-07  4:35 rainbowczj rainbowczj
@ 2010-01-10 16:46 ` Russell King - ARM Linux
  0 siblings, 0 replies; 5+ messages in thread
From: Russell King - ARM Linux @ 2010-01-10 16:46 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jan 07, 2010 at 12:35:39PM +0800, rainbowczj rainbowczj wrote:
> I am study the time of the arm , I  have a question:
> 
>     In  the \arm\kernel\times.c . there is a function pointer int
> (*set_rtc)(void).it is the hook for setting the RTC's idea of the current
> time. but I can't find which function to this pointer. somebody can tell me
> where I can find it and how to set the RTC. thanks!

It's never set in today's kernels, because it's redundant.  RTCs should
instead be implemented using the RTC support code in drivers/rtc, which
will take care of all this for you.

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

end of thread, other threads:[~2010-01-10 16:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-08-27  7:25 time question Bart Vandewoestyne
2001-08-27  7:34 ` Bart Vandewoestyne
2001-08-27 19:22 ` Randy.Dunlap
  -- strict thread matches above, loose matches on Subject: below --
2010-01-07  4:35 rainbowczj rainbowczj
2010-01-10 16:46 ` Russell King - ARM Linux

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.