Skip to content

cpu/stm32: gpio: use bit-banding #14517

Closed
benpicco wants to merge 1 commit intoRIOT-OS:masterfrom
benpicco:cpu/stm32/gpio_bitband
Closed

cpu/stm32: gpio: use bit-banding #14517
benpicco wants to merge 1 commit intoRIOT-OS:masterfrom
benpicco:cpu/stm32/gpio_bitband

Conversation

@benpicco
Copy link
Contributor

@benpicco benpicco commented Jul 14, 2020

Contribution description

Bit-Banding is available on STM32 CPUs, so make use of it in the GPIO driver to save a few cycles when setting pins.

Testing procedure

tests/periph_gpio should still work.

Issues/PRs references

depends on #14516

@benpicco benpicco added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation State: waiting for other PR State: The PR requires another PR to be merged first Area: cpu Area: CPU/MCU ports labels Jul 14, 2020
@benpicco benpicco requested a review from MrKevinWeiss as a code owner July 14, 2020 19:55
@benpicco benpicco removed the request for review from MrKevinWeiss July 14, 2020 20:21
@benpicco benpicco removed the State: waiting for other PR State: The PR requires another PR to be merged first label Jul 14, 2020
@benpicco benpicco force-pushed the cpu/stm32/gpio_bitband branch from e3509f9 to 6981156 Compare July 14, 2020 20:43
Bit-Banding is available on STM32 CPUs, so make use of it
in the GPIO driver to save a few cycles when setting pins.
@benpicco benpicco force-pushed the cpu/stm32/gpio_bitband branch from 6981156 to 951d742 Compare July 20, 2020 22:52
@benpicco benpicco changed the title cpu/stm32: gpio: use bit-banding & optimisations cpu/stm32: gpio: use bit-banding Jul 25, 2020
@benpicco benpicco added the State: waiting for other PR State: The PR requires another PR to be merged first label Jul 25, 2020
Copy link
Contributor

@gschorcht gschorcht left a comment

Choose a reason for hiding this comment

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

Some of the changes will become obsolete once the low-level GPIO API in PR #14610 handles pin masks. This functions will change to something like the following:

_port(port)->BSRR = pins;

Not sure whether we should introduce it for now. It will make rebasing harder.

void gpio_set(gpio_t pin)
{
_port(pin)->BSRR = (1 << _pin_num(pin));
bit_set32(&_port(pin)->BSRR, _pin_num(pin));
Copy link
Contributor

Choose a reason for hiding this comment

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

This change will become obsolete with PR #14610 and will produce conflicts.

void gpio_clear(gpio_t pin)
{
_port(pin)->BSRR = (1 << (_pin_num(pin) + 16));
bit_set32(&_port(pin)->BSRR, _pin_num(pin) + 16);
Copy link
Contributor

Choose a reason for hiding this comment

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

This change will become obsolete with PR #14610 and will produce conflicts.

@benpicco benpicco removed the State: waiting for other PR State: The PR requires another PR to be merged first label Nov 16, 2020
@stale
Copy link

stale bot commented Jun 2, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Jun 2, 2021
@stale stale bot closed this Jul 8, 2021
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 State: stale State: The issue / PR has no activity for >185 days Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants