RE: Porting Microsoft C to Linux

Colin Coe (colin.coe@wcl.wesfarmers.com.au)
Wed, 23 Sep 1998 08:13:19 +0800


I have replaced the original code segment, which is only used to pause
and wait until the card is ready (up to a set limit):

_bios_timeofday(_TIME_GETCLOCK, &timeout);
timeout += 5 * HZ; /* check for 5 secs */
addticks = 0;

do
{
if (_bios_timeofday(_TIME_GETCLOCK, &currtime))
addticks = 1;

if (addticks)
currtime += TICKSPERDAY;
} while ((currtime <= timeout);

with

timeout = jiffies;
timeout += 5 * HZ;
while (jiffies <= timeout);

Sound about right?

Also, this program downloads a control program to the card. The
original code uses fgets and family. I know these do not work in
modules, well at least I can't get them to work, what do I need to
replace them with. I think I remember reading about this in Linux
Device Drivers, but I can't find those details now...

Thanks for the replies.

CC

-----Original Message-----
From: Lance Dillon [SMTP:riffraff@tampabay.rr.com]
Sent: Tuesday, 22 September 1998 19:20
To: Colin Coe
Cc: linux-kernel@vger.rutgers.edu
Subject: Re: Porting Microsoft C to Linux

Alan Cox wrote:
>
> > _bios_timeofday(_TIME_GETCLOCK, &timeout);
> >
> > I have tried replacing it with gettimeofday() but I am not
sure what
> > TIME_GETCLOCK does so I don't know if I am doing the right
thing.
>
> You need to understand what the code is trying to do
>
> My guess is its timer stuff if so you probably want
>
> timeout = jiffies + someoffset;
>
> while(time_before(jiffies, timeout))
> {
> things_occur
> }
>

actually, according to my microsoft c bible (part of a contract
position
i was working on some years ago), _bios_timeofday: Read and set
current
clock setting (also, access the real-time clock in at, xt, and
ps/2),
which is just int 1a...if you look up int 1a, you should find
out
exactly what it does...

--
Lance Dillon
Network Administrator
Nielsen Media Research
--
"Gravity is a harsh mistress."
-- The Tick

-
To unsubscribe from this list: send the line "unsubscribe
linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/