Skip to content

Conversation

antodom
Copy link
Contributor

@antodom antodom commented Oct 15, 2015

This is a small improvement to WInterrupts.c for the DUE which allows a faster interrupt dispatching associated to generic I/O pins.

Basically I have modified the code of the interrupt handler functions PIOA_Handler(), PIOB_Handler(), PIOC_Handler() and PIOD_handler() in the original WInterrupts.c. The improvement consists mainly in taking advantage of ATSAM3XE assembler instruction CLZ. With this instruction it is possible to calculate the number of leading zeros in a 32 bit value in just one machine instruction. CLZ is available in C/C++ using CMSIS function __CLZ(). This change can improve the dispatching of interrupts a lot, specially when you have a sparse number of active interrupts associated with a few i/O pins.

@cmaglie cmaglie self-assigned this Oct 15, 2015
@cmaglie cmaglie added Component: Core Related to the code for the standard Arduino API feature request A request to make an enhancement (not a bug fix) Architecture: SAM Applies only to the SAM microcontrollers (Due) labels Oct 15, 2015
agdl added a commit that referenced this pull request Jan 5, 2016
PIO[ABCD] handlers improvement using ATSAM3X8E CLZ instruction
@agdl agdl merged commit 1ad17fb into arduino:master Jan 5, 2016
@cmaglie cmaglie added this to the Release 1.6.8 milestone Jan 5, 2016
ollie1400 pushed a commit to ollie1400/Arduino that referenced this pull request May 2, 2022
PIO[ABCD] handlers improvement using ATSAM3X8E CLZ instruction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Architecture: SAM Applies only to the SAM microcontrollers (Due) Component: Core Related to the code for the standard Arduino API feature request A request to make an enhancement (not a bug fix)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants