English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 19 November 2020, 18:52   #1
Ernst Blofeld
<optimized out>
 
Ernst Blofeld's Avatar
 
Join Date: Sep 2020
Location: <optimized out>
Posts: 321
Enabling interrupts -> lockup?

So, I have this code, which is intended to enable copper interrupts:
Code:
KPrintF("a, %08lx 0x%04lx", custom, mask);
    custom->intreq = mask;
KPrintF("b");
    custom->intena = INTF_SETCLR | INTF_INTEN | mask;
KPrintF("c");
It outputs:
Code:
a, 00DFF000 0x0010
b
i.e. it never gets the the
KPrintF("c");
line.

Interrupts are happening, I can see them if I add KPrintFs to my level 3 interrupt handler, but my mainline code seems to have stalled.

I think I've taken over the system correctly.

I'm stumped at how to debug this. Any hints?

Edit:

The interrupts that are happening are not mine, as I don't yet trigger any interrupts in my copper list...

Edit 2:

So, the interrupts I'm getting are VBLANKs,

Code:
static __attribute__((interrupt)) void HandleLevel3Interrupt(void) {
    KPrintF("L3 0x%04lx", custom->intreqr & custom->intenar);
}
Is outputting

Code:
L3 0x0020
But those interrupts should be disabled, my system takeover code includes:

Code:
    custom->intena = INTF_INTEN | INTF_ALL; // disable all interrupts
    custom->intreq = INTF_INTEN | INTF_ALL; // clear any interrupts that were pending
and I've just checked, that's putting 0x7FFF into both addresses.

Last edited by Ernst Blofeld; 19 November 2020 at 19:31.
Ernst Blofeld is offline  
Old 19 November 2020, 19:39   #2
Samurai_Crow
Total Chaos forever!
 
Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,200
The blitter generates thw same interrupt as the copper. I hope that helps your diagnostics.
Samurai_Crow is offline  
Old 19 November 2020, 21:54   #3
a/b
Registered User
 
Join Date: Jun 2016
Location: europe
Posts: 1,068
1. order of operations matters
2. maybe the 3rd print is happening but it gets "interrupted" before it's finished (I don't know how exactly kprintf works)
3. clear corresponding intreq bit(s) in your interrupt handler, otherwise it will be perpetually called and lock up your main
a/b is offline  
Old 20 November 2020, 08:54   #4
Ernst Blofeld
<optimized out>
 
Ernst Blofeld's Avatar
 
Join Date: Sep 2020
Location: <optimized out>
Posts: 321
Ok, I now know that I'm getting VERTB interrupts even though I've disabled them.

My interrupt handler looks like this:

Code:
static __attribute__((interrupt)) void HandleLevel3Interrupt(void) {
    if (custom->intreqr & custom->intenar & INTF_COPER) {
        KPrintF("COPER");

        custom->intreq = (UWORD) INTF_COPER; custom->intreq = (UWORD) INTF_COPER;
        Display_CopperInterrupt();
    }

    if (custom->intreqr & custom->intenar & INTF_VERTB) {
        KPrintF("VERTB");

        custom->intreq = (UWORD) INTF_VERTB; custom->intreq = (UWORD) INTF_VERTB;
    }
}
And the output I'm seeing is:
Code:
VERTB
COPER
VERTB
COPER
VERTB
COPER
...
The disassembled code for my interrupt disabling is:

Code:
move.w  #32767,dff09a
move.w  #32767,dff09c
(32767 is 0x7fff)

Last edited by Ernst Blofeld; 20 November 2020 at 09:12.
Ernst Blofeld is offline  
Old 20 November 2020, 09:22   #5
Ernst Blofeld
<optimized out>
 
Ernst Blofeld's Avatar
 
Join Date: Sep 2020
Location: <optimized out>
Posts: 321
Ok, I understand now. My startup code calls LoadView(NULL), which re-enables the VERTB interrupt.

Last edited by Ernst Blofeld; 20 November 2020 at 11:38.
Ernst Blofeld is offline  
Old 20 November 2020, 09:30   #6
jotd
This cat is no more
 
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,382
mixing the OS with hardware banging is tricky

my code (in Bagman) calls LoadView/OwnBlitter then takes over the copperlist and all and never calls any OS routine ever...
jotd is offline  
Old 20 November 2020, 11:28   #7
hooverphonique
ex. demoscener "Bigmama"
 
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,643
Quote:
Originally Posted by Ernst Blofeld View Post
Ok, I understand now. My startup code calls LoadView, which re-enables the VERTB interrupt.
Perform your hardware-banging *after* doing OS stuff in startup, and the reverse when restoring
hooverphonique is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Keyboard, lockup nikosidis support.Hardware 0 18 September 2020 08:34
Enabling Firecracker 24? StrangeVoyager support.WinUAE 2 23 May 2019 21:24
Crash on enabling 68030 MMU with 3.0.0 mark_k support.WinUAE 14 25 January 2015 14:09
A500 lockup - please help Exi support.Hardware 7 29 July 2003 14:49

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:31.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.12017 seconds with 13 queries