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 mimics the approach followed in
cortex-m
. The idea is to isolate those traits that must be implemented by PACs from other parts of our ecosystem that use them.In the (very) near future, I plan to move the
riscv-peripheral
crate here for standard peripherals. These will rely on the traits ofriscv-pac
to provide functionality. In this way, it will be less harmful to add breaking changes to the peripherals.So far, I added three main traits:
InterruptNumber
: for external interruptsPriorityNumber
: for encoding valid prioritiesHartIdNumber
: for enumerating the HARTs of the RISC-V targetAll these traits expect PACs to i) provide conversions to/from numbers and ii) specify the greatest expected value. The latter will help third-party tools such as RTIC to provide support for RISC-V targets.