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/qn908x: use bitarithm_test_and_clear() & fix cb #18989

Merged
merged 2 commits into from
Nov 28, 2022

Conversation

maribu
Copy link
Member

@maribu maribu commented Nov 28, 2022

Contribution description

Previously, the callback was incorrectly passed a channel of zero as argument regardless of the channel that triggered the IRQ. This fixes the issue and also uses bitarithm_test_and_clear() to only iterate over the channels that actually have an IRQ flag set, rather than all channels.

Testing procedure

$ make BOARD=qn9080dk flash test -C tests/periph_timer

for the test application pimped up by #18963

With master

Help: Press s to start test, r to print it is ready
READY
s
START
main(): This is RIOT! (Version: 2023.01-devel-473-g496ab-tests/periph_timer)

Test for peripheral TIMERs

Available timers: 4

Testing TIMER_0:
TIMER_0: initialization successful
TIMER_0: stopped
TIMER_0: set channel 0 to 5000
TIMER_0: set channel 1 to 10000
TIMER_0: set channel 2 to 15000
TIMER_0: set channel 3 to 20000
TIMER_0: starting
TIMER_0: channel 0 fired at SW count    39971 - init:    39971
TIMER_0: ERROR callback argument mismatch


Testing TIMER_1:
TIMER_1: initialization successful
TIMER_1: stopped
TIMER_1: set channel 0 to 5000
TIMER_1: set channel 1 to 10000
TIMER_1: set channel 2 to 15000
TIMER_1: set channel 3 to 20000
TIMER_1: starting
TIMER_1: channel 0 fired at SW count    39970 - init:    39970
TIMER_1: ERROR callback argument mismatch


Testing TIMER_2:
TIMER_2: initialization successful
TIMER_2: stopped
TIMER_2: set channel 0 to 5000
TIMER_2: set channel 1 to 10000
TIMER_2: set channel 2 to 15000
TIMER_2: set channel 3 to 20000
TIMER_2: starting
TIMER_2: channel 0 fired at SW count    39972 - init:    39972
TIMER_2: ERROR callback argument mismatch


Testing TIMER_3:
TIMER_3: initialization successful
TIMER_3: stopped
TIMER_3: set channel 0 to 5000
TIMER_3: set channel 1 to 10000
TIMER_3: set channel 2 to 15000
TIMER_3: set channel 3 to 20000
TIMER_3: starting
TIMER_3: channel 0 fired at SW count    39970 - init:    39970
TIMER_3: ERROR callback argument mismatch


TEST FAILED
{ "threads": [{ "name": "main", "stack_size": 1536, "stack_used": 408 }]}
Timeout in expect script at "child.expect('TEST SUCCEEDED')" (tests/periph_timer/tests/01-run.py:21)

make: *** [/home/maribu/Repos/software/RIOT/makefiles/tests/tests.inc.mk:26: test] Error 1

This PR

READY
s
START
main(): This is RIOT! (Version: 2023.01-devel-474-g1df0f56-cpu/qn908x)

Test for peripheral TIMERs

Available timers: 4

Testing TIMER_0:
TIMER_0: initialization successful
TIMER_0: stopped
TIMER_0: set channel 0 to 5000
TIMER_0: set channel 1 to 10000
TIMER_0: set channel 2 to 15000
TIMER_0: set channel 3 to 20000
TIMER_0: starting
TIMER_0: channel 0 fired at SW count    10000 - init:    10000
TIMER_0: channel 1 fired at SW count    19993 - diff:     9993
TIMER_0: channel 2 fired at SW count    29986 - diff:     9993
TIMER_0: channel 3 fired at SW count    39979 - diff:     9993

Testing TIMER_1:
TIMER_1: initialization successful
TIMER_1: stopped
TIMER_1: set channel 0 to 5000
TIMER_1: set channel 1 to 10000
TIMER_1: set channel 2 to 15000
TIMER_1: set channel 3 to 20000
TIMER_1: starting
TIMER_1: channel 0 fired at SW count     9999 - init:     9999
TIMER_1: channel 1 fired at SW count    19992 - diff:     9993
TIMER_1: channel 2 fired at SW count    29985 - diff:     9993
TIMER_1: channel 3 fired at SW count    39978 - diff:     9993

Testing TIMER_2:
TIMER_2: initialization successful
TIMER_2: stopped
TIMER_2: set channel 0 to 5000
TIMER_2: set channel 1 to 10000
TIMER_2: set channel 2 to 15000
TIMER_2: set channel 3 to 20000
TIMER_2: starting
TIMER_2: channel 0 fired at SW count     9999 - init:     9999
TIMER_2: channel 1 fired at SW count    19992 - diff:     9993
TIMER_2: channel 2 fired at SW count    29985 - diff:     9993
TIMER_2: channel 3 fired at SW count    39978 - diff:     9993

Testing TIMER_3:
TIMER_3: initialization successful
TIMER_3: stopped
TIMER_3: set channel 0 to 5000
TIMER_3: set channel 1 to 10000
TIMER_3: set channel 2 to 15000
TIMER_3: set channel 3 to 20000
TIMER_3: starting
TIMER_3: channel 0 fired at SW count     9999 - init:     9999
TIMER_3: channel 1 fired at SW count    19992 - diff:     9993
TIMER_3: channel 2 fired at SW count    29985 - diff:     9993
TIMER_3: channel 3 fired at SW count    39978 - diff:     9993

TEST SUCCEEDED

Issues/PRs references

Found well testing for #18976

The linter was unhappy that `unsinged long` and `uint32_t` were used
inconsistency (in the `timer_init()` declaration, implementation, as
well as in the `DEBUG()` format specifiers).
Previously, the callback was incorrectly passed a channel of zero as
argument regardless of the channel that triggered the IRQ. This fixes
the issue and also uses `bitarithm_test_and_clear()` to only iterate
over the channels that actually have an IRQ flag set, rather than
all channels.
@maribu maribu added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Process: needs backport Integration Process: The PR is required to be backported to a release or feature branch labels Nov 28, 2022
@maribu maribu requested a review from benpicco November 28, 2022 15:43
@github-actions github-actions bot added Area: cpu Area: CPU/MCU ports Platform: ARM Platform: This PR/issue effects ARM-based platforms labels Nov 28, 2022
@maribu maribu mentioned this pull request Nov 28, 2022
20 tasks
@riot-ci
Copy link

riot-ci commented Nov 28, 2022

Murdock results

✔️ PASSED

0d85356 cpu/qn908x: use bitarithm_test_and_clear() & fix cb

Success Failures Total Runtime
117858 0 117858 01h:52m:48s

Artifacts

@maribu maribu merged commit 045bb7c into RIOT-OS:master Nov 28, 2022
@maribu maribu deleted the cpu/qn908x branch November 28, 2022 18:45
@maribu
Copy link
Member Author

maribu commented Nov 28, 2022

Thx :)

@maribu
Copy link
Member Author

maribu commented Nov 28, 2022

Backport provided in #18990

@kaspar030 kaspar030 added this to the Release 2023.01 milestone Jan 19, 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 CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Process: needs backport Integration Process: The PR is required to be backported to a release or feature branch Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants