mirror of
https://github.com/polpo/picogus.git
synced 2026-10-25 21:40:16 +00:00
Drop flash_safe_execute_core_init as it interferes with cyw43
This commit is contained in:
1 parent
ca91483f53
commit
fe8e96800b
10 files changed
+16
-55
No files matched your search
+1
-2
@@ -29,7 +29,6 @@
|
||||
|
||||
#include "pico/stdlib.h"
|
||||
#include "pico/audio_i2s.h"
|
||||
#include "pico/flash.h"
|
||||
|
||||
#ifdef USB_STACK
|
||||
#include "tusb.h"
|
||||
@@ -104,7 +103,7 @@ struct audio_buffer_pool *init_audio() {
|
||||
|
||||
void play_cms() {
|
||||
puts("starting core 1 CMS");
|
||||
flash_safe_execute_core_init();
|
||||
// flash_safe_execute_core_init();
|
||||
|
||||
#if defined(USB_MOUSE) || defined(SOUND_MPU)
|
||||
// Init PIC on this core so it handles timers
|
||||
|
||||
+2
-19
@@ -24,7 +24,6 @@
|
||||
#include "hardware/sync.h"
|
||||
#include "hardware/clocks.h"
|
||||
#include "pico/stdlib.h"
|
||||
#include "pico/flash.h"
|
||||
|
||||
static const Settings defaultSettings = {
|
||||
.magic = SETTINGS_MAGIC,
|
||||
@@ -92,30 +91,14 @@ void loadSettings(Settings* settings)
|
||||
}
|
||||
|
||||
|
||||
static void saveSettingsSafe(void* data)
|
||||
{
|
||||
putchar('-');
|
||||
// Clock down the RP2040 so the flash at its default 1/2 clock divider is within spec (<=133MHz)
|
||||
set_sys_clock_khz(240000, true);
|
||||
flash_range_erase(SETTINGS_SECTOR, FLASH_SECTOR_SIZE); // last sector
|
||||
putchar('-');
|
||||
flash_range_program(SETTINGS_SECTOR, data, FLASH_PAGE_SIZE);
|
||||
set_sys_clock_khz(RP2_CLOCK_SPEED, true);
|
||||
printf("settings saved");
|
||||
}
|
||||
|
||||
void saveSettings(const Settings* settings)
|
||||
{
|
||||
uint8_t data[FLASH_PAGE_SIZE] = {0};
|
||||
static_assert(sizeof(Settings) < FLASH_PAGE_SIZE, "Settings struct doesn't fit inside one flash page");
|
||||
memcpy(data, settings, sizeof(Settings));
|
||||
printf("doing settings save: ");
|
||||
/* int result = flash_safe_execute(saveSettingsSafe, data, 100); */
|
||||
/* if (result) { */
|
||||
/* printf("uh oh... %d", result); */
|
||||
/* } */
|
||||
// Stop second core
|
||||
/* multicore_reset_core1(); */
|
||||
// No need for flash_safe_execute or stop second core, since it will not touch flash
|
||||
// If the 2nd core will ever touch flash, reconsider this approach!
|
||||
// Clock down the RP2040 so the flash at its default 1/2 clock divider is within spec (<=133MHz)
|
||||
set_sys_clock_khz(240000, true);
|
||||
|
||||
|
||||
+1
-2
@@ -27,7 +27,6 @@
|
||||
|
||||
#include "pico/stdlib.h"
|
||||
#include "pico/audio_i2s.h"
|
||||
#include "pico/flash.h"
|
||||
|
||||
#include "pico_pic.h"
|
||||
|
||||
@@ -99,7 +98,7 @@ struct audio_buffer_pool *init_audio() {
|
||||
// void __xip_cache("my_sub_section") (play_gus)(void) {
|
||||
void play_gus() {
|
||||
puts("starting core 1");
|
||||
flash_safe_execute_core_init();
|
||||
// flash_safe_execute_core_init();
|
||||
uint32_t start, end;
|
||||
|
||||
// Init PIC on this core so it handles timers
|
||||
|
||||
+1
-3
@@ -21,8 +21,6 @@
|
||||
#include "flash_settings.h"
|
||||
extern Settings settings;
|
||||
|
||||
#include "pico/flash.h"
|
||||
|
||||
#include "pico_pic.h"
|
||||
|
||||
#ifdef USB_STACK
|
||||
@@ -33,7 +31,7 @@ extern Settings settings;
|
||||
|
||||
void play_mpu() {
|
||||
puts("starting core 1 MPU");
|
||||
flash_safe_execute_core_init();
|
||||
// flash_safe_execute_core_init();
|
||||
|
||||
#ifdef USB_STACK
|
||||
// Init TinyUSB for joystick support
|
||||
|
||||
@@ -18,12 +18,3 @@ target_sources(ne2000 INTERFACE
|
||||
target_link_libraries(ne2000 INTERFACE
|
||||
pico_cyw43_arch_none
|
||||
)
|
||||
|
||||
if(PROJECT_TYPE STREQUAL "NE2K")
|
||||
target_compile_definitions(pico_cyw43_arch_none_headers INTERFACE
|
||||
PICO_CYW43_ARCH_THREADSAFE_BACKGROUND=1
|
||||
)
|
||||
target_compile_definitions(ne2000 INTERFACE
|
||||
PICO_CYW43_ARCH_THREADSAFE_BACKGROUND=1
|
||||
)
|
||||
endif()
|
||||
+8
-1
@@ -158,8 +158,15 @@ void PG_Wifi_Connect(const char* ssid, const char* pass) {
|
||||
|
||||
void PG_Wifi_Reconnect(void)
|
||||
{
|
||||
int32_t rssi;
|
||||
cyw43_ioctl(&cyw43_state, CYW43_IOCTL_GET_RSSI, sizeof(rssi), (uint8_t*)&rssi, CYW43_ITF_STA);
|
||||
printf("rssi %d ", rssi);
|
||||
if (rssi == 0) {
|
||||
PG_Wifi_Connect(NULL, NULL);
|
||||
return;
|
||||
}
|
||||
int16_t status = cyw43_wifi_link_status(&cyw43_state, CYW43_ITF_STA);
|
||||
//printf("status: %d\n", status);
|
||||
printf("status: %d\n", status);
|
||||
switch(status)
|
||||
{
|
||||
case CYW43_LINK_JOIN :
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include "hardware/structs/clocks.h"
|
||||
#include "hardware/timer.h"
|
||||
#include "pico/multicore.h"
|
||||
#include "pico/flash.h"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -46,17 +45,7 @@ extern Settings settings;
|
||||
extern uint LED_PIN;
|
||||
|
||||
|
||||
static uint32_t Wifi_Reconnect_EventHandler(Bitu val) {
|
||||
putchar('=');
|
||||
PG_Wifi_Reconnect();
|
||||
return 1000;
|
||||
}
|
||||
static PIC_TimerEvent Wifi_Reconnect_Event = {
|
||||
.handler = Wifi_Reconnect_EventHandler
|
||||
};
|
||||
|
||||
void play_ne2000() {
|
||||
// flash_safe_execute_core_init();
|
||||
// Init PIC on this core so it handles timers
|
||||
PIC_Init();
|
||||
|
||||
@@ -66,7 +55,6 @@ void play_ne2000() {
|
||||
|
||||
static bool flag = false;
|
||||
while(1) {
|
||||
PIC_AddEvent(&Wifi_Reconnect_Event, 1000, 0);
|
||||
if (multicore_fifo_rvalid()) {
|
||||
switch(multicore_fifo_pop_blocking()) {
|
||||
case FIFO_NE2K_SEND:
|
||||
@@ -79,7 +67,6 @@ void play_ne2000() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
//cyw43_arch_poll();
|
||||
if (((time_us_32() >> 21) & 0x1) == 0x1) {
|
||||
if (flag == false) {
|
||||
putchar('=');
|
||||
|
||||
+1
-2
@@ -28,7 +28,6 @@
|
||||
|
||||
#include "pico/stdlib.h"
|
||||
#include "pico/audio_i2s.h"
|
||||
#include "pico/flash.h"
|
||||
|
||||
#include "opl.h"
|
||||
extern "C" void OPL_Pico_simple(int16_t *buffer, uint32_t nsamples);
|
||||
@@ -114,7 +113,7 @@ struct audio_buffer_pool *init_audio() {
|
||||
|
||||
void play_adlib() {
|
||||
puts("starting core 1");
|
||||
flash_safe_execute_core_init();
|
||||
// flash_safe_execute_core_init();
|
||||
uint32_t start, end;
|
||||
|
||||
#if defined(SOUND_SB) || defined(USB_MOUSE) || defined(SOUND_MPU)
|
||||
|
||||
+1
-2
@@ -28,7 +28,6 @@
|
||||
|
||||
#include "pico/stdlib.h"
|
||||
#include "pico/audio_i2s.h"
|
||||
#include "pico/flash.h"
|
||||
|
||||
#include "square/square.h"
|
||||
|
||||
@@ -101,7 +100,7 @@ struct audio_buffer_pool *init_audio() {
|
||||
|
||||
void play_tandy() {
|
||||
puts("starting core 1 tandy");
|
||||
flash_safe_execute_core_init();
|
||||
// flash_safe_execute_core_init();
|
||||
|
||||
#if defined(USB_MOUSE) || defined(SOUND_MPU)
|
||||
// Init PIC on this core so it handles timers
|
||||
|
||||
+1
-2
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "pico/flash.h"
|
||||
|
||||
#include "tusb.h"
|
||||
#include "mouse/8250uart.h"
|
||||
@@ -29,7 +28,7 @@
|
||||
|
||||
void play_usb() {
|
||||
puts("starting core 1 USB");
|
||||
flash_safe_execute_core_init();
|
||||
// flash_safe_execute_core_init();
|
||||
|
||||
// board_init();
|
||||
|
||||
|
||||
Reference in new issue
Block a user