Skip to content

Commit

Permalink
Prep for XIP PSRAM support
Browse files Browse the repository at this point in the history
  • Loading branch information
polpo committed Aug 22, 2024
1 parent 049a624 commit 974315b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 19 deletions.
35 changes: 18 additions & 17 deletions sw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ set(PICO_COPY_TO_RAM 1)

# Tell the Pico SDK to use our local tinyusb instead of the one included in the SDK
# This is needed to support tusb_xinput
set(PICO_TINYUSB_PATH ${CMAKE_CURRENT_LIST_DIR}/tinyusb)
# set(PICO_TINYUSB_PATH ${CMAKE_CURRENT_LIST_DIR}/tinyusb)

#set(PICO_DEOPTIMIZED_DEBUG "1")
#set(CMAKE_BUILD_TYPE "Debug")
Expand Down Expand Up @@ -173,15 +173,15 @@ function(config_target TARGET_NAME MULTIFW)
pico_enable_stdio_semihosting(${TARGET_NAME} 0)
endfunction()

add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/tusb_xinput)
add_subdirectory(rp2040-psram)
# add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/tusb_xinput)
# add_subdirectory(rp2040-psram)
add_subdirectory(opl)


################################################################################
# Build GUS firmware
function(build_gus TARGET_NAME MULTIFW)
set(USB_JOYSTICK TRUE)
# set(USB_JOYSTICK TRUE)
set(SOUND_MPU TRUE)
config_target(${TARGET_NAME} ${MULTIFW})
pico_set_program_name(${TARGET_NAME} "picogus-gus")
Expand All @@ -191,26 +191,27 @@ function(build_gus TARGET_NAME MULTIFW)
)
target_compile_definitions(${TARGET_NAME} PRIVATE
SOUND_GUS=1
PSRAM=1
TEST_PSRAM=1
PSRAM_ASYNC=1
#PSRAM_ASYNC_DMA_IRQ=1
PSRAM_SPINLOCK=1
# PSRAM_MUTEX=1
# PSRAM_WAITDMA=1
PSRAM_CORE0=1
PSRAM_PIN_CS=1
PSRAM_PIN_SCK=2
PSRAM_PIN_MOSI=3
PSRAM_PIN_MISO=0
# PSRAM=1
# TEST_PSRAM=1
# PSRAM_ASYNC=1
# #PSRAM_ASYNC_DMA_IRQ=1
# PSRAM_SPINLOCK=1
# # PSRAM_MUTEX=1
# # PSRAM_WAITDMA=1
# PSRAM_CORE0=1
# PSRAM_PIN_CS=1
# PSRAM_PIN_SCK=2
# PSRAM_PIN_MOSI=3
# PSRAM_PIN_MISO=0
PSRAM_RP2350=1
# POLLING_DMA=1
INTERP_CLAMP=1
# INTERP_LINEAR=1
SCALE_22K_TO_44K=1
# FORCE_28CH_27CH=1
)
pico_generate_pio_header(${TARGET_NAME} ${CMAKE_CURRENT_LIST_DIR}/isa_dma.pio)
target_link_libraries(${TARGET_NAME} rp2040-psram hardware_interp)
target_link_libraries(${TARGET_NAME} hardware_interp)
endfunction()

################################################################################
Expand Down
1 change: 1 addition & 0 deletions sw/flash_settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "flash_settings.h"
#include "hardware/flash.h"
#include "hardware/sync.h"
#include "hardware/clocks.h"
#include "pico/stdlib.h"
#include "pico/flash.h"

Expand Down
2 changes: 1 addition & 1 deletion sw/pico_pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void PIC_RemoveEvents(PIC_EventHandler handler) {
void PIC_Init() {
#ifdef USE_ALARM
alarm_pool = alarm_pool_create(2, PICO_TIME_DEFAULT_ALARM_POOL_MAX_TIMERS);
irq_set_priority(TIMER0_IRQ_2, PICO_HIGHEST_IRQ_PRIORITY);
irq_set_priority(TIMER_IRQ_2, PICO_HIGHEST_IRQ_PRIORITY);
for (int i = 0; i < PIC_MAX_TIMERS; ++i) {
timerEvents[i].alarm_id = 0;
timerEvents[i].handler = 0;
Expand Down
1 change: 1 addition & 0 deletions sw/pico_reflash.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <stdio.h>
#include <hardware/flash.h>
#include "hardware/clocks.h"
#include "pico/multicore.h"
#include "pico/stdlib.h"

Expand Down
2 changes: 1 addition & 1 deletion sw/picogus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ int main()

// Load settings from flash
loadSettings(&settings);
hw_clear_bits(&xip_ctrl_hw->ctrl, XIP_CTRL_EN_BITS);
/CYW43_PIO_CLOCK_DIV_INT* hw_clear_bits(&xip_ctrl_hw->ctrl, XIP_CTRL_EN_BITS); */

// Determine board type. GPIO 29 is grounded on PicoGUS v2.0, and on a Pico, it's VSYS/3 (~1.666V)
// GPIO 25 must be high to read GPIO 29 on the Pico W
Expand Down

0 comments on commit 974315b

Please sign in to comment.