81 lines
2.0 KiB
C
81 lines
2.0 KiB
C
// Copyright 2020-2021 Beken
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
#include <rthw.h>
|
|
#include <rtthread.h>
|
|
|
|
#include "interrupt_base.h"
|
|
#include "icu_driver.h"
|
|
#include "drv_model_pub.h"
|
|
|
|
extern uint32_t rt_interrupt_nest;
|
|
uint32_t rt_interrupt_from_thread, rt_interrupt_to_thread;
|
|
uint32_t rt_thread_switch_interrupt_flag;
|
|
|
|
/**
|
|
* This function will initialize hardware interrupt
|
|
*/
|
|
void rt_hw_interrupt_init(void)
|
|
{
|
|
arch_isr_entry_init();
|
|
|
|
/* 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)
|
|
{
|
|
icu_disable_interrupt(vector);
|
|
}
|
|
|
|
/**
|
|
* This function will un-mask a interrupt.
|
|
* @param vector the interrupt number
|
|
*/
|
|
void rt_hw_interrupt_umask(int vector)
|
|
{
|
|
icu_enable_interrupt(vector);
|
|
}
|
|
|
|
/**
|
|
* This function will install a interrupt service routine to a interrupt.
|
|
* @param vector the interrupt number
|
|
* @param handler the interrupt service routine to be installed
|
|
* @param param the interrupt service function parameter
|
|
* @param name the interrupt name
|
|
* @return old handler
|
|
*/
|
|
rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler,
|
|
void *param, char *name)
|
|
{
|
|
return RT_NULL;
|
|
}
|
|
|
|
void rt_irq_dispatch(void)
|
|
{
|
|
intc_irq();
|
|
}
|
|
|
|
void rt_fiq_dispatch(void)
|
|
{
|
|
intc_fiq();
|
|
}
|