]> hackdaworld.org Git - my-code/arm.git/commitdiff
compilation errors fixed, debug now!
authorhackbard <hackbard@staubsauger.localdomain>
Thu, 20 Sep 2007 17:17:42 +0000 (19:17 +0200)
committerhackbard <hackbard@staubsauger.localdomain>
Thu, 20 Sep 2007 17:17:42 +0000 (19:17 +0200)
betty/betty.c
betty/interrupts.c

index 2cd287f885825a1a179d5a523993399dee477db6..0bd6d0a6ca6b40492fab913d269f10b6a1d6683a 100644 (file)
@@ -16,6 +16,7 @@ const char announce[]="betty - live from flash at 0x80000000! ;)\r\n";
 const char d1_txt[]="betty";
 const char d2_txt[]="- alphablend -";
 u8 contrast;
+t_button button;
 
 /*
  * functions
@@ -117,7 +118,6 @@ void input_event(void) {
 int main() {
 
        /* variables */
-       t_button button;
 
        /* system init */
        pll_init();
@@ -153,7 +153,7 @@ int main() {
        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 ...
index 49ea0cdc488a81017170096921be0bea8aee2481..db2061dd433f66c0a378bfe4c76e4672b9f081d7 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include "interrupts.h"
+#include "functions.h"
 
 // 'module global' interrupt variable
 static t_interrupt interrupt;
@@ -16,9 +17,9 @@ 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;
 }
 
@@ -29,12 +30,12 @@ void interrupt_set_default_callback(u32 callback_addr) {
 
 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) {
 
@@ -42,14 +43,14 @@ 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;
                }
@@ -66,29 +67,31 @@ int interrupt_enable(u8 src_number,u8 mode,u8 priority,u32 callback_addr) {
        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;
 }