]> hackdaworld.org Git - my-code/arm.git/commitdiff
some interrupt stuff, now basketball ...
authorhackbard <hackbard@sage.physik.uni-augsburg.de>
Tue, 18 Sep 2007 15:47:58 +0000 (17:47 +0200)
committerhackbard <hackbard@sage.physik.uni-augsburg.de>
Tue, 18 Sep 2007 15:47:58 +0000 (17:47 +0200)
betty/interrupts.c
betty/interrupts.h

index 61cf1afd93ebe88f03976f646736058486031eb7..41945cf30b417bf12ea2f43de0e7c7001bcc8bcb 100644 (file)
  * functions
  */
 
-void interrupt_set_default_callback(t_interrupt *ir,void *callback) {
+void interrupt_set_default_callback(void *callback) {
 
-       ir->default_callback=callback;
+       VICDefVectAddr=(u32)callback;
+       
 }
 
+void interrupt_clear(u8 src_number) {
 
+}
+
+int interrupt_set(u8 src_number,u8 mode,u8 priority,void *callback) {
+
+       /* check whether this ir source is allready assigned */
+       if(VICSoftInt&(1<<src_number))
+               return INTERRUPT_EINUSE;
+       
+       /* force interrupt */
+       VICSoftInt|=(1<<src_number);
+       VICIntEnable|=(1<<src_number);
+
+       switch(mode) {
+               case INTERRUPT_FIQ:
+                       VICIntSelect|=(1<<src_number);
+                       break;
+               case INTERRUPT_VIRQ:
+               case INTERRUPT_IRQ:
+               case default:
+       }
+
+       return INTERRUPT_SET;
+}
 
 /*
  * the actual exception handlers (as defined in startup.s)
index 20bb3332740c353d29c2a3c97cf2a56563e495f8..ab93f8f1ab1c5a0e508bf6b43d4bb71dd4197842 100644 (file)
 
 #define INTERRUPT_MAX_VIC              16
 
+#define INTERRUPT_WATCHDOG             0
+#define INTERRUPT_DBG_COMM_RX          2
+#define INTERRUPT_DBG_COMM_TX          3
+#define INTERRUPT_TIMER0               4
+#define INTERRUPT_TIMER1               5
+#define INTERRUPT_UART0                        6
+#define INTERRUPT_UART1                        7
+#define INTERRUPT_PWM                  8
+#define INTERRUPT_I2C                  9
+#define INTERRUPT_SPI0                 10
+#define INTERRUPT_SPI1                 11
+#define INTERRUPT_PLL                  12
+#define INTERRUPT_RTC                  13
+#define INTERRUPT_EINT0                        14
+#define INTERRUPT_EINT1                        15
+#define INTERRUPT_EINT2                        16
+#define INTERRUPT_EINT3                        17
+#define INTERRUPT_ADC                  18
+
+#define INTERRUPT_IRQ                  0
+#define INTERRUPT_VIRQ                 1
+#define INTERRUPT_FIQ                  2
+
 #define INTERRUPT_EXT_MODE_EDGE                0
 #define INTERRUPT_EXT_MODE_LEVEL       1
 #define INTERRUPT_EXT_POLAR_LOW                0
 #define INTERRUPT_EXT_POLAR_HIGH       1
 
+#define INTERRUPT_SET                  0x00
+#define INTERRUPT_EINUSE               0x01
+
 /* type definitions */
 
 typedef struct s_interrupt {