www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/02/07/03:30:35

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: "Jean-Pierre GHYS" <jean-pierre DOT ghys AT inrets DOT fr>
Newsgroups: comp.os.msdos.djgpp
Subject: WHY IRQ WANT RUN ???? HELP ???
Date: Thu, 7 Feb 2002 09:09:12 -0000
Organization: I.N.R.E.T.S.
Lines: 121
Message-ID: <a3tcqq$1tu$1@orion.inrets.fr>
NNTP-Posting-Host: pc-ghys.inrets.fr
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

HI

I try this prog ,he come from a example of use of IRQ ,he work wery well
with IRQ 0
but refuse to work with IRQ7 , my computer is ready with is IRQ7 on the LPT1
where is the big bug ????

//Simple Example of chaining interrupt handlers
//Adopted from Matthew Mastracci's code

#include <stdio.h>
#include <pc.h>
#include <dpmi.h>
#include <go32.h>
#include <dos.h>

//macros by Shawn Hargreaves from the Allegro library for locking
//functions and variables.
#define LOCK_VARIABLE(x)    _go32_dpmi_lock_data((void
*)&x,(long)sizeof(x));
#define LOCK_FUNCTION(x)    _go32_dpmi_lock_code(x,(long)sizeof(x));

#define IRQ_7 0X0F               // nø d'int : 15 pour le port parallele

#define DATA 0X378               // adresse l'imprimante
#define STATUS DATA+1            // 0X379  etat le l'imprimante
#define CONTROL DATA+2           // 0X37   connnande de l'imprim

int compteur = 0;
int val_config= 0;               // variable config du 8259

void init_port(void);            // configuration port //
void init_8259(void);            // configuration du 8259 IN
void RE_SET_8259(void);          // configuration du 8259 OUT
//*********************************************************************
void int_port_para(void)
{
 compteur++;                     // increment du compteur d'INT
 outportb(0X20,0X20);            // int accomplie
}
//*********************************************************************
int main(void)
 {
 //structures to hold selector:offset info for the ISRs
 _go32_dpmi_seginfo OldISR, NewISR;

 init_port();                     // initialisation de l'ack du port //
 init_8259();                     // autorisation de l'int 7 dans 8259

 LOCK_FUNCTION(int_port_para);    // verrouillage de la fonction
 LOCK_VARIABLE(compteur);         // verrouillage des variables

 _go32_dpmi_get_protected_mode_interrupt_vector(IRQ_7, &OldISR);
     //load the address of the old timer ISR into the OldISR structure
 NewISR.pm_offset = (int)int_port_para;
     //point NewISR to the proper selector:offset for handler function
 NewISR.pm_selector = _go32_my_cs();
    //chain the new ISR onto the old one so that first the old timer ISR
    //will be called, then the new timer ISR
 _go32_dpmi_chain_protected_mode_interrupt_vector(IRQ_7,&NewISR);
    //notice no changes to counter in this loop- the interrupt
    //changes it
 while (!kbhit())           // l'interruption devrait incrementer le
compteur
 {
   // if (compteur != 0)
   printf("%d\n",compteur);
 }
 _go32_dpmi_set_protected_mode_interrupt_vector(IRQ_7, &OldISR);

 RE_SET_8259();

 printf("Removing new ISR from the timer ISR chain\n");
 getkey();

return 0;
}
//**************************************************************************
******
void init_port(void)
{
int val;
 val = inportb(CONTROL);          // lecture de la config du port parallele
 printf("valeur config adresse 0X37A = %X\n",val);
 outportb(CONTROL,val|0X10);      // autorisation de l'interruption PORT //

 while (!kbhit())                 // test de la valeur de ACK
 {
   val = inportb(STATUS);         // lecture de la config du port
verification
   printf("valeur etat ACK =  %X\n",val);
 }
 getkey();
}
//**************************************************************************
*******
void init_8259(void)
{
   val_config = inportb(0X21);             // lecture de la config 8259
   printf("valeur de config 8259 %x  \n",val_config);
   outportb(0X21,val_config & ~0X80);       // mise a 1 de lautorisation de
l'int
   val_config = inportb(0X21);             // lecture de la config 8259
   printf("valeur de config apres 8259 %x  \n",val_config);
   getkey();
}
//**************************************************************************
*******
void RE_SET_8259(void)
{
   val_config = inportb(0X21);             // lecture de la config 8259
   outportb(0X21,val_config | 0X80);      // mise a 0 de lautorisation de
l'int
   printf("valeur de config apres 8259 %x  \n",val_config);
   getkey();
}
//**************************************************************************
*******



- Raw text -


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