From bde43e07eee3036c799425d151cef35808db974c Mon Sep 17 00:00:00 2001 From: Jeff Piepmeier Date: Sun, 19 Nov 2023 17:37:34 -0500 Subject: [PATCH] some dma beginnings --- pico/mac/CMakeLists.txt | 2 +- pico/mac/commands.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pico/mac/CMakeLists.txt b/pico/mac/CMakeLists.txt index 2def4b2ae..1bc705b4c 100644 --- a/pico/mac/CMakeLists.txt +++ b/pico/mac/CMakeLists.txt @@ -40,7 +40,7 @@ pico_generate_pio_header(commands ${CMAKE_CURRENT_LIST_DIR}/dcd_write.pio) # target_sources(pio_and PRIVATE pio_and.c) -target_link_libraries(commands pico_stdlib hardware_pio) +target_link_libraries(commands pico_stdlib hardware_pio hardware_dma) # Add the standard include files to the build target_include_directories(commands PRIVATE diff --git a/pico/mac/commands.c b/pico/mac/commands.c index bb50419af..10b777511 100644 --- a/pico/mac/commands.c +++ b/pico/mac/commands.c @@ -15,6 +15,7 @@ #include "hardware/uart.h" #include "hardware/clocks.h" #include "hardware/claim.h" +#include "hardware/dma.h" #include "hardware/pio.h" #include "hardware/pio_instructions.h" @@ -182,6 +183,17 @@ uint8_t dcd_latch; inline uint16_t get_latch() { return latch; } inline uint16_t dcd_get_latch() { return ((dcd_latch << 8) + dcd_latch); } +// need the following: +// put_dcd_latch() {this tells the DMA to push the DCD latch into the latch PIO tx fifo} +// put_floppy_latch() {this tells the DMA to push the FLOPPY latch into the latch PIO tx fifo} +// create DMA channel that copies 1 16-bit value from latch or dcd_latch to the PIO TX FIFO + +void setup_latch_dma() +{ + +} + + void set_latch(enum latch_bits s) { latch |= (1u << s); } void dcd_set_latch(uint8_t s) { dcd_latch |= (1u << s); }