PAlib: Fichier source de PA_Interrupt.h

Page principale | Modules | Liste des fichiers | Portée globale | Rechercher

# PA_Interrupt.h

Aller à la documentation de ce fichier.

    00001 #ifndef _PA_Interrupt
    00002 #define _PA_Interrupt
    00003
    00004 #ifdef __cplusplus
    00005 extern "C" {
    00006 #endif
    00007
    00014 typedef void(*funcpointer)(void);
    00015
    00016 extern volatile u8 PA_Newframe;
    00017
    00018 extern volatile u8 PA_vblok; // Passe à 1 quand VBL activé...
    00019
    00020
    00021 extern u32 PA_CPU; // Pourcentage CPU...
    00022 extern u32 PA_MaxCPU; // Max CPU...
    00023 extern u32 PA_lines; // Nombre de lignes, pour faire le calcul...
    00024 extern u8 PA_VBLCount; // Compte le nombre de VBL avant qu'on en arrive à un tour
    00025 extern u8 PA_nVBLs;
    00026
    00027
    00028 /*
    00029 //Interrupt Registers
    00030 #ifndef REG_IME
    00031        #define REG_IME *(u32*)0x04000208
    00032 #endif
    00033 #ifndef REG_IE
    00034 #define REG_IE *(u32*)0x04000210
    00035 #endif
    00036 #ifndef REG_IF
    00037 #define REG_IF *(u32*)0x04000214
    00038 #endif*/
    00039
    00040 /*
    00041 #define REG_INTERRUPT IRQ_HANDLE
    00042 #define REG_DISPSTAT DISP_SR
    00043 */
    00044
    00045 //#define REG_VCOUNT _REG16(0x04000006)
    00046 /*
    00047 // Interrupts
    00048 #define INTVBLANK 0x0001
    00049 #define INTHBLANK 0x0002
    00050 #define INTVCOUNT 0x0004
    00051 #define INTTIMER0 0x0008
    00052 #define INTTIMER1 0x0010
    00053 #define INTTIMER2 0x0020
    00054 #define INTTIMER3 0x0040
    00055 #define INTCOM 0x0080
    00056 #define INTDMA0 0x0100
    00057 #define INTDMA1 0x0200
    00058 #define INTDMA2 0x0400
    00059 #define INTDMA3 0x0800
    00060 #define INTBUTTON 0x1000
    00061 #define INTCART 0x2000
    00062
    00063 #define INT_VBLANK 0
    00064 #define INT_HBLANK 1
    00065 #define INT_VCOUNT 2
    00066 #define INT_TIMER0 3
    00067 #define INT_TIMER1 4
    00068 #define INT_TIMER2 5
    00069 #define INT_TIMER3 6
    00070 #define INT_COM 7
    00071 #define INT_DMA0 8
    00072 #define INT_DMA1 9
    00073 #define INT_DMA2 10
    00074 #define INT_DMA3 11
    00075 #define INT_KEY 12
    00076 #define INT_CART 13*/
    00077
    00078 #define ENABLE_VBLANK 8
    00079 #define ENABLE_HBLANK 16
    00080 #define ENABLE_VCOUNT 32
    00081
    00082 /*
    00083 // Pour activer les timers, que pour moi...
    00084 // TIMER O
    00085 #define TIMER0COUNT         *(volatile u16 *)(0x04000100)
    00086 #define TIMER0CNT           *(volatile u16 *)(0x04000102)
    00087 #define TIMER0CNT_TIMER_START               (TIMER0CNT |= 0x0080)
    00088 #define TIMER0CNT_IRQ_ENABLE                (TIMER0CNT |= 0x0040)
    00089 #define PA_EnableTimer0() {TIMER0CNT_TIMER_START; TIMER0CNT_IRQ_ENABLE;}
    00090
    00091 #define TIMER0CNT_TIMER_STOP                (TIMER0CNT &= 0xFF7F)
    00092 #define TIMER0CNT_IRQ_DISABLE               (TIMER0CNT &= 0xFFBF)
    00093 #define PA_DisableTimer0() {TIMER0CNT_TIMER_STOP; TIMER0CNT_IRQ_DISABLE;}
    00094
    00095 // TIMER 1
    00096 #define TIMER1COUNT         *(volatile u16 *)(0x04000104)
    00097 #define TIMER1CNT           *(volatile u16 *)(0x04000106)
    00098 #define TIMER1CNT_TIMER_START               (TIMER1CNT |= 0x0080)
    00099 #define TIMER1CNT_IRQ_ENABLE                (TIMER1CNT |= 0x0040)
    00100 #define PA_EnableTimer1() {TIMER1CNT_TIMER_START; TIMER1CNT_IRQ_ENABLE;}
    00101
    00102 #define TIMER1CNT_TIMER_STOP                (TIMER1CNT &= 0xFF7F)
    00103 #define TIMER1CNT_IRQ_DISABLE               (TIMER1CNT &= 0xFFBF)
    00104 #define PA_DisableTimer1() {TIMER1CNT_TIMER_STOP; TIMER1CNT_IRQ_DISABLE;}
    00105
    00106 // TIMER 2
    00107 #define TIMER2COUNT         *(volatile u16 *)(0x04000108)
    00108 #define TIMER2CNT           *(volatile u16 *)(0x0400010A)
    00109 #define TIMER2CNT_TIMER_START               (TIMER2CNT |= 0x0080)
    00110 #define TIMER2CNT_IRQ_ENABLE                (TIMER2CNT |= 0x0040)
    00111 #define PA_EnableTimer2() {TIMER2CNT_TIMER_START; TIMER2CNT_IRQ_ENABLE;}
    00112
    00113 #define TIMER2CNT_TIMER_STOP                (TIMER2CNT &= 0xFF7F)
    00114 #define TIMER2CNT_IRQ_DISABLE               (TIMER2CNT &= 0xFFBF)
    00115 #define PA_DisableTimer2() {TIMER2CNT_TIMER_STOP; TIMER2CNT_IRQ_DISABLE;}
    00116
    00117 // TIMER 3
    00118 #define TIMER3COUNT         *(volatile u16 *)(0x0400010C)
    00119 #define TIMER3CNT           *(volatile u16 *)(0x0400010E)
    00120 #define TIMER3CNT_TIMER_START               (TIMER3CNT |= 0x0080)
    00121 #define TIMER3CNT_IRQ_ENABLE                (TIMER3CNT |= 0x0040)
    00122 #define PA_EnableTimer3() {TIMER3CNT_TIMER_START; TIMER3CNT_IRQ_ENABLE;}
    00123
    00124 #define TIMER3CNT_TIMER_STOP                (TIMER3CNT &= 0xFF7F)
    00125 #define TIMER3CNT_IRQ_DISABLE               (TIMER3CNT &= 0xFFBF)
    00126 #define PA_DisableTimer3() {TIMER3CNT_TIMER_STOP; TIMER3CNT_IRQ_DISABLE;}
    00127
    00128 */
    00129
    00130
    00131 //extern funcpointer interruptfunc[14];
    00132
    00133
    00134 void interruptfunction(void);
    00135
    00147 void PA_vblFunc(void);
    00148
    00149
    00158 extern inline void PA_InitVBL(void) {
    00159        //irqInit();
    00160        irqSet(IRQ_VBLANK, PA_vblFunc);
    00161        irqEnable(IRQ_VBLANK);
    00162 }
    00163
    00164 //PA_StartInt(INT_VBLANK, PA_vblFunc)
    00165
    00166
    00173 //void PA_ResetInterrupts(void);
    00174
    00188 //void PA_StartInt(u8 inter, funcpointer interfunc);
    00189 /*extern inline void PA_StartInt(u8 inter, funcpointer interfunc){
    00190        irqSet(inter, interfunc);
    00191        irqEnable(inter);
    00192 }*/
    00193
    00202 /*extern inline void PA_StopInt(u8 inter){
    00203        irqDisable(inter);
    00204 }*/
    00205
    00206
    00212 #define PA_GetVcount() (REG_VCOUNT&511)
    00213
    00214
    00215  // end of Interrupts
    00217
    00218 #ifdef __cplusplus
    00219 }
    00220 #endif
    00221 #endif
    00222
    00223