Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚠️ Rework FIRQ System (re-rework): use MIP to clear/ack IRQs #236

Merged
merged 19 commits into from
Dec 9, 2021

Conversation

stnolting
Copy link
Owner

@stnolting stnolting commented Dec 8, 2021

This a rework of the Fast Interrupt Requests (FIRQ) system (a remake of #176).

Old Version (Current State)

The current FIRQ system implements module-specific mechanisms to clear/acknowledge pending FIRQs. For example a pending UART RX interrupt can be acknowledged by either writing to the UART control register or by reading from the UART's RX FIFO.

New Version (This PR)

This PR aims to provide a uniform way of acknowledging FIRQs by removing the device-specific mechanisms and introducing read-write capabilities for the CPU's mip CSR.

📚 The RISC-V privilege spec. allows mip to be read-write and to clear a pending interrupt by writing '1' to the according bit position.

Example for the new FIRQ triggering (UART RX FIRQ):

  1. The UART is enabled.
  2. The UART RX interrupt mode (NEORV32_UART0.CTRL UART_CTRL_RX_IRQ) is configured to '1' ("FIFO at least half-full").
  3. The RX FIFO's fill level reaches "half-full" level.
  4. A single-shot interrupt request is sent to the CPU.
  5. The CPU buffers the FIRQ if the according mie CSR bit is set.
  6. The pending FIRQ gets executed; the according interrupt handler is started.
  7. new: it is the task of the interrupt handler to clear/acknowledge the pending FIRQ by setting the according bit in the mip register.

The new FIRQ system simplifies the interrupt logic inside the peripheral modules. Furthermore, this concept allows more flexibility as the programmer can decide on which conditions a pending interrupt is actually cleared.

⚠️ Backwards Compatibility

  • The GPTMR_CTRL_ALARM bit of the general purpose timer's (GPTMR) control register has been removed.
  • The interrupt mode configuration bits of the SLINK (SLINK_IRQ_RX_MODE and SLINK_IRQ_TX_MODE) have been inverted.
  • Interrupt handler (even if they are called from the NEORV32 Run-Time Environment) have to clear the triggering FIRQ by writing 1 to the according mip CSR bit.

@stnolting stnolting added risc-v compliance Modification to comply with official RISC-V specs. HW hardware-related labels Dec 8, 2021
@stnolting stnolting self-assigned this Dec 8, 2021
@stnolting stnolting changed the title Rework FIRQ System (v3) Rework FIRQ System (re-rework) Dec 8, 2021
@stnolting stnolting added the enhancement New feature or request label Dec 8, 2021
@stnolting stnolting changed the title Rework FIRQ System (re-rework) ⚠️ Rework FIRQ System (re-rework) Dec 8, 2021
@stnolting stnolting marked this pull request as ready for review December 8, 2021 18:06
@stnolting stnolting changed the title ⚠️ Rework FIRQ System (re-rework) ⚠️ Rework FIRQ System (re-rework): use MIP to clear/ack IRQs Dec 9, 2021
@stnolting stnolting merged commit 6e9060b into master Dec 9, 2021
@stnolting stnolting deleted the rework_firq_v3 branch December 9, 2021 06:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request HW hardware-related risc-v compliance Modification to comply with official RISC-V specs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant