This function is newly added for RP2350, and the implementation appears inconsistent with the datasheet.
Datasheet says:
Set the number of pins which are not masked to 0 when read by an
IN PINS, WAIT PIN or MOV x, PINS instruction.
For example, an IN_COUNT of 5 means that the 5 LSBs of the IN pin group are
visible (bits 4:0), but the remaining 27 MSBs are masked to 0. A count of 32 is
encoded with a field value of 0, so the default behaviour is to not perform any
masking.
ie. the number in the register is the number of pins you are actually using, except that zero represents 32.
This function is newly added for RP2350, and the implementation appears inconsistent with the datasheet.
Datasheet says:
ie. the number in the register is the number of pins you are actually using, except that zero represents 32.
However, the code puts
(in_count - 1)
.https://github.com/raspberrypi/pico-sdk/blob/efe2103f9b28458a1615ff096054479743ade236/src/rp2_common/hardware_pio/include/hardware/pio.h#L393
Looks like it should be
(in_count & 0x1f)