Wolfvak 016eac6982 - properly set up MMU tables with caching and other fun stuff
- maps a regular ARM-style exception vector table instead of using the bootrom vector redirection

features a ton of bugs because I'm missing something, it actually manages to boot fb3DS v1.2 and BAX fine, but fails to boot itself
2019-06-03 02:27:41 +02:00

21 lines
559 B
C
Executable File

#include <types.h>
#include <arm.h>
#include "arm/gic.h"
#include "arm/timer.h"
#define TIMER_INTERRUPT (0x1E)
#define REG_TIMER(c, n) REG_ARM_PMR(0x700 + ((c) * 0x100) + (n), u32)
#define TIMER_THIS_CPU (-1)
#define REG_TIMER_LOAD(c) *REG_TIMER((c), 0x00)
#define REG_TIMER_COUNT(c) *REG_TIMER((c), 0x04)
#define REG_TIMER_CNT(c) *REG_TIMER((c), 0x08)
#define REG_TIMER_IRQ(c) *REG_TIMER((c), 0x0C)
#define TIMER_CNT_SCALE(n) ((n) << 8)
#define TIMER_CNT_INT_EN BIT(2)
#define TIMER_CNT_RELOAD BIT(1)
#define TIMER_CNT_ENABLE BIT(0)