-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rp2xxx: Add support for assembling RP2350-specific PIO (#320)
* rp2xxx: Update PIO for rp2350 * - Reorganized some of the comptime behavior surrounding CPU * Get pio comparison tests running on both cpu types * Fix PIO sm_set_shift_options * s/format/cpu * better error in tokenizer tests * Test expected index in define expect_define * More tests for both cpus * Add jmppin as valid source for wait * Test mov to pindirs * cleanup irq comp test * wip movrx * mov to rx working * Add movrx comparison tests * put ws2812 in both chips * wip: print diag and error * Fix error handling in rp2xxx pio assembler * Repro issue in diags * Fix diag issue * Cleanup diags * improve movtorx parsing and diag * Get movfromrx encoding and most tokenization working * Get tokenizing mov from rx to work * wip: Allow pio assemble to work at runtime * Revert "wip: Allow pio assemble to work at runtime" We currently depend on this stuff being comptime, would have to manage the memory if we wanted to support it running at runtime This reverts commit dc3b857. * irq rel * Fix mov from idx * cleanup * fix * Some cleanup --------- Co-authored-by: Hayden Riddiford <hayden@terrakaffe.com>
- Loading branch information
1 parent
33e66ef
commit eccecc2
Showing
15 changed files
with
1,997 additions
and
1,498 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
pub const Chip = enum { | ||
RP2040, | ||
RP2350, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
port/raspberrypi/rp2xxx/src/hal/pio/assembler/comparison_tests/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
# PIO example programs for testing | ||
|
||
These were all taken from [the official pico examples repo](https://github.com/raspberrypi/pico-examples). | ||
These were all taken from [the official pico examples | ||
repo](https://github.com/raspberrypi/pico-examples). | ||
|
||
The headers are generated using `pioasm`. |
14 changes: 14 additions & 0 deletions
14
port/raspberrypi/rp2xxx/src/hal/pio/assembler/comparison_tests/irq.pio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.program irq | ||
.side_set 1 | ||
|
||
.wrap_target | ||
irq set 1 prev side 0 | ||
irq set 1 rel side 0 | ||
irq set 1 next side 0 | ||
irq wait 1 prev side 0 | ||
irq wait 1 rel side 0 | ||
irq wait 1 next side 0 | ||
irq clear 1 prev side 0 | ||
irq clear 1 rel side 0 | ||
irq clear 1 next side 0 | ||
.wrap |
14 changes: 14 additions & 0 deletions
14
port/raspberrypi/rp2xxx/src/hal/pio/assembler/comparison_tests/irq.pio.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#pragma once | ||
|
||
// TODO: Exercise more? delays, optional sideset, etc? | ||
static const uint16_t irq_program_instructions[] = { | ||
0xc009, // irq set 1 prev side 0 | ||
0xc011, // irq set 1 rel side 0 | ||
0xc019, // irq set 1 next side 0 | ||
0xc029, // irq wait 1 prev side 0 | ||
0xc031, // irq wait 1 rel side 0 | ||
0xc039, // irq wait 1 next side 0 | ||
0xc049, // irq clear 1 prev side 0 | ||
0xc051, // irq clear 1 rel side 0 | ||
0xc059, // irq clear 1 next side 0 | ||
}; |
15 changes: 15 additions & 0 deletions
15
port/raspberrypi/rp2xxx/src/hal/pio/assembler/comparison_tests/movrx.pio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.program movrx | ||
|
||
.wrap_target | ||
mov rxfifoy, isr | ||
mov rxfifo0, isr | ||
mov rxfifo1, isr | ||
mov rxfifo2, isr | ||
mov rxfifo3, isr | ||
|
||
mov osr, rxfifoy | ||
mov osr, rxfifo0 | ||
mov osr, rxfifo1 | ||
mov osr, rxfifo2 | ||
mov osr, rxfifo3 | ||
.wrap |
16 changes: 16 additions & 0 deletions
16
port/raspberrypi/rp2xxx/src/hal/pio/assembler/comparison_tests/movrx.pio.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#pragma once | ||
|
||
static const uint16_t movrx_program_instructions[] = { | ||
// 0b1000_ssss_0001_yiii | ||
0x8018, // mov rxfifoy, isr | ||
0x8010, // mov rxfifo0, isr | ||
0x8011, // mov rxfifo1, isr | ||
0x8012, // mov rxfifo2, isr | ||
0x8013, // mov rxfifo3, isr | ||
// 0b1000_ssss_1001_yiii | ||
0x8098, // mov osr, rxfifoy | ||
0x8090, // mov osr, rxfifo0 | ||
0x8091, // mov osr, rxfifo1 | ||
0x8092, // mov osr, rxfifo2 | ||
0x8093, // mov osr, rxfifo3 | ||
}; |
Oops, something went wrong.