--- hatari/src/includes/mfp.h 2019/04/01 07:13:09 1.1.1.6 +++ hatari/src/includes/mfp.h 2019/04/09 08:55:43 1.1.1.11 @@ -1,56 +1,94 @@ /* Hatari - mfp.h - This file is distributed under the GNU Public License, version 2 or at your - option any later version. Read the file gpl.txt for details. + This file is distributed under the GNU General Public License, version 2 + or at your option any later version. Read the file gpl.txt for details. */ #ifndef HATARI_MFP_H #define HATARI_MFP_H /* List of MFP interrupts (GPIP is General Purpose I/O Interrupt Port) */ -#define MFP_EXCEPT_GPIP7 15 /* Highest Priority */ -#define MFP_EXCEPT_GPIP6 14 -#define MFP_EXCEPT_TIMERA 13 -#define MFP_EXCEPT_RECBUFFULL 12 -#define MFP_EXCEPT_RECERR 11 -#define MFP_EXCEPT_TRANSBUFFEMPTY 10 -#define MFP_EXCEPT_TRANSERR 9 -#define MFP_EXCEPT_TIMERB 8 - -#define MFP_EXCEPT_GPIP5 7 -#define MFP_EXCEPT_ACIA 6 -#define MFP_EXCEPT_TIMERC 5 -#define MFP_EXCEPT_TIMERD 4 -#define MFP_EXCEPT_GPIP3 3 -#define MFP_EXCEPT_GPIP2 2 -#define MFP_EXCEPT_GPIP1 1 -#define MFP_EXCEPT_GPIP0 0 /* Lowest Priority */ - -/* MFP register defines */ -#define MFP_TIMER_GPIP7_BIT 0x80 -#define MFP_TIMER_A_BIT 0x20 -#define MFP_RCVBUFFULL_BIT 0x10 -#define MFP_TRNBUFEMPTY_BIT 0x04 -#define MFP_TIMER_B_BIT 0x01 -#define MFP_FDCHDC_BIT 0x80 -#define MFP_ACIA_BIT 0x40 -#define MFP_TIMER_C_BIT 0x20 -#define MFP_TIMER_D_BIT 0x10 +#define MFP_INT_MAX 15 /* We have 16 ints from 0 to 15 */ + +#define MFP_INT_GPIP7 15 /* Highest Priority */ +#define MFP_INT_GPIP6 14 +#define MFP_INT_TIMER_A 13 +#define MFP_INT_RCV_BUF_FULL 12 +#define MFP_INT_RCV_ERR 11 +#define MFP_INT_TRN_BUF_EMPTY 10 +#define MFP_INT_TRN_ERR 9 +#define MFP_INT_TIMER_B 8 + +#define MFP_INT_GPIP5 7 +#define MFP_INT_GPIP4 6 +#define MFP_INT_TIMER_C 5 +#define MFP_INT_TIMER_D 4 +#define MFP_INT_GPIP3 3 +#define MFP_INT_GPIP2 2 +#define MFP_INT_GPIP1 1 +#define MFP_INT_GPIP0 0 /* Lowest Priority */ + + +/* MFP register defines ( 1 << Int ) */ +#define MFP_GPIP7_BIT 0x80 +#define MFP_GPIP6_BIT 0x40 +#define MFP_TIMER_A_BIT 0x20 +#define MFP_RCV_BUF_FULL_BIT 0x10 +#define MFP_RCV_ERR_BIT 0x08 +#define MFP_TRN_BUF_EMPTY_BIT 0x04 +#define MFP_TRN_ERR_BIT 0x02 +#define MFP_TIMER_B_BIT 0x01 + +#define MFP_GPIP5_BIT 0x80 +#define MFP_GPIP4_BIT 0x40 +#define MFP_TIMER_C_BIT 0x20 +#define MFP_TIMER_D_BIT 0x10 +#define MFP_GPIP3_BIT 0x08 +#define MFP_GPIP2_BIT 0x04 +#define MFP_GPIP1_BIT 0x02 +#define MFP_GPIP0_BIT 0x01 + + +/* List of the GPIP lines */ +#define MFP_GPIP_LINE7 7 +#define MFP_GPIP_LINE6 6 +#define MFP_GPIP_LINE5 5 +#define MFP_GPIP_LINE4 4 +#define MFP_GPIP_LINE3 3 +#define MFP_GPIP_LINE2 2 +#define MFP_GPIP_LINE1 1 +#define MFP_GPIP_LINE0 0 + +#define MFP_GPIP_LINE_FDC_HDC MFP_GPIP_LINE5 +#define MFP_GPIP_LINE_ACIA MFP_GPIP_LINE4 +#define MFP_GPIP_LINE_GPU_DONE MFP_GPIP_LINE3 + +#define MFP_GPIP_STATE_LOW 0 +#define MFP_GPIP_STATE_HIGH 1 + /* MFP Registers */ extern Uint8 MFP_GPIP; extern Uint8 MFP_IERA,MFP_IERB; extern Uint8 MFP_IPRA,MFP_IPRB; +extern Uint8 MFP_TACR,MFP_TBCR; extern Uint8 MFP_VR; -extern Uint8 MFP_TACR,MFP_TBCR,MFP_TCDCR; +extern bool MFP_UpdateNeeded; extern void MFP_Reset(void); -extern void MFP_MemorySnapShot_Capture(BOOL bSave); -extern void MFP_CheckPendingInterrupts(void); -extern void MFP_InputOnChannel(Uint8 Bit, Uint8 EnableBit, Uint8 *pPendingReg); +extern void MFP_MemorySnapShot_Capture(bool bSave); + +extern Uint8 MFP_GetIRQ_CPU ( void ); +extern void MFP_DelayIRQ ( void ); +extern int MFP_ProcessIACK ( int OldVecNr ); +extern bool MFP_ProcessIRQ ( void ); +extern void MFP_UpdateIRQ ( Uint64 Event_Time ); +extern void MFP_InputOnChannel ( int Interrupt , int Interrupt_Delayed_Cycles ); +extern void MFP_GPIP_Set_Line_Input ( Uint8 LineNr , Uint8 Bit ); + extern void MFP_TimerA_EventCount_Interrupt(void); -extern void MFP_TimerB_EventCount_Interrupt(void); +extern void MFP_TimerB_EventCount_Interrupt( int Delayed_Cycles ); extern void MFP_InterruptHandler_TimerA(void); extern void MFP_InterruptHandler_TimerB(void); extern void MFP_InterruptHandler_TimerC(void);