From 19013ef8ca1e1990c7997b78777370c45c49c468 Mon Sep 17 00:00:00 2001 From: Jeff Piepmeier Date: Sun, 19 Nov 2023 17:06:35 -0500 Subject: [PATCH] clean up old DCD mux to get started --- pico/mac/CMakeLists.txt | 1 - pico/mac/commands.c | 32 +--------------------------- pico/mac/dcd_latch.pio | 46 ----------------------------------------- 3 files changed, 1 insertion(+), 78 deletions(-) delete mode 100644 pico/mac/dcd_latch.pio diff --git a/pico/mac/CMakeLists.txt b/pico/mac/CMakeLists.txt index e82d8a2f3..2def4b2ae 100644 --- a/pico/mac/CMakeLists.txt +++ b/pico/mac/CMakeLists.txt @@ -31,7 +31,6 @@ pico_generate_pio_header(commands ${CMAKE_CURRENT_LIST_DIR}/commands.pio) pico_generate_pio_header(commands ${CMAKE_CURRENT_LIST_DIR}/echo.pio) pico_generate_pio_header(commands ${CMAKE_CURRENT_LIST_DIR}/latch.pio) pico_generate_pio_header(commands ${CMAKE_CURRENT_LIST_DIR}/mux.pio) -pico_generate_pio_header(commands ${CMAKE_CURRENT_LIST_DIR}/dcd_latch.pio) pico_generate_pio_header(commands ${CMAKE_CURRENT_LIST_DIR}/dcd_commands.pio) pico_generate_pio_header(commands ${CMAKE_CURRENT_LIST_DIR}/dcd_mux.pio) pico_generate_pio_header(commands ${CMAKE_CURRENT_LIST_DIR}/dcd_read.pio) diff --git a/pico/mac/commands.c b/pico/mac/commands.c index 1ead5fa02..bb50419af 100644 --- a/pico/mac/commands.c +++ b/pico/mac/commands.c @@ -26,7 +26,6 @@ #include "latch.pio.h" #include "mux.pio.h" -// #include "dcd_latch.pio.h" #include "dcd_commands.pio.h" #include "dcd_mux.pio.h" #include "dcd_read.pio.h" @@ -69,7 +68,6 @@ void pio_echo(PIO pio, uint sm, uint offset, uint in_pin, uint out_pin, uint num void pio_latch(PIO pio, uint sm, uint offset, uint in_pin, uint out_pin); void pio_mux(PIO pio, uint sm, uint offset, uint in_pin, uint mux_pin); -// void pio_dcd_latch(PIO pio, uint sm, uint offset, uint in_pin, uint out_pin); void pio_dcd_commands(PIO pio, uint sm, uint offset, uint pin); void pio_dcd_mux(PIO pio, uint sm, uint offset, uint pin); void pio_dcd_read(PIO pio, uint sm, uint offset, uint pin); @@ -376,28 +374,6 @@ void setup() // printf("Loaded Floppy mux program at %d\n", pio_mux_offset); // pio_mux(pioblk_rw, SM_MUX, pio_mux_offset, MCI_CA0, ECHO_OUT); -#ifdef FLOPPY - set_tach_freq(0); // start TACH clock - preset_latch(); - - offset = pio_add_program(pio_floppy, &commands_program); - printf("\nLoaded cmd program at %d\n", offset); - pio_commands(pio_floppy, SM_FPY_CMD, offset, MCI_CA0); // read phases starting on pin 8 - - offset = pio_add_program(pio_floppy, &echo_program); - printf("Loaded echo program at %d\n", offset); - pio_echo(pio_floppy, SM_FPY_ECHO, offset, ECHO_IN, ECHO_OUT, 2); - - offset = pio_add_program(pio_floppy, &latch_program); - printf("Loaded latch program at %d\n", offset); - pio_latch(pio_floppy, SM_LATCH, offset, MCI_CA0, LATCH_OUT); - pio_sm_put_blocking(pio_floppy, SM_LATCH, get_latch()); // send the register word to the PIO - - offset = pio_add_program(pio_floppy, &mux_program); - printf("Loaded mux program at %d\n", offset); - pio_mux(pio_floppy, SM_MUX, offset, MCI_CA0, ECHO_OUT); - -#endif // FLOPPY } void dcd_loop(); @@ -414,7 +390,7 @@ enum disk_mode_t { int main() { setup(); - // switch_to_floppy(); + while (true) { esp_loop(); @@ -1250,12 +1226,6 @@ void pio_mux(PIO pio, uint sm, uint offset, uint in_pin, uint mux_pin) pio_sm_set_enabled(pio, sm, true); } -// void pio_dcd_latch(PIO pio, uint sm, uint offset, uint in_pin, uint out_pin) -// { -// latch_program_init(pio, sm, offset, in_pin, out_pin); -// pio_sm_set_enabled(pio, sm, true); -// } - void pio_dcd_commands(PIO pio, uint sm, uint offset, uint pin) { dcd_commands_program_init(pio, sm, offset, pin); diff --git a/pico/mac/dcd_latch.pio b/pico/mac/dcd_latch.pio deleted file mode 100644 index 28e16e54b..000000000 --- a/pico/mac/dcd_latch.pio +++ /dev/null @@ -1,46 +0,0 @@ -; -; FujiNet Project -; -; Vintage Macintosh Microfloppy Controller Interface -; Reads the drive phases and output a dcd_latch bit -; - -.define ENABLE 7 -.define LSTRB 12 - -.program dcd_latch -start: - wait 0 gpio ENABLE - mov osr, pins ; read the GPIO's into the output shift register - out y, 3 ; shift the 3 LSBs into Y - pull noblock ; get the dcd_latch word into OSR, if no new word in FIFO, get it from X - mov x, osr ; put the osr back into X in case it's new -.wrap_target - jmp y-- loop ; if y>0 goto to loop and decrement y - out pins, 1 ; output the desired bit - jmp start ; do it again -loop: - out null, 1 ; get rid of a bit -.wrap - - -% c-sdk { -// this is a raw helper function for use by the user which sets up the GPIO input and output, and configures the SM to output on a particular pin - -void dcd_latch_program_init(PIO pio, uint sm, uint offset, uint in_pin, uint out_pin) { - // configure a SM - pio_sm_config c = dcd_latch_program_get_default_config(offset); - // set the out pin to out_pin - sm_config_set_out_pins(&c, out_pin, 1); - // start at in_pin to read in the phases - sm_config_set_in_pins(&c, in_pin); - // get 8 bit dcd_latch values through the OSR from the main program - sm_config_set_out_shift(&c, true, false, 8); - // set out_pin as a GPIO output connected to this SM - pio_gpio_init(pio, out_pin); - pio_sm_set_consecutive_pindirs(pio, sm, out_pin, 1, true); // TODO change back - manually set output for now - // sm_config_set_set_pins(&c, pin, 1); - // initialize - pio_sm_init(pio, sm, offset, &c); -} -%} \ No newline at end of file