9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Hooking up to a timer in a driver
@ 1999-06-22  3:20 jmk
  0 siblings, 0 replies; 4+ messages in thread
From: jmk @ 1999-06-22  3:20 UTC (permalink / raw)


cpane@metamorsw.com:
	>It looks like if you want to get interrupted you insert a call to your
	>clock routine inside the clock() function in pc/clock.c.

Yes, you can do that. Brazil has slightly generalised this by having a routine
which drivers can call to add a function to a linked-list of functions to be called
per clock tick, so there are no dependancies in clock.c for the uart, mouse, etc.

--jim




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

* [9fans] Hooking up to a timer in a driver
@ 1999-06-22  2:17 Christopher
  0 siblings, 0 replies; 4+ messages in thread
From: Christopher @ 1999-06-22  2:17 UTC (permalink / raw)


Hi,

This is an update.

I have been hacking into how the pc kernal setups up the 8253 PIT.

It looks like if you want to get interrupted you insert a call to your
clock routine inside the clock() function in pc/clock.c.

Here is what is there now -

static void
clock(Ureg *ur, void *arg)
{
    Proc *p;
    int nrun = 0;

    USED(arg);

    m->ticks++;

    checkalarms();
    uartclock();
    hardclock();

/* And more clock stuff */

}

Is it correct to assume that if I want a clock interrupt I can  add a
midiclock() function , like the uartclock() and mouseclock() functions
that will get called every time clock is called by the timer, thus
giving me a way to sample the output queue for my file system, and
decide if is time to send the data to the MIDI port?

Am I way off here, I am kind exploring how to do this by reverse
engineering what is going on in the code !!!


Thanks


-Chris Pane







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

* [9fans] Hooking up to a timer in a driver
@ 1999-06-21 18:05 Chris
  0 siblings, 0 replies; 4+ messages in thread
From: Chris @ 1999-06-21 18:05 UTC (permalink / raw)


Hey all,


I have been hunting through the kernel code to try and figure out how to
setup a timer in a file system driver I am writing.

Here is my problem :

I am currently outputting data to a device via my own file system (MIDI). I
need a way to have a timer go off in the file system every n Milliseconds,
and check my output queue to see if it is time to send the data. Currently
I am doing this by spawning a kproc in the driver, and having it sleep for
n milliseconds, wake up, check the queue the sleep. Thought this seems to
work, it does not seem like the cleanest way to do this.

I would like to wire up a handler to a timer mechanism that the OS supports
so I could just have the OS call my function every n ticks.

I have not been able to find such a thing by searching the source code.

Any Clues ?


Thanks!


-Chris Pane





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

* [9fans] Hooking up to a timer in a driver
@ 1999-06-21 17:51 Chris
  0 siblings, 0 replies; 4+ messages in thread
From: Chris @ 1999-06-21 17:51 UTC (permalink / raw)


Hey all,


I have been hunting through the kernel code to try and figure out how to
setup a timer in a file system driver I am writing.

Here is my problem :

I am currently outputting data to a device via my own file system (MIDI). I
need a way to have a timer go off in the file system every n Milliseconds,
and check my output queue to see if it is time to send the data. Currently
I am doing this by spawning a kproc in the driver, and having it sleep for
n milliseconds, wake up, check the queue the sleep. Thought this seems to
work, it does not seem like the cleanest way to do this.

I would like to wire up a handler to a timer mechanism that the OS supports
so I could just have the OS call my function every n ticks.

I have not been able to find such a thing by searching the source code.

Any Clues ?


Thanks!


-Chris Pane








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

end of thread, other threads:[~1999-06-22  3:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-22  3:20 [9fans] Hooking up to a timer in a driver jmk
  -- strict thread matches above, loose matches on Subject: below --
1999-06-22  2:17 Christopher
1999-06-21 18:05 Chris
1999-06-21 17:51 Chris

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 NNTP newsgroup(s).