mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-09-03 00:31:57 +00:00
Update reserved function names starting with one underscore, replacing them as follows: '_k_' with 'z_' '_K_' with 'Z_' '_handler_' with 'z_handl_' '_Cstart' with 'z_cstart' '_Swap' with 'z_swap' This renaming is done on both global and those static function names in kernel/include and include/. Other static function names in kernel/ are renamed by removing the leading underscore. Other function names not starting with any prefix listed above are renamed starting with a 'z_' or 'Z_' prefix. Function names starting with two or three leading underscores are not automatcally renamed since these names will collide with the variants with two or three leading underscores. Various generator scripts have also been updated as well as perf, linker and usb files. These are drivers/serial/uart_handlers.c include/linker/kobject-text.ld kernel/include/syscall_handler.h scripts/gen_kobject_list.py scripts/gen_syscall_header.py Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
78 lines
1.5 KiB
C
78 lines
1.5 KiB
C
/*
|
|
* Copyright (c) 2017 Jean-Paul Etienne <fractalclone@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/**
|
|
* @file
|
|
* @brief interrupt management code for riscv SOCs supporting the riscv
|
|
privileged architecture specification
|
|
*/
|
|
#include <irq.h>
|
|
|
|
void z_arch_irq_enable(unsigned int irq)
|
|
{
|
|
u32_t mie;
|
|
|
|
#if defined(CONFIG_RISCV_HAS_PLIC)
|
|
if (irq > RISCV_MAX_GENERIC_IRQ) {
|
|
riscv_plic_irq_enable(irq);
|
|
return;
|
|
}
|
|
#endif
|
|
|
|
/*
|
|
* CSR mie register is updated using atomic instruction csrrs
|
|
* (atomic read and set bits in CSR register)
|
|
*/
|
|
__asm__ volatile ("csrrs %0, mie, %1\n"
|
|
: "=r" (mie)
|
|
: "r" (1 << irq));
|
|
}
|
|
|
|
void z_arch_irq_disable(unsigned int irq)
|
|
{
|
|
u32_t mie;
|
|
|
|
#if defined(CONFIG_RISCV_HAS_PLIC)
|
|
if (irq > RISCV_MAX_GENERIC_IRQ) {
|
|
riscv_plic_irq_disable(irq);
|
|
return;
|
|
}
|
|
#endif
|
|
|
|
/*
|
|
* Use atomic instruction csrrc to disable device interrupt in mie CSR.
|
|
* (atomic read and clear bits in CSR register)
|
|
*/
|
|
__asm__ volatile ("csrrc %0, mie, %1\n"
|
|
: "=r" (mie)
|
|
: "r" (1 << irq));
|
|
};
|
|
|
|
int z_arch_irq_is_enabled(unsigned int irq)
|
|
{
|
|
u32_t mie;
|
|
|
|
#if defined(CONFIG_RISCV_HAS_PLIC)
|
|
if (irq > RISCV_MAX_GENERIC_IRQ)
|
|
return riscv_plic_irq_is_enabled(irq);
|
|
#endif
|
|
|
|
__asm__ volatile ("csrr %0, mie" : "=r" (mie));
|
|
|
|
return !!(mie & (1 << irq));
|
|
}
|
|
|
|
#if defined(CONFIG_RISCV_SOC_INTERRUPT_INIT)
|
|
void soc_interrupt_init(void)
|
|
{
|
|
/* ensure that all interrupts are disabled */
|
|
(void)irq_lock();
|
|
|
|
__asm__ volatile ("csrwi mie, 0\n"
|
|
"csrwi mip, 0\n");
|
|
}
|
|
#endif
|