luckfox-pico-sdk/sysdrv/source/mcu/rt-thread/libcpu/arm/s3c44b0/interrupt.c
luckfox-eng29 8f34c2760d project:build.sh: Added fastboot support; custom modifications to U-Boot and kernel implemented using patches.
project:cfg:BoardConfig_IPC: Added fastboot BoardConfig file and firmware post-scripts, distinguishing between
the BoardConfigs for Luckfox Pico Pro and Luckfox Pico Max. project:app: Added fastboot_client and rk_smart_door
for quick boot applications; updated rkipc app to adapt to the latest media library. media:samples: Added more
usage examples. media:rockit: Fixed bugs; removed support for retrieving data frames from VPSS. media:isp:
Updated rkaiq library and related tools to support connection to RKISP_Tuner. sysdrv:Makefile: Added support for
compiling drv_ko on Luckfox Pico Ultra W using Ubuntu; added support for custom root filesystem.
sysdrv:tools:board: Updated Buildroot optional mirror sources, updated some software versions, and stored device
tree files and configuration files that undergo multiple modifications for U-Boot and kernel separately.
sysdrv:source:mcu: Used RISC-V MCU SDK with RT-Thread system, mainly for initializing camera AE during quick
boot. sysdrv:source:uboot: Added support for fastboot; added high baud rate DDR bin for serial firmware upgrades.
sysdrv:source:kernel: Upgraded to version 5.10.160; increased NPU frequency for RV1106G3; added support for
fastboot.

Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
2024-10-14 09:47:04 +08:00

145 lines
3.1 KiB
C

/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2006-09-06 XuXinming first version
* 2006-09-15 Bernard add interrupt bank 0..3 for more effective
* in irq trap
*/
#include <rtthread.h>
#include "s3c44b0.h"
#define MAX_HANDLERS 26
extern rt_uint32_t rt_interrupt_nest;
/* exception and interrupt handler table */
rt_isr_handler_t isr_table[MAX_HANDLERS];
rt_uint32_t rt_interrupt_from_thread, rt_interrupt_to_thread;
rt_uint32_t rt_thread_switch_interrupt_flag;
unsigned char interrupt_bank0[256];
unsigned char interrupt_bank1[256];
unsigned char interrupt_bank2[256];
unsigned char interrupt_bank3[256];
/**
* @addtogroup S3C44B0
*/
/*@{*/
void rt_hw_interrupt_handle(int vector)
{
rt_kprintf("Unhandled interrupt %d occured!!!\n", vector);
}
/**
* This function will initialize hardware interrupt
*/
void rt_hw_interrupt_init()
{
register int i;
/* all interrupt disabled include global bit */
INTMSK = 0x07ffffff;
/* clear pending register */
I_ISPC = 0x03ffffff;
/* non-vector mode IRQ enable */
INTCON = 0x5;
/* all IRQ mode */
INTMOD = 0x0;
/* init exceptions table */
for(i=0; i<MAX_HANDLERS; i++)
{
isr_table[i] = rt_hw_interrupt_handle;
}
for ( i = 0; i < 256; i++)
{
interrupt_bank0[i] = 0;
interrupt_bank1[i] = 0;
interrupt_bank2[i] = 0;
interrupt_bank3[i] = 0;
}
/* setup interrupt bank table */
interrupt_bank0[1] = 0;
interrupt_bank0[2] = 1;
interrupt_bank0[4] = 2;
interrupt_bank0[8] = 3;
interrupt_bank0[16] = 4;
interrupt_bank0[32] = 5;
interrupt_bank0[64] = 6;
interrupt_bank0[128]= 7;
interrupt_bank1[1] = 8;
interrupt_bank1[2] = 9;
interrupt_bank1[4] = 10;
interrupt_bank1[8] = 11;
interrupt_bank1[16] = 12;
interrupt_bank1[32] = 13;
interrupt_bank1[64] = 14;
interrupt_bank1[128]= 15;
interrupt_bank2[1] = 16;
interrupt_bank2[2] = 17;
interrupt_bank2[4] = 18;
interrupt_bank2[8] = 19;
interrupt_bank2[16] = 20;
interrupt_bank2[32] = 21;
interrupt_bank2[64] = 22;
interrupt_bank2[128]= 23;
interrupt_bank3[1] = 24;
interrupt_bank3[2] = 25;
/* init interrupt nest, and context in thread sp */
rt_interrupt_nest = 0;
rt_interrupt_from_thread = 0;
rt_interrupt_to_thread = 0;
rt_thread_switch_interrupt_flag = 0;
}
/**
* This function will mask a interrupt.
* @param vector the interrupt number
*/
void rt_hw_interrupt_mask(int vector)
{
INTMSK |= 1 << vector;
}
/**
* This function will un-mask a interrupt.
* @param vector the interrupt number
*/
void rt_hw_interrupt_umask(int vector)
{
INTMSK &= ~(1 << vector);
}
/**
* This function will install a interrupt service routine to a interrupt.
* @param vector the interrupt number
* @param new_handler the interrupt service routine to be installed
* @param old_handler the old interrupt service routine
*/
void rt_hw_interrupt_install(int vector, rt_isr_handler_t new_handler, rt_isr_handler_t *old_handler)
{
if(vector < MAX_HANDLERS)
{
if (old_handler != RT_NULL) *old_handler = isr_table[vector];
if (new_handler != RT_NULL) isr_table[vector] = new_handler;
}
}
/*@}*/