Skip to content

Commit d798fec

Browse files
committed
[fw-isoldr] Added new parameter for GPIO usage.
Also minor fixes for SD card.
1 parent 4d0eb76 commit d798fec

File tree

4 files changed

+28
-18
lines changed

4 files changed

+28
-18
lines changed

firmware/isoldr/loader/syscalls.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <arch/cache.h>
1616
#include <arch/timer.h>
1717
#include <arch/gdb.h>
18+
#include <arch/irq.h>
1819

1920
#ifdef DEV_TYPE_SD
2021
#include <sd/spi.h>
@@ -706,7 +707,7 @@ static int init_cmd() {
706707
# ifdef HAVE_GDB
707708

708709
gdb_init();
709-
710+
710711
} else {
711712

712713
int old = irq_disable();
@@ -870,7 +871,7 @@ void gdcMainLoop(void) {
870871
}
871872
#endif
872873

873-
if(gpio_read_pin(GPIO_PIN_RESET_BUTTON) == 0) {
874+
if(IsoInfo->use_gpio && gpio_read_pin(GPIO_PIN_RESET_BUTTON) == 0) {
874875
menu_exit();
875876
}
876877

@@ -1057,7 +1058,7 @@ int gdcGetDrvStat(uint32 *status) {
10571058
}
10581059
#endif
10591060

1060-
if(gpio_read_pin(GPIO_PIN_RESET_BUTTON) == 0) {
1061+
if(IsoInfo->use_gpio && gpio_read_pin(GPIO_PIN_RESET_BUTTON) == 0) {
10611062
menu_exit();
10621063
}
10631064

@@ -1150,8 +1151,9 @@ void gdcInitSystem(void) {
11501151
}
11511152
#endif
11521153

1153-
gpio_set_as_input(GPIO_PIN_RESET_BUTTON);
1154-
1154+
if(IsoInfo->use_gpio) {
1155+
gpio_set_as_input(GPIO_PIN_RESET_BUTTON);
1156+
}
11551157
reset_GDS(GDS);
11561158
gdcMainLoop();
11571159
}
@@ -1247,7 +1249,7 @@ int gdcReqDmaTrans(int gd_chn, int *dmabuf) {
12471249
GDS->requested -= dmabuf[1];
12481250

12491251
if(fs_dma_enabled() == FS_DMA_STREAM) {
1250-
#ifdef _FS_ASYNC
1252+
#if defined(_FS_ASYNC) && !defined(DEV_TYPE_SD)
12511253
if(read_async(iso_fd, (uint8 *)dmabuf[0], dmabuf[1], data_transfer_cb) < 0) {
12521254
return -1;
12531255
}
@@ -1279,21 +1281,20 @@ int gdcCheckDmaTrans(int gd_chn, int *size) {
12791281
LOGF("ERROR: %d != %d\n", gd_chn, GDS->req_count);
12801282
return -1;
12811283
}
1282-
12831284
if(GDS->status != CMD_STAT_STREAMING) {
12841285
LOGF("ERROR: status = %s\n", stat_name[GDS->status + 1]);
12851286
return -1;
12861287
}
1287-
#ifdef _FS_ASYNC
1288+
#if defined(_FS_ASYNC) && !defined(DEV_TYPE_SD)
12881289
if(fs_dma_enabled() == FS_DMA_STREAM) {
12891290
do {} while(poll(iso_fd) > 1);
12901291
}
1291-
#endif
12921292
if(pre_read_xfer_busy()) {
12931293
*size = pre_read_xfer_size();
12941294
LOGFF("%d busy s=%ld\n", gd_chn, pre_read_xfer_size());
12951295
return 1;
12961296
}
1297+
#endif
12971298
*size = GDS->requested;
12981299
LOGFF("%d done s=%d r=%ld\n", gd_chn, pre_read_xfer_size(), GDS->requested);
12991300
return 0;

include/isoldr.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* \file isoldr.h
33
* \brief DreamShell ISO loader
4-
* \date 2009-2024
4+
* \date 2009-2025
55
* \author SWAT www.dc-swat.ru
66
*/
77

@@ -171,8 +171,9 @@ typedef struct isoldr_info {
171171
uint32 scr_hotkey; /* Creating screenshots by hotkey (zero for disabled). */
172172
uint32 bleem; /* Memory address for Bleem! binary or 1 for auto load. */
173173
uint32 alt_read; /* Use alternative reading without aborting. */
174+
uint32 use_gpio; /* Use GPIO-0 as button for IGR. */
174175

175-
uint32 cdda_offset[43]; /* CDDA tracks offset, only for CDI images */
176+
uint32 cdda_offset[42]; /* CDDA tracks offset, only for CDI images */
176177

177178
} isoldr_info_t;
178179

modules/isoldr/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#
22
# ISO Loader module for DreamShell
3-
# Copyright (C) 2009-2024 SWAT
3+
# Copyright (C) 2009-2025 SWAT
44
#
55

66
TARGET_NAME = isoldr
@@ -10,7 +10,7 @@ EXPORTS_FILE = exports.txt
1010

1111
VER_MAJOR = 0
1212
VER_MINOR = 8
13-
VER_MICRO = 1
13+
VER_MICRO = 4
1414

1515
all: rm-elf
1616

modules/isoldr/module.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,7 @@ int builtin_isoldr_cmd(int argc, char *argv[]) {
639639
uint32 bin_type = BIN_TYPE_AUTO, fast_boot = 0, verbose = 0;
640640
uint32 cdda_mode = CDDA_MODE_DISABLED, use_irq = 0, emu_vmu = 0;
641641
uint32 low_level = 0, scr_hotkey = 0, bleem = 0, alt_read = 0;
642+
uint32 use_gpio = 0;
642643
int fspart = -1;
643644
isoldr_info_t *info;
644645

@@ -665,6 +666,7 @@ int builtin_isoldr_cmd(int argc, char *argv[]) {
665666
{"scrhotkey", 'k', NULL, CFG_ULONG, (void *) &scr_hotkey, 0},
666667
{"bleem", 'u', NULL, CFG_ULONG, (void *) &bleem, 0},
667668
{"altread", 'y', NULL, CFG_BOOL, (void *) &alt_read, 0},
669+
{"gpio", '\0', NULL, CFG_BOOL, (void *) &use_gpio, 0},
668670
{"pa1", '\0', NULL, CFG_ULONG, (void *) &p_addr[0], 0},
669671
{"pa2", '\0', NULL, CFG_ULONG, (void *) &p_addr[1], 0},
670672
{"pv1", '\0', NULL, CFG_ULONG, (void *) &p_value[0], 0},
@@ -737,6 +739,7 @@ int builtin_isoldr_cmd(int argc, char *argv[]) {
737739
info->scr_hotkey = scr_hotkey;
738740
info->bleem = bleem;
739741
info->alt_read = alt_read;
742+
info->use_gpio = use_gpio;
740743

741744
if (cdda_mode > CDDA_MODE_DISABLED) {
742745
info->emu_cdda = cdda_mode;
@@ -789,24 +792,29 @@ int builtin_isoldr_cmd(int argc, char *argv[]) {
789792
"Address: 0x%08lx\n"
790793
"DMA: %d\n"
791794
"IRQ: %d\n"
792-
"Heap: %lx\n",
795+
"Heap: 0x%08lx\n",
796+
"Bypass pre-read: %d\n",
793797
info->fs_dev,
794798
info->fs_dev[0] != '\0' ? info->fs_type : "normal",
795799
info->fs_part,
796800
lex,
797801
info->use_dma,
798802
info->use_irq,
799-
info->heap);
803+
info->heap,
804+
info->alt_read);
805+
800806
ds_printf("Emu async: %d\n"
801807
"Emu CDDA: 0x%08lx\n"
802808
"Emu VMU: %d\n"
803-
"Syscalls: %lx\n",
804-
"Bleem: %lx\n\n",
809+
"Syscalls: 0x%08lx\n",
810+
"Bleem: 0x%08lx\n",
811+
"GPIO: %d\n\n",
805812
info->emu_async,
806813
info->emu_cdda,
807814
info->emu_vmu,
808815
info->syscalls,
809-
info->bleem);
816+
info->bleem,
817+
info->use_gpio);
810818
}
811819

812820
isoldr_exec(info, lex);

0 commit comments

Comments
 (0)