const char d1_txt[]="betty";
const char d2_txt[]="- alphablend -";
u8 contrast;
+t_button button;
/*
* functions
int main() {
/* variables */
- t_button button;
/* system init */
pll_init();
interrupt_ext_ir_config(INTERRUPT_EXT3,INTERRUPT_EXT_NOWAKE,
INTERRUPT_EXT_MODE_EDGE,
INTERRUPT_EXT_POLAR_LOW);
- interrupt_enable(INTERRUPT_EINT3,INTERRUPT_MODE_VIRQ,0,input_event);
+ interrupt_enable(INTERRUPT_EINT3,INTERRUPT_MODE_VIRQ,0,(u32)input_event);
/*
* start it ...
*/
#include "interrupts.h"
+#include "functions.h"
// 'module global' interrupt variable
static t_interrupt interrupt;
void interrupt_init(void) {
- memset(&interrupt,0,sizeof(t_interrupt));
- VICSoftIntClear=0xff;
- VICIntEnClear=0xff;
+ interrupt.default_soft_callback=0;
+ VICSoftIntClr=0xffffffff;
+ VICIntEnClr=0xffffffff;
VICDefVectAddr=0;
}
void interrupt_set_soft_callback(void (*callback)(void)) {
- interrupt->default_soft_callback=callback;
+ interrupt.default_soft_callback=callback;
}
void interrupt_soft_clear(u8 src_number) {
- VICSoftIntClear=(1<<src_number);
+ VICSoftIntClr=(1<<src_number);
}
void interrupt_clear(u8 src_number) {
u32 *addr;
u32 *cntl;
- VICIntEnClear=(1<<src_number);
+ VICIntEnClr=(1<<src_number);
VICIntSelect&=~(1<<src_number);
- addr=&VICVectAddr0;
- cntl=&VICVectCntl0;
+ addr=(u32 *)&VICVectAddr0;
+ cntl=(u32 *)&VICVectCntl0;
for(cnt=0;cnt<INTERRUPT_MAX_VIC;cnt++) {
- if(cntl[cnt]&0x1f==src_number) {
+ if((cntl[cnt]&0x1f)==src_number) {
*((volatile u32 *)(addr+cnt))=0;
*((volatile u32 *)(cntl+cnt))=0;
}
u32 *addr;
u32 *cntl;
- addr=&VICVectAddr0;
- cntl=&VICVectCntl0;
+ addr=(u32 *)&VICVectAddr0;
+ cntl=(u32 *)&VICVectCntl0;
/* check whether this ir source is allready assigned */
if(VICIntEnable&(1<<src_number))
return INTERRUPT_USED;
- /* force interrupt */
- VICIntEnable=(1<<src_number);
-
+ /* prepare depending on mode */
switch(mode) {
case INTERRUPT_MODE_FIQ:
VICIntSelect|=(1<<src_number);
break;
case INTERRUPT_MODE_VIRQ:
- if(addr[p]&0x3f)
- return INTERRUP_PRIORITY_USED;
- *((volatile u32 *)(addr+p))=callback_addr;
- *((volatile u32 *)(cntl+p))=src_number&0x1f+(1<<5);
+ if(addr[priority]&0x3f)
+ return INTERRUPT_PRIORITY_USED;
+ *((volatile u32 *)(addr+priority))=callback_addr;
+ *((volatile u32 *)(cntl+priority))=(src_number&0x1f)+0x20;
case INTERRUPT_MODE_IRQ:
- case default:
+ default:
+ break;
}
+ /* force interrupt */
+ VICIntEnable=(1<<src_number);
+
return INTERRUPT_SET;
}