delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/07/21/19:01:24

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Matt Flyer" <goaway AT nospam DOT me>
Newsgroups: comp.os.msdos.djgpp
References: <ZtDJc.129847$wH4 DOT 7032125 AT twister DOT southeast DOT rr DOT com> <003e01c46b01$84546800$0d01a8c0 AT josepmariaxp>
Subject: Re: PM hardware interrupts
Lines: 128
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Message-ID: <3pCLc.170124$tH1.6880991@twister.southeast.rr.com>
Date: Wed, 21 Jul 2004 22:48:31 GMT
NNTP-Posting-Host: 66.56.173.148
X-Complaints-To: abuse AT rr DOT com
X-Trace: twister.southeast.rr.com 1090450111 66.56.173.148 (Wed, 21 Jul 2004 18:48:31 EDT)
NNTP-Posting-Date: Wed, 21 Jul 2004 18:48:31 EDT
Organization: RoadRunner - Triad
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Turomas Thank you for the response.   I understand most of what your code is
doing.  The part that confuses me though is the inline assembly with with
fwait statements.  Could you please elaborate a little bit on them.  Are
they possibly command directed to the floating point unit?

So far I have been able to straighten things out a little bit.  I can
re-direct the interrupts either by chaining or allocating an iret wrapper
and claiming the interrupt with a "_go32_set_protected" command.  For some
reason though, the interrupt only executes one time.  From my research, I
would say this means that the interrupt is not being acknowledged - but I
believe this I addressed this.  If I am not mistaken, when I chain the
interrupt using the "_go32_chain_protected ..." command, I acknowledge the
interrupt with an outportb(0xA0, 0x20); outportb(0x20,0x20); (slave first)
for a non specific EOI and when I simply capture the interupt the wrapper
handles this for me.  My above assumptions are partially based on
experimental results as if I don't structure the code this way I get crash
errors of some form.

I have noticed the following though:

First, if I chain the interrupt, at the termination of the main app, which
waits in a loop for a keypress and then dumps the status of the registers
and PIC masks, it appears that the something external to my code is masking
out my irq, which is irq10.  Second, if I attempt to use int 8, the timer
interrupt the interrupt occurs repeatedly.

This leads me to believe that there may be a difference in the compiled
outut between DJGPP and Borland that possibly affects the hardware.  The
hardware that generates the interrupts is indead functioning as the borland,
real mode, compiled code executes fine.  So far I have not been able to
locate it though.

I believe that I am going to have to bring the code home from work and post
it to see if anyone else sees anything.  Sure would be nice if I had access
to a new-server from work but the company blocks just about everything
include FTP access!

"turomas" <josepmaria AT turomas DOT com> wrote in message
news:003e01c46b01$84546800$0d01a8c0 AT josepmariaxp...
> Try with this code. It works for me very well for long time ago.
>
>
> void configurar()
> {
> int div;
> disable();
>            //configura timers
> if(tipus_timer==0){
>  outportb(B_TIMER+3,0x80|0x36);
>  outportb(B_TIMER+2,4);
>  outportb(B_TIMER+2,0);
>  outportb(B_TIMER+3,0x40|0x36);
>  outportb(B_TIMER+1,(unsigned char)(div&0xff));
>  outportb(B_TIMER+1,(unsigned char)((div&0xff00)>>8));
>     }
>
> if(tipus_timer==1){
>  outport(B_TIMER,0x8000|(int)div);
>
> if(irqI<8)setvect(irqI+8,ent);         //I create setvect function for
> compatibility with Borland
> if(irqI>=8)setvect(0x70+irqI-8,ent);
> habilita_interrupcio();
> if(irqI>=8)outportb(0xa0,0x20);
> outportb(0x20,0x20);
> enable();
> }
>
> void habilita_interrupcio()
> {
> outportb(0x21,0x0);
> if(irqI>=8)outportb(0xa1,0x0);
> }
>
> void deshabilita_interrupcio()
> {
> if(irqI<8) outportb(0x21,(0x1<<irqI));
> else outportb(0xa1,(0x1<<(irqI&0x7)));
> }
>
> unsigned int state87[200];
>
> void ent()
> {
> asm("fnsave %0\n\t"
>     "fwait\n\t"
>     :"=g" (state87)
>     );
>
> //Codi interrupció
>
> asm("frstor %0\n\t"
>     "fwait\n\t"
>     :"=g" (state87)
>     );
>
> if(irqI>=8)outportb(0xa0,0x20);
> outportb(0x20,0x20);
> }
>
>
> int setvect(int intno,void (*interrupt)())
> {
> _go32_dpmi_get_protected_mode_interrupt_vector(intno, &old_handler);
> new_handler.pm_offset = (int)(ent);
> new_handler.pm_selector = _go32_my_cs();
> if(chain==1)_go32_dpmi_chain_protected_mode_interrupt_vector(intno,
> &new_handler);
> if(chain==0){
>  _go32_dpmi_allocate_iret_wrapper(&new_handler);
>  _go32_dpmi_set_protected_mode_interrupt_vector(intno,&new_handler);
>     }
> intnombre=intno;  //I have to store irqnum to restore the old interrupt
> }
>
> void desconfigura_interrupcio()
> {
> if(intnombre>=0){
>  _go32_dpmi_set_protected_mode_interrupt_vector(intnombre, &old_handler);
>  if(chain==0)_go32_dpmi_free_iret_wrapper(&new_handler);
>     }
> }
>
>
>
>


- Raw text -


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