72 lines
1.3 KiB
C
72 lines
1.3 KiB
C
/******************************************************************************
|
|
*
|
|
* Copyright (c) 2017-2019 by Löwenware Ltd
|
|
* Please, refer LICENSE file for legal information
|
|
*
|
|
******************************************************************************/
|
|
|
|
/**
|
|
* @file irq.c
|
|
* @author Ilja Kartašov <ik@lowenware.com>
|
|
* @brief
|
|
*
|
|
* @see https://lowenware.com/
|
|
*/
|
|
|
|
#include <aarch64/bcm2837.h>
|
|
#include "timer.h"
|
|
#include "log.h"
|
|
#include "irq.h"
|
|
|
|
static const char *m_types[] = {
|
|
"EL1t_SYNC",
|
|
"EL1t_IRQ",
|
|
"EL1t_FIQ",
|
|
"EL1t_ERROR",
|
|
"EL1h_SYNC",
|
|
"EL1h_IRQ",
|
|
"EL1h_FIQ",
|
|
"EL1h_ERROR",
|
|
"EL0_64_SYNC",
|
|
"EL0_64_IRQ",
|
|
"EL0_64_FIQ",
|
|
"EL0_64_ERROR",
|
|
"EL0_32_SYNC",
|
|
"EL0_32_IRQ",
|
|
"EL0_32_FIQ",
|
|
"EL0_32_ERROR"
|
|
};
|
|
|
|
void
|
|
k_irq_enable_controller()
|
|
{
|
|
aarch64_set32r(ENABLE_IRQS_1, SYSTEM_TIMER_IRQ_1);
|
|
}
|
|
|
|
void
|
|
k_irq_handler(void)
|
|
{
|
|
unsigned int irq = aarch64_get32r(IRQ_PENDING_1);
|
|
switch(irq) {
|
|
case SYSTEM_TIMER_IRQ_1:
|
|
k_timer_irq_handler();
|
|
break;
|
|
|
|
default:
|
|
k_logs("Unhandled irq: ");
|
|
k_logu(irq, 16);
|
|
k_logs("\n");
|
|
}
|
|
}
|
|
|
|
void
|
|
k_irq_fallback(int type, unsigned long esr, unsigned long address)
|
|
{
|
|
k_logs(m_types[type]);
|
|
k_logs(" -> ESR: ");
|
|
k_logu(esr, 16);
|
|
k_logs(", address: ");
|
|
k_logu(address, 16);
|
|
k_logs("\n");
|
|
}
|