Skip navigation.
Home
The QNX Community Portal

View topic - Writing device drivers

Writing device drivers

For discussion of realtime and/or embedded programming.

Writing device drivers

Postby escotts » Wed Mar 12, 2003 10:20 pm

I'm faced with the possibility of having to develop an interrupt hander/device driver in QNX 4.25. I am an experienced QNX developer, and have developed interrupt hanlders in DOS environments. Here are my questions:
(1) Is this a formidable task? I know it will involve some work, but are there pitfalls lurking about?
(2) Are there any samples to view? There is an older reference on the QNX website to the QUICS site, but I can't trace this link.
escotts
New Member
 
Posts: 1
Joined: Wed Mar 12, 2003 10:10 pm

Postby evanh » Thu Mar 13, 2003 10:39 am

It's a piece of cake under QNX 6.x (QNX 4.x maybe the same). A simple handler can be made from a specified function using InterruptAttach(). This allows you to share the heap space. It feels very similar to dos.

All the obvious restrictions apply, like don't call library code unless it's a listed safe function to use in interrupts and be wary of how much cpu the function uses. Don't use the fpu unless you ensure it's preservation. Be careful with non-atomic operations as the interrupt cannot wait, you either buffer or disgard the result. And if swap should suddenly appear as a qnx feature then there is also the requirement to only use memory that is locked, it would be a good idea to code for this anyway.

Another neat option in QNX 6.x is InterruptAttachEvent() which gives you normal process level execution and can be viewed as a way of getting a super high priority timer and the added benefit of using your prefered interrupt source.

Excuse me if this sounds like a sales pitch but qnx's support for interrupt coding makes me :)
evanh
QNX Master
 
Posts: 737
Joined: Sat Feb 01, 2003 8:04 am

Postby evanh » Fri Mar 14, 2003 9:33 am

Update: QNX 4.x equivalent of InterruptAttach() is called qnx_hint_attach(). I don't think there is an equivalent of InterruptAttachEvent()
evanh
QNX Master
 
Posts: 737
Joined: Sat Feb 01, 2003 8:04 am

InterruptAttachEvent

Postby rgallen » Fri Mar 14, 2003 5:34 pm

evanh wrote:Update: QNX 4.x equivalent of InterruptAttach() is called qnx_hint_attach(). I don't think there is an equivalent of InterruptAttachEvent()


There is a practical equivalent of InterruptAttachEvent, and that is to write your interrupt handler with only 2 lines (1 to mask the interrupt, and the other to return a proxy).

At process time do a Receive, and if it is a proxy, service the hardware and unmask the interrupt.

Of course it isn't as neat as InterruptAttachEvent, but it gets you the same benefits.
rgallen
QNX Master
 
Posts: 671
Joined: Thu Jul 11, 2002 6:48 pm


Return to Realtime and Embedded

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

cron