aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-03-24 16:44:51 -0700
committerChristian Cunningham <cc@localhost>2022-03-24 16:44:51 -0700
commit49bd4c133fc83de1cb1761ff089a2de03699d991 (patch)
tree1033663698e3651d0fdbc6773c6a3db8261ae3c3 /include
parentbb6ddd5a82ab4f2afa253b6048a71504c64274bb (diff)
IRQ Subscription
Diffstat (limited to 'include')
-rw-r--r--include/cpu/irq.h14
-rw-r--r--include/globals.h2
-rw-r--r--include/symbols.h2
-rw-r--r--include/usr/main.h3
4 files changed, 19 insertions, 2 deletions
diff --git a/include/cpu/irq.h b/include/cpu/irq.h
index 1879707..c5e59bb 100644
--- a/include/cpu/irq.h
+++ b/include/cpu/irq.h
@@ -1,6 +1,19 @@
#ifndef CPU_IRQ_H
#define CPU_IRQ_H
+#define UART_IRQ 0
+#define SYS_TIMER_0_IRQ 1
+#define SYS_TIMER_1_IRQ 2
+#define SYS_TIMER_2_IRQ 3
+#define SYS_TIMER_3_IRQ 4
+#define LOCAL_TIMER_IRQ 5
+#define MAX_IRQS LOCAL_TIMER_IRQ+1
+
+struct IrqEntry {
+ void* handler;
+ void* handler_info;
+};
+
static inline void enableirq(void)
{
asm volatile("cpsie i");
@@ -20,5 +33,6 @@ static inline void disablefiq(void)
unsigned long c_irq_handler(void);
unsigned long c_fiq_handler(void);
+void subscribe_irq(unsigned long irq_num, void* handler, void* handler_info);
#endif
diff --git a/include/globals.h b/include/globals.h
index 6c7e1f1..478b62e 100644
--- a/include/globals.h
+++ b/include/globals.h
@@ -1,5 +1,6 @@
#ifndef GLOBALS_H
#define GLOBALS_H
+#include <cpu/irq.h>
#include <sys/schedule.h>
#include <util/mutex.h>
@@ -20,6 +21,7 @@ extern struct Mutex mutexs[MAX_MUTEXS];
extern struct Entry mutex_entries[MAX_MUTEXS];
extern struct Thread threads[MAX_THREADS];
extern struct Entry thread_entries[MAX_THREADS];
+extern struct IrqEntry irqs[MAX_IRQS];
#endif
#endif
diff --git a/include/symbols.h b/include/symbols.h
index 90cfcf0..b81b1a9 100644
--- a/include/symbols.h
+++ b/include/symbols.h
@@ -50,7 +50,7 @@ enum
IRQ_BASIC_DISABLE = (IRQ_BASE + 0x224),
// Peripherals Interrupts
- UART_IRQ = 57,
+ //UART_IRQ = 57,
GPIO_IRQ_0 = 49,
GPIO_IRQ_1 = 50,
GPIO_IRQ_2 = 51,
diff --git a/include/usr/main.h b/include/usr/main.h
index 5fd29f9..3aec5a9 100644
--- a/include/usr/main.h
+++ b/include/usr/main.h
@@ -2,11 +2,12 @@
#define USR_MAIN_H
#ifdef RPI_BUILD
- #define USR_TIME 40
+ #define USR_TIME 260
#else
#define USR_TIME 2000
#endif
void main(void);
+void handle_data(unsigned char);
#endif