TIP: Click on subject to list as thread! ANSI
echo: cis.os9.68000.osk
to: J. Eberbach 106147,521 (X)
from: J. Eberbach 106147,521
date: 1996-10-11 08:48:13
subject: #21482-#Fast IRQ

#: 21483 S12/OS9/68000 (OSK)
    11-Oct-96  08:48:13
Sb: #21482-#Fast IRQ
Fm: J. Eberbach 106147,521
To: J. Eberbach 106147,521 (X)

since noone ever replied, and since I also didn'T get any help from Microware
or Dr. Keil, I had to find out for myself.

So here is an example:

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include "/mwos/os9/src/defs/machine/reg.h"

/*make this program system state */
_asm("_sysattr: equ 0xA001");


/**********************************************************************/

int irqsvc_f_t1();
void *get_global_base(void);

int irq_timer1(char *system_globals) {

        /* do your interrupt service */

        return(0);
}

/**********************************************************************/

#define CLEAN_UP \
        /* cleanup paths */ \
        prc->_path[0]=0;    \
        prc->_path[1]=0;    \
        prc->_path[2]=0;

main () {
        error_code err;

        register procid *prc = sysglob(procid*, D_Proc);

        /* fix up standard i/o for a system state process */

        stdin  -> _fd = prc->_path[0];
        stdout -> _fd = prc->_path[1];
        stderr -> _fd = prc->_path[2];

        _from_new(stdin); _from_new(stdout); _from_new(stderr);

        /* install interrupt service routines */
        if (err = _os_firq(VMEVT1, 0, irqsvc_f_t1, get_global_base()))
                exit(_errmsg(error, "Can't install timer1 interrupt service
routine.\n"));
        else{
                printf ("Timer1 Interrupt service routine installed!\n");
        }

        /* Setup hardware to produce interrupts */
        /* enable interrupts */

        /* do your stuff */

        /* disable interrupts */

        /* deinstall interrupt service routine */
        _os_firq(VMEVT1, prior, NULL, get_global_base());

        CLEAN_UP

        exit(0);
}

_asm("params equ 8");
_asm("irqsv set 0");
_asm("static set 4");
_asm("port set 8");


_asm("get_global_base:");
_asm(" move.l a6,d0");
_asm(" rts");

_asm("irqsvc_f_t1: move.l a6,-(a7)");
_asm(" movem.l d1/a0/a1/a3-a5,-(a7)");
_asm(" move.l a6,d0");
_asm(" movea.l a2,a6");
_asm(" bsr irq_timer1");
_asm(" move.l d0,d1");
_asm(" beq.s irqf_done");
_asm(" ori.b #01,ccr");
_asm("irqf_done movem.l (a7)+,d1/a0/a1/a3-a5");
_asm(" movea.l (a7)+,a6");
_asm(" rts");


There is 1 Reply.

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™.