Line 1... |
Line 1... |
// #################################################################################################
|
// #################################################################################################
|
// # << NEORV32: neorv32_xirq.c - External Interrupt controller HW Driver >> #
|
// # << NEORV32: neorv32_xirq.c - External Interrupt controller HW Driver >> #
|
// # ********************************************************************************************* #
|
// # ********************************************************************************************* #
|
// # BSD 3-Clause License #
|
// # BSD 3-Clause License #
|
// # #
|
// # #
|
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. #
|
// # Copyright (c) 2022, Stephan Nolting. All rights reserved. #
|
// # #
|
// # #
|
// # Redistribution and use in source and binary forms, with or without modification, are #
|
// # Redistribution and use in source and binary forms, with or without modification, are #
|
// # permitted provided that the following conditions are met: #
|
// # permitted provided that the following conditions are met: #
|
// # #
|
// # #
|
// # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
// # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
Line 236... |
Line 236... |
register uint32_t src = NEORV32_XIRQ.SCR; // get IRQ source (with highest priority)
|
register uint32_t src = NEORV32_XIRQ.SCR; // get IRQ source (with highest priority)
|
|
|
uint32_t mask = 1 << src;
|
uint32_t mask = 1 << src;
|
NEORV32_XIRQ.IPR = ~mask; // clear current pending interrupt
|
NEORV32_XIRQ.IPR = ~mask; // clear current pending interrupt
|
|
|
neorv32_cpu_csr_write(CSR_MIP, 1 << XIRQ_FIRQ_PENDING); // acknowledge XIRQ FIRQ
|
neorv32_cpu_csr_write(CSR_MIP, ~(1 << XIRQ_FIRQ_PENDING)); // acknowledge XIRQ FIRQ
|
|
|
NEORV32_XIRQ.SCR = 0; // acknowledge current XIRQ interrupt source
|
NEORV32_XIRQ.SCR = 0; // acknowledge current XIRQ interrupt source
|
|
|
// execute handler
|
// execute handler
|
register uint32_t xirq_handler = __neorv32_xirq_vector_lut[src];
|
register uint32_t xirq_handler = __neorv32_xirq_vector_lut[src];
|