Skip to content

Commit

Permalink
Update to use new DMA PIO
Browse files Browse the repository at this point in the history
  • Loading branch information
polpo committed Jan 16, 2024
1 parent 6f16912 commit 80ffb93
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
3 changes: 1 addition & 2 deletions sw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ project(picogus
)

set(PICO_BOARD_HEADER_DIRS ${CMAKE_CURRENT_LIST_DIR})
set(PICO_BOARD pico_w)
set(PROJECT_TYPE "OPL")
set(PICO_BOARD picogus2)



Expand Down
9 changes: 5 additions & 4 deletions sw/picogus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ __force_inline void handle_iow(void) {
// printf("IOW: %x %x\n", port, iow_read & 0xFF);
#ifdef SOUND_DSP
if( port >= DSP_basePort && port <= (DSP_basePort+0xF)) {
pio_sm_put(pio0, iow_sm, IO_WAIT);
pio_sm_put(pio0, IOW_PIO_SM, IO_WAIT);
sbdsp_process();
sbdsp_write(port & 0xF,iow_read & 0xFF);
sbdsp_process();
Expand Down Expand Up @@ -459,10 +459,11 @@ __force_inline void handle_ior(void) {
uint16_t port = pio_sm_get(pio0, IOR_PIO_SM) & 0x3FF;
//
#ifdef SOUND_DSP
if( port >= DSP_basePort && port <= (DSP_basePort+0xF)) {
pio_sm_put(pio0, ior_sm, IO_WAIT);
// if( port >= DSP_basePort && port <= (DSP_basePort+0xF)) {
if ((port >> 4) == (DSP_basePort >> 4)) {
pio_sm_put(pio0, IOR_PIO_SM, IO_WAIT);
sbdsp_process();
pio_sm_put(pio0, ior_sm, IOR_SET_VALUE | sbdsp_read(port & 0xF));
pio_sm_put(pio0, IOR_PIO_SM, IOR_SET_VALUE | sbdsp_read(port & 0xF));
sbdsp_process();
} else
#endif
Expand Down
5 changes: 3 additions & 2 deletions sw/sbplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ extern "C" void OPL_Pico_Mix_callback(audio_buffer_t *);

irq_handler_t SBDSP_DMA_isr_pt;
dma_inst_t dma_config;
#define DMA_PIO_SM 2

#define DSP_VERSION_MAJOR 2
#define DSP_VERSION_MINOR 1
Expand Down Expand Up @@ -264,7 +265,7 @@ void sbdsp_init() {

puts("Initing ISA DMA PIO...");
SBDSP_DMA_isr_pt = sbdsp_dma_isr;
dma_config = DMA_init(pio0, SBDSP_DMA_isr_pt);
dma_config = DMA_init(pio0, DMA_PIO_SM, SBDSP_DMA_isr_pt);

opl_buffer = (audio_buffer_t *) malloc(sizeof(audio_buffer_t));
opl_buffer->buffer = (mem_buffer_t *) malloc(sizeof(mem_buffer_t));
Expand Down Expand Up @@ -534,4 +535,4 @@ void sbdsp_write(uint8_t address, uint8_t value) {
//printf("SB WRITE: %x => %x \n\r",value,address);
break;
}
}
}

0 comments on commit 80ffb93

Please sign in to comment.