1
0
mirror of https://github.com/raspberrypi/pico-sdk.git synced 2025-08-07 17:02:52 +03:00

Fix WAIT GPIO n for n > 32 and when using gpio_base = 16 (#2265)

- fix bug: pioasm was spilling bit 5 of arg2 into arg1
- make pio_add_program flip bit 5 of a WAIT GPIO instruction if gpio_base is 16

Note: pioasm will encode only the bits 4-0 of arg2 (the GPIO number), however it does indicate whether
0-15 means 0-15 or 32-47. This can only be fixed up when loading the program, and indeed once the GPIO
base is known. pio_can_add_program and friends already detected the cases where this was impossible
This commit is contained in:
Graham Sanderson
2025-02-14 09:26:22 -06:00
committed by GitHub
parent e7f8e48b98
commit 302fd9a811
3 changed files with 14 additions and 1 deletions

View File

@@ -292,7 +292,7 @@ uint instruction::encode(program &program) {
}
}
// note we store the 6th bit of arg2 above the 16 bits of instruction
return (((uint) raw.type) << 13u) | (((uint) _delay | (uint) _sideset) << 8u) | (raw.arg1 << 5u) | raw.arg2 | ((raw.arg2 >> 5) << 16);
return (((uint) raw.type) << 13u) | (((uint) _delay | (uint) _sideset) << 8u) | (raw.arg1 << 5u) | (raw.arg2 & 0x1fu) | ((raw.arg2 >> 5) << 16);
}
raw_encoding instruction::raw_encode(program& program) {