-
Notifications
You must be signed in to change notification settings - Fork 212
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
[UARTs] add RX & TX FIFOs #183
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Note that the FIFO config generics have not been exposed yet. The current VHDL code implements FIFOs with 4 entries each. Since _NO_ software driver have been modified yet, this commit is some kind of backwards-compatibility check
* `neorv32_uart*_putc`is now checking if TX FIFO is full before densing new data (-> faster) * `neorv32_uart*_tx_busy` also checks if TX FIFO is empty * reworked `neorv32_uart*_getc_safe` (return codes)
* bootload and blink_led example * now using updated UART functions (using FIFOs if implemented)
@stnolting Sorry I didn't respond to this earlier. This looks like a really nice addition. I will add Zephyr support for using the FIFOs. |
Awesome! 👍 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds optional and fully configurable RX and TX FIFOs to the UARTs. Furthermore, this PR provides a complete makeover of the UART's VHDL source code (clean-up and logic optimization).
This PR will be merged when implementation & testing are done and documentation is updated.
Any kind of feedback is highly appreciated.
Affected peripheral devices
UART0
(FIRQ 2, 3)UART1
(FIRQ 4, 5)Old Version (current state, pre-PR)
The current UARTs do not provide any kind of TX buffering and only provide a simple RX double-buffering.
The current UART interrupts:
New Version (this PR)
The new version of the UART provides independent RX and TX FIFOs, which are configured by new generics:
IO_UART0_RX_FIFO
: typenatural
, depth of UART0 RX FIFO, power of 2, min 1IO_UART0_TX_FIFO
: typenatural
, depth of UART0 TX FIFO, power of 2, min 1IO_UART1_RX_FIFO
: typenatural
, depth of UART1 RX FIFO, power of 2, min 1IO_UART1_TX_FIFO
: typenatural
, depth of UART1 TX FIFO, power of 2, min 1The FIFO status can be checked by software via six new control register bits (in
NEORV32_UARTx.CTRL
):Furthermore, the interrupt-trigger can be configured by two new control register bits (in
NEORV32_UARTx.CTRL
):1
= FIFO at least half-full;0
= FIFO not empty1
= FIFO less than half-full;0
= FIFO not full✔️ Backwards Compatibility
The changes in this PR are fully backwards-compatible.
The updated software drivers now check the TX FIFO FULL flag (UART_CTRL_TX_FULL) before writing new data. Drivers for reading data from the UART are not altered (UART_DATA_AVAIL is now driven by the RX FIFO instead by the receiver status).
Legacy drivers can still check the transmitter busy flag (UART_CTRL_TX_BUSY) before sending new data (this will just not make use of the TX FIFO capabilities) (looking at @henrikbrixandersen and zephyrproject-rtos/zephyr#39162 😉).
The ressource requirements with FIFO sizes = 1 are identical to the pre-PR version (providing true double-buffering for RX and now also for TX).