delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/06/30/15:06:58

Xref: news-dnh.mv.net comp.os.msdos.djgpp:712
Path: news-dnh.mv.net!mv!news.NH.Destek.Net!news2.net99.net!sun.cais.com!ringer.cs.utsa.edu!swrinde!cs.utexas.edu!news.sprintlink.net!howland.reston.ans.net!xlink.net!rz.uni-karlsruhe.de!news.uni-stuttgart.de!news.belwue.de!green.t-informatik.ba-stuttgart.de!jscharrl
From: jscharrl AT ba-stuttgart DOT de (Jochen Scharrlach)
Newsgroups: comp.os.msdos.djgpp
Subject: HW Interrupts & DPMI (V2)
Date: 29 Jun 1995 08:49:14 GMT
Organization: Berufsakademie Stuttgart
Lines: 93
Reply-To: jscharrl AT ba-stuttgart DOT de
Nntp-Posting-Host: green.t-informatik.ba-stuttgart.de
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

Hi freax!

I recently changed my interrupt routines to use the V2 commands but
it seems that ass soon as I reveive an interrupt the prog catches a
SIGSEGV:

-----------------------------------------------------------------------
__dpmi_paddr irq12, irq15, oldint12, oldint15;
#define int_vect12 (0x74)
#define int_vect15 (0x77)

static volatile enum IRQStatus DMAflg;
static volatile int DMAoverrun;

void DMAinterrupt(_go32_dpmi_registers *reg) 
{
    outportw(cam.cambase+8,0);      /*Prevent further interupts and*/
    
    outportb(0xa1, inportb(0xa1) | 0x10); /* disable IRQ 12 */
    
    outportw(cam.cambase+2,0);
    DMAoverrun = FALSE;

    outportb(0xa0, 0x64); /* Controller 2: EOI IRQ 12 */
    outportb(0x20, 0x62); /* Controller 1: EOI IRQ 2  */

    outportw(cam.cambase+6,0);

    DMAflg = NoInterruptExpected;
    enable();
}
void volatile GoDMA(unsigned long buff, int num) /* preparing for next
                                                    interrupt */
{
    DMAflg=WaitForDMA;                   /*Set flag non-zero*/
    
    asm volatile ("cli");
    outportb(0x0d4,5);          /*Disable interrupt mask*/
    asm volatile ("sti");

    while ((inportb(cam.cambase+2)&0x20) != 0)
	CAMIN();
    
    num--;
    
    outportw(cam.cambase+8,0);  /*Clear camera interrupt*/
    outportw(cam.cambase+6,1);  /*Enable DMA and interupts*/
    outportw(cam.cambase+4,1);
    
    outportb(0x8b, (buff >> 16)&126); /* DMA stuff */
    outportb(0xd8, 0);
    outportb(0xc4, (buff>>1)&255);
    outportb(0xc4, (buff>>9)&255);

    outportb(0xc6, num&255);
    outportb(0xc6, (num>>8)&255);
    disable();
    outportb(0xd6, 5);
    outportb(0xd4, 1);
    enable();
    outportb(0x21, inportb(0x21) & 251); /* Enable IRQ 12 */
    outportb(0xa1, inportb(0xa1) & 239); /* Enable slave controller */
}

void dpmi_interrupt_install(void)
{
    __dpmi_get_protected_mode_interrupt_vector(int_vect12, &oldint12);
    __dpmi_get_protected_mode_interrupt_vector(int_vect15, &oldint15);
    irq12.offset32 = (long) DMAinterrupt;
    irq12.selector = _my_cs();
    irq15.offset32 = (long) ParallelInt;
    irq15.selector = _my_cs();
    __dpmi_set_protected_mode_interrupt_vector(int_vect12, &irq12);
    __dpmi_set_protected_mode_interrupt_vector(int_vect15, &irq15);
}
void dpmi_interrupt_cleanup(void)
{
    __dpmi_set_protected_mode_interrupt_vector(int_vect12, &oldint12);
    __dpmi_set_protected_mode_interrupt_vector(int_vect15, &oldint15);
}
--------------------------------------------------------------------------

The nearly identical version with _go32_*-commands works well, even
when using V2. Can anyone see an obvious mistake?

Thanks,
Jochen

--
                      ------------------------------------
                      EMail:   jscharrl AT ba-stuttgart DOT de
                         or:   acorn1 AT ftp DOT uni-stuttgart DOT de
                      ------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019