From 1a38973eb8fd0f889f7c272e9ef183687034d550 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Fri, 22 Jan 2021 01:13:44 +0100 Subject: interrupt: Refactor to be more flexible. --- interrupt/interrupt.h | 58 --------------------------------------------------- 1 file changed, 58 deletions(-) delete mode 100644 interrupt/interrupt.h (limited to 'interrupt/interrupt.h') diff --git a/interrupt/interrupt.h b/interrupt/interrupt.h deleted file mode 100644 index b87abef..0000000 --- a/interrupt/interrupt.h +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef INTERRUPT_H -#define INTERRUPT_H - -#include - -#include "interrupt_enums.h" - -struct NVIC_t { - volatile uint32_t ISER[32]; - volatile uint32_t ICER[32]; - volatile uint32_t ISPR[32]; - volatile uint32_t ICPR[32]; - volatile uint32_t IABR[64]; - volatile uint8_t IPR[2816]; - volatile uint32_t STIR; -}; - -static NVIC_t& NVIC = *(NVIC_t*)0xe000e100; - -struct SCB_t { - volatile uint32_t CPUID; - volatile uint32_t ICSR; - volatile uint32_t VTOR; - volatile uint32_t AIRCR; - volatile uint32_t SCR; - volatile uint32_t CCR; - volatile uint8_t SHPR[12]; - volatile uint32_t SHCSR; - volatile uint32_t CFSR; - volatile uint32_t HFSR; - volatile uint32_t DFSR; - volatile uint32_t MMAR; - volatile uint32_t BFAR; -}; - -static SCB_t& SCB = *(SCB_t*)0xe000ed00; - -namespace Interrupt { - inline void enable(IRQ n) { - NVIC.ISER[int(n) >> 5] = 1 << (int(n) & 0x1f); - } - - inline void set_priority(Exception n, uint8_t priority) { - SCB.SHPR[int(n) - 4] = priority; - } - - inline void set_priority(IRQ n, uint8_t priority) { - NVIC.IPR[int(n)] = priority; - } -}; - -template -void interrupt(); - -template -void interrupt(); - -#endif -- cgit v1.2.3