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

cpu/avr8_common: Prepare for rework ISR #19777

Merged
merged 6 commits into from
Jul 11, 2023

Conversation

nandojve
Copy link
Contributor

Contribution description

This prepares for rework how ISR is handled for AVR-8 platform. It is not expected changes on the behavior but tests on other boards were welcome to avoid regressions.

Improvements

  • Split UART state from ISR states. Now it is necessary two variables and GPIORx registers are automatically selected when available.
  • UART states now supports up to 8 UARTs.
  • Added AVR8_ISR macro do clean-up and hide internals related to ISR processing. This allows changes on ISR without any other changes on drivers.

Testing procedure

Tests were conducted using atmega328p-xplained-mini and atxmega-a1u-xpro and the zigduino board was only built. The example thread_duel was used to test regressions.

@github-actions github-actions bot added Platform: AVR Platform: This PR/issue effects AVR-based platforms Area: drivers Area: Device drivers Area: cpu Area: CPU/MCU ports labels Jun 29, 2023
@maribu
Copy link
Member

maribu commented Jun 29, 2023

Code looks good to me, but the CI has some comments.

Note: The vera++ annotations are completely unrelated to this PR and #19779 should fix them.

@nandojve nandojve force-pushed the avr_common_prepare_for_rework_isr branch 2 times, most recently from 3d08415 to 70c08be Compare June 30, 2023 20:42
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Jul 4, 2023
@riot-ci
Copy link

riot-ci commented Jul 4, 2023

Murdock results

✔️ PASSED

1e23730 drivers: at86rf2xx: at86rf2xx_netdev: Fix vera warnings

Success Failures Total Runtime
6931 0 6931 10m:41s

Artifacts

The avr8_state store state information used to determine scheduling
and uart irq. This move all uart irq states to avr8_state_uart
variable. It introduce the use of General Purpose IO Register 0
(GPIOR0) when available and now all uarts from xmega can be used.

This is a preparation for future scheduling and irq optimizations.

Signed-off-by: Gerson Fernando Budke <[email protected]>
The avr8_state variable uses bit operation to set/clear the state. This
rework avr8_state to use increment/decrement instead. It introduce the
use of General Purpose IO Register 1 (GPIOR1) when available.

This is a preparation for future scheduling and irq optimizations.

Signed-off-by: Gerson Fernando Budke <[email protected]>
The thread_yield_higher is a normal functions. However it has a non
regular return instruction which is useless. This remove the useless
return on thread_yield_higher to save flash bytes.

Signed-off-by: Gerson Fernando Budke <[email protected]>
@nandojve nandojve force-pushed the avr_common_prepare_for_rework_isr branch from 70c08be to 9e40e39 Compare July 5, 2023 17:40
The current ISR implementation for AVR8 requires use of
avr8_[enter/exit]_isr pair which add some boilerplate on code.
This add AVR8_ISR which clean-up the code and make it simpler
and hides any schedule detail from the user perspective.

This is a preparation for future scheduling and irq optimizations.

Signed-off-by: Gerson Fernando Budke <[email protected]>
Signed-off-by: Gerson Fernando Budke <[email protected]>
@nandojve
Copy link
Contributor Author

nandojve commented Jul 7, 2023

This seems ready to go!

Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors merge

bors bot added a commit that referenced this pull request Jul 11, 2023
19777: cpu/avr8_common: Prepare for rework ISR r=benpicco a=nandojve

### Contribution description

This prepares for rework how ISR is handled for AVR-8 platform. It is not expected changes on the behavior but tests on other boards were welcome to avoid regressions.

#### Improvements
 * Split UART state from ISR states. Now it is necessary two variables and GPIORx registers are automatically selected when available.
 * UART states now supports up to 8 UARTs.
 * Added AVR8_ISR macro do clean-up and hide internals related to ISR processing. This allows changes on ISR without any other changes on drivers.

### Testing procedure

Tests were conducted using atmega328p-xplained-mini and atxmega-a1u-xpro and the zigduino board was only built. The example thread_duel was used to test regressions.

19798: cpu/nrf53: add I2C and SPI support r=benpicco a=dylad

### Contribution description

This PR provides support for nRF53 SPI and I2C.
It also moves common structs from each nRF CPU folder to `cpu/nrf5x_common` to avoid duplication.
Moreover, since nRF9160 and nRF5340 have shared IRQ for UART/SPI/I2C. Both this families now use a common file to register and manage these interrupts. Note that nRF9160 have different name for its interrupts than nRF5340 but they have the same purpose.

### Testing procedure

Since some structs were moved around, I think this PR should be carefully tested against nRF52, nRF53 and nRF9160 to avoid any issues.
On nRF5340DK-APP, SPI can be tested with its onboard SPI flash.

### Issues/PRs references



Co-authored-by: Gerson Fernando Budke <[email protected]>
Co-authored-by: Dylan Laduranty <[email protected]>
@bors
Copy link
Contributor

bors bot commented Jul 11, 2023

Build failed (retrying...):

@bors
Copy link
Contributor

bors bot commented Jul 11, 2023

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot merged commit 1b8ad7c into RIOT-OS:master Jul 11, 2023
@nandojve nandojve deleted the avr_common_prepare_for_rework_isr branch July 11, 2023 16:14
@benpicco benpicco added this to the Release 2023.07 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: cpu Area: CPU/MCU ports Area: drivers Area: Device drivers CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: AVR Platform: This PR/issue effects AVR-based platforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants