[Coco] os9/drivewire driver: success!
Boisy G. Pitre
boisy at tee-boy.com
Tue Nov 10 12:41:34 EST 2009
Aaron,
Check out vrn.asm for an example of how to setup the VIRQ call. You still need to call F$IRQ as well as F$VIRQ when setting up the virtual interrupt, and call both to tear them down at Term time.
If I were you I would start out by adding the code to install the ISR, do the F$IRQ and F$VIRQ call, and in your ISR just increment a value in a byte in the system map (say address $1E) then use dmem/dump to see if it's changing at offset $1E:
dmem 0 0 ! dump
That way you have some confidence that your driver is properly bringing up the ISR when you do an iniz /t2.
Then do a deiniz /t2 to make sure you are tearing things down correctly.
Boisy
On Nov 10, 2009, at 11:32 AM, Aaron Wolfe wrote:
> Thanks for the advice. I kind of suspected i was doing things wrong with the way i was trying to sleep. Between your walk through and the examples in other modules, I might be able to pull this off. I will give it a shot and see how far I get :)
>
>
> -----Original Message-----
> From: Boisy G. Pitre <boisy at tee-boy.com>
> Sent: Tuesday, November 10, 2009 7:05 AM
> To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
> Subject: Re: [Coco] os9/drivewire driver: success!
>
> Aaron,
>
> Again, fantastic work. It is great to see someone taking the bull by the horns, learning the tools and expanding on the existing work in the NitrOS-9 project.
>
> I downloaded the source to the scdwt driver and looked over it. I have a few suggestions that I think you may want to look at.
>
> Typically in an OS-9 SCF driver, the read routine uses the V.BUSY/V.WAKE SCF variables to handhshake with an interrupt service routine (ISR) to coordinate obtaining data from an input buffer that is filled by the ISR itself. There is no real interrupt in this particular case, but OS-9 provide something called a Virtual Interrupt (VIRQ) that you can use for situations just like this. Here's how it works:
>
> You can set up the VIRQ through the F$VIRQ system call to call an ISR that you provide for some interval. The period of the OS-9 tick is 1/60 second. You supply a multiplier to the F$VIRQ call to extend the period that the VIRQ calls your ISR, so you could have your ISR get called every 6 ticks, which means your ISR gets called 10 times per second. You can adjust this number as you wish for optimality.
>
> Your ISR, when called, would send a OP_SERREAD call to the server. I would combine the OP_SERCHECK and OP_SERREAD into one call. When you send the OP_SERREAD, the server would send back two bytes. The first byte would flag whether there is a valid byte to send, and the second byte would be that byte. So for example:
>
> ISR sends OP_SERREAD
> Server returns: 0x00 0x00 (first byte indicates that there is no data to send, second byte is just a fill byte)
> OR
> Server returns: 0xFF 0x41 (first byte indicates that there is data from the server, and the second byte is the valid character)
>
> In your ISR, you have to take into account that a response may not come in because the server isn't running, the cable is unplugged, etc, and take action accordingly, but assuming everything is ok, you get back a response immediately. IF the first byte is 0, you just return. However IF the first byte is non-zero, you t
>
> [The entire original message is not included]
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
More information about the Coco
mailing list