TIP: Click on subject to list as thread! ANSI
echo: cis.os9.68000.osk
to: Taji S. Abraham 76760,2232
from: Boisy G. Pitre 74464,3005
date: 1995-04-11 05:28:56
subject: #20897-Install Intrpt Handler

#: 20902 S12/OS9/68000 (OSK)
    11-Apr-95  05:28:56
Sb: #20897-Install Intrpt Handler
Fm: Boisy G. Pitre 74464,3005
To: Taji S. Abraham 76760,2232

 > Hi,
 >
 > Is there a way to install an interrupt handler without using device
 > drivers? I am new to OS9. I just want to handle VME interrupts on
 > a Motorola MV162 board. A short example would be extremely helpful.
 > I tried the _os9_irq call but it gave me a runtime error (Errno = 208)

You must be in system state to install an interrupt service routine, but
you don't have to do it inside of a driver.  You have several options:

        - write a dummy driver which just installs an interrupt service
        routine in the INIT routine and deinstalls it in the TERM routine.

        - write a system state application that uses _os9_irq to install
        the interrupt service routine.

        - write a system state trap handler which can be called from a user
        state program.  The trap handler can install the interrupt service
        routine.

I usually opt for the middle suggestion: a system state application.

If you write your interrupt service routine in C, you'll have to write
some glue code in 68K assembly to move contents of registers around.

I don't have any example code on my system, but you need to tell C
compiler that your program is a system state program:

        /* I'm assuming you're using Ultra C because of your _os9_ call */
        _asm("_sysattr: equ $A000");

You then need to write a small assembly language routine which moves
registers and does a bsr to your actual C interrupt service routine.

Be aware that paths are subtly different in system state vs. user state.

Again, sorry.  I'm typing all of this from memory, and don't have example
code in front of me.  Feel free to pass any other questions along.

 >
 > Thanks
 >
--
Boisy G. Pitre__    __  __              Delphi:  BOISY
          |_   _|   \ \/ /              CompuServe:  74464,3005
I use...   _| |_     >  <               Internet:  boisy@os9er.waukee.ia.us
          |_____|NFO/_/\_\PRESS 1.2.0   OS-9 -- King of Operating Systems

SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.