revert between 56095 -> 55830 in arch
[AROS.git] / arch / m68k-amiga / cia / ableicr.c
blobda089736e194be8d5c1eef611f14333c531a5d4c
1 /*
2 Copyright © 2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: AbleICR() function.
6 Lang: english
7 */
9 #include <exec/libraries.h>
10 #include <proto/cia.h>
11 #include <proto/exec.h>
12 #include <hardware/cia.h>
13 #include <hardware/custom.h>
14 #include <hardware/intbits.h>
16 #include "cia_intern.h"
18 AROS_LH1(WORD, AbleICR,
19 AROS_LHA(WORD, mask, D0),
20 struct Library *, resource, 3, Cia)
22 AROS_LIBFUNC_INIT
24 struct CIABase *CiaBase = (struct CIABase *)resource;
25 volatile struct Custom *custom = (struct Custom *)0xdff000;
26 UBYTE old;
28 Disable();
30 old = CiaBase->enable_mask;
32 if (mask & 0x80)
33 CiaBase->enable_mask |= mask & 0x1f;
34 else
35 CiaBase->enable_mask &= ~mask;
37 CiaBase->hw->ciaicr = mask;
38 // do we need to trigger the interrupt now?
39 if (CiaBase->enable_mask & CiaBase->active_mask)
40 custom->intreq = INTF_SETCLR | CiaBase->inten_mask;
42 Enable();
44 return old;
46 AROS_LIBFUNC_EXIT