You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(35) |
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(37) |
Feb
(10) |
Mar
|
Apr
(2) |
May
(17) |
Jun
(1) |
Jul
(14) |
Aug
(14) |
Sep
(4) |
Oct
|
Nov
(14) |
Dec
(4) |
2005 |
Jan
(6) |
Feb
|
Mar
|
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
(92) |
Dec
(12) |
2006 |
Jan
(3) |
Feb
(4) |
Mar
|
Apr
(5) |
May
(3) |
Jun
(15) |
Jul
(3) |
Aug
(1) |
Sep
(29) |
Oct
(1) |
Nov
(6) |
Dec
(5) |
2007 |
Jan
(2) |
Feb
(2) |
Mar
|
Apr
(3) |
May
(14) |
Jun
(2) |
Jul
(16) |
Aug
(73) |
Sep
(12) |
Oct
(9) |
Nov
(27) |
Dec
(3) |
2008 |
Jan
(4) |
Feb
(4) |
Mar
(3) |
Apr
(8) |
May
(23) |
Jun
(4) |
Jul
(1) |
Aug
(3) |
Sep
(7) |
Oct
(5) |
Nov
(1) |
Dec
(1) |
2009 |
Jan
|
Feb
(10) |
Mar
|
Apr
(4) |
May
(4) |
Jun
(10) |
Jul
|
Aug
(1) |
Sep
|
Oct
(7) |
Nov
|
Dec
(1) |
2010 |
Jan
|
Feb
(1) |
Mar
|
Apr
(6) |
May
|
Jun
(3) |
Jul
(11) |
Aug
(1) |
Sep
|
Oct
(15) |
Nov
(1) |
Dec
(5) |
2011 |
Jan
(4) |
Feb
(1) |
Mar
(6) |
Apr
|
May
(22) |
Jun
|
Jul
(8) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2012 |
Jan
|
Feb
(10) |
Mar
(1) |
Apr
(6) |
May
(27) |
Jun
(48) |
Jul
(30) |
Aug
(4) |
Sep
|
Oct
(3) |
Nov
(1) |
Dec
(11) |
2013 |
Jan
(4) |
Feb
(7) |
Mar
(6) |
Apr
(18) |
May
(28) |
Jun
(20) |
Jul
|
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
(2) |
Dec
(7) |
2014 |
Jan
(3) |
Feb
(2) |
Mar
(4) |
Apr
(9) |
May
(11) |
Jun
(10) |
Jul
|
Aug
(18) |
Sep
(12) |
Oct
(17) |
Nov
(10) |
Dec
(16) |
2015 |
Jan
(5) |
Feb
(1) |
Mar
(5) |
Apr
(4) |
May
(28) |
Jun
(2) |
Jul
|
Aug
|
Sep
(6) |
Oct
|
Nov
(2) |
Dec
(1) |
2016 |
Jan
(14) |
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
(3) |
Jul
(4) |
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
(1) |
2017 |
Jan
(11) |
Feb
|
Mar
(21) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(2) |
Sep
(4) |
Oct
(4) |
Nov
|
Dec
(1) |
2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(13) |
Sep
(4) |
Oct
|
Nov
|
Dec
|
2020 |
Jan
(10) |
Feb
(9) |
Mar
(5) |
Apr
(4) |
May
(3) |
Jun
(18) |
Jul
(4) |
Aug
(2) |
Sep
(20) |
Oct
(2) |
Nov
|
Dec
|
2021 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2022 |
Jan
(1) |
Feb
(2) |
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
|
Oct
(1) |
Nov
|
Dec
(1) |
2023 |
Jan
(10) |
Feb
(7) |
Mar
(29) |
Apr
(31) |
May
(29) |
Jun
(34) |
Jul
(3) |
Aug
(24) |
Sep
(22) |
Oct
(10) |
Nov
(38) |
Dec
(27) |
2024 |
Jan
(15) |
Feb
(8) |
Mar
(4) |
Apr
(20) |
May
(33) |
Jun
(18) |
Jul
(15) |
Aug
(23) |
Sep
(26) |
Oct
(32) |
Nov
(6) |
Dec
(4) |
2025 |
Jan
(7) |
Feb
(1) |
Mar
(1) |
Apr
(4) |
May
(46) |
Jun
(19) |
Jul
(20) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: kosmirror <kos...@us...> - 2025-05-22 13:57:40
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via f4657b17a449c13502114404a53835c38de5c3a5 (commit) from 4d8a1165d929359cca0a6c91f9538cf0e71064f8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f4657b17a449c13502114404a53835c38de5c3a5 Author: darc <da...@pr...> Date: Wed May 21 14:29:00 2025 -0500 Add additional check for m4-single ABI support to fix DreamSDK issues ----------------------------------------------------------------------- Summary of changes: environ_dreamcast.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/environ_dreamcast.sh b/environ_dreamcast.sh index ced09d2f..cacecaa4 100644 --- a/environ_dreamcast.sh +++ b/environ_dreamcast.sh @@ -14,10 +14,12 @@ fi # Default the SH4 floating-point precision if it isn't already set. # m4-single is used if supported by the current toolchain, otherwise # m4-single-only is used as a fallback option. -if [ -z "${KOS_SH4_PRECISION}" ] ; then +if [ -z "${KOS_SH4_PRECISION}" ] || [ "${KOS_SH4_PRECISION}" = "-m4-single" ]; then if echo 'int main(){}' | ${KOS_CC} -x c -c -o /dev/null - -m4-single 2>/dev/null; then export KOS_SH4_PRECISION="-m4-single" else + echo "WARNING: Toolchain does not support m4-single ABI -- falling back to m4-single-only ABI." >&2 + echo "Please recompile the toolchain to enable support for the m4-single ABI." >&2 export KOS_SH4_PRECISION="-m4-single-only" fi fi hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-05-22 13:53:00
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 4d8a1165d929359cca0a6c91f9538cf0e71064f8 (commit) via 67032d5dd373b4614a16bf82814e7be11aa64240 (commit) from 79f8d37af06e725cfe5927936240a36b87cba274 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4d8a1165d929359cca0a6c91f9538cf0e71064f8 Author: kapodamy <168...@us...> Date: Mon May 5 19:28:21 2025 -0300 Fix build warnings in netcfg, snd_sfxmgr, vqenc * update netcfg.c: add type cast. * update snd_sfxmgr.c: change type int to uint32_t. * update vqenc.c: use "PRIxPTR" print formatter. commit 67032d5dd373b4614a16bf82814e7be11aa64240 Author: kapodamy <168...@us...> Date: Sat Apr 19 21:54:47 2025 -0300 Update irq.h and g2bus.h files change param type of __irq_scoped_cleanup() function change g2_ctx irq_state field type (again) ----------------------------------------------------------------------- Summary of changes: addons/libkosutils/netcfg.c | 2 +- kernel/arch/dreamcast/include/arch/irq.h | 4 ++-- kernel/arch/dreamcast/include/dc/g2bus.h | 2 +- kernel/arch/dreamcast/sound/snd_sfxmgr.c | 4 ++-- utils/vqenc/vqenc.c | 3 ++- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/addons/libkosutils/netcfg.c b/addons/libkosutils/netcfg.c index 39a78613..3d5cd963 100644 --- a/addons/libkosutils/netcfg.c +++ b/addons/libkosutils/netcfg.c @@ -44,7 +44,7 @@ void netcfg_vmuify(const char *filename_in, const char *filename_out) { pkg.icon_cnt = 1; pkg.icon_anim_speed = 1; memcpy(&pkg.icon_pal[0], netcfg_icon, 32); - pkg.icon_data = netcfg_icon + 32; + pkg.icon_data = (uint8_t *)(netcfg_icon + 32); pkg.eyecatch_type = VMUPKG_EC_NONE; pkg.data_len = fs_total(fd); pkg.data = buf; diff --git a/kernel/arch/dreamcast/include/arch/irq.h b/kernel/arch/dreamcast/include/arch/irq.h index fc5c53e8..3fcb4752 100644 --- a/kernel/arch/dreamcast/include/arch/irq.h +++ b/kernel/arch/dreamcast/include/arch/irq.h @@ -510,12 +510,12 @@ int irq_init(void); */ void irq_shutdown(void); -static inline void __irq_scoped_cleanup(int *state) { +static inline void __irq_scoped_cleanup(irq_mask_t *state) { irq_restore(*state); } #define ___irq_disable_scoped(l) \ - int __scoped_irq_##l __attribute__((cleanup(__irq_scoped_cleanup))) = irq_disable() + irq_mask_t __scoped_irq_##l __attribute__((cleanup(__irq_scoped_cleanup))) = irq_disable() #define __irq_disable_scoped(l) ___irq_disable_scoped(l) /** \endcond */ diff --git a/kernel/arch/dreamcast/include/dc/g2bus.h b/kernel/arch/dreamcast/include/dc/g2bus.h index 8b449aab..248b5a1c 100644 --- a/kernel/arch/dreamcast/include/dc/g2bus.h +++ b/kernel/arch/dreamcast/include/dc/g2bus.h @@ -140,7 +140,7 @@ void g2_dma_shutdown(void); is used in with g2_lock() and g2_unlock(). */ typedef struct { - int irq_state; /** \brief IRQ state when entering a G2 critical block */ + irq_mask_t irq_state; /** \brief IRQ state when entering a G2 critical block */ } g2_ctx_t; /* Internal constants to access suspend registers for G2 DMA. They are not meant for diff --git a/kernel/arch/dreamcast/sound/snd_sfxmgr.c b/kernel/arch/dreamcast/sound/snd_sfxmgr.c index 31f974a9..6fa406d2 100644 --- a/kernel/arch/dreamcast/sound/snd_sfxmgr.c +++ b/kernel/arch/dreamcast/sound/snd_sfxmgr.c @@ -771,7 +771,7 @@ int snd_sfx_play_ex(sfx_play_data_t *data) { } } - int size; + uint32_t size; snd_effect_t *t = (snd_effect_t *)data->idx; AICA_CMDSTR_CHANNEL(tmp, cmd, chan); @@ -790,7 +790,7 @@ int snd_sfx_play_ex(sfx_play_data_t *data) { chan->loop = data->loop; chan->loopstart = data->loopstart; chan->loopend = data->loopend ? data->loopend : size; - chan->freq = data->freq > 0 ? data->freq : t->rate; + chan->freq = data->freq > 0 ? (uint32_t)data->freq : t->rate; chan->vol = data->vol; if(!t->stereo) { diff --git a/utils/vqenc/vqenc.c b/utils/vqenc/vqenc.c index 5924da41..4f487ae9 100644 --- a/utils/vqenc/vqenc.c +++ b/utils/vqenc/vqenc.c @@ -18,6 +18,7 @@ #include <math.h> #include <unistd.h> #include <errno.h> +#include <inttypes.h> #include "get_image.h" #include "vq_internal.h" #include "vq_types.h" @@ -572,7 +573,7 @@ static fquad_t *create_downscaled_map(int res, fquad_t *oneup) { fquad_t *q, *larger, tmp; if(use_debug) { - printf("create_downscaled_map(%d %lx)\n", res, (uintptr_t)oneup); + printf("create_downscaled_map(%d %" PRIxPTR ")\n", res, (uintptr_t)oneup); } /* each quad in the lower resolution is an average of hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-05-22 13:51:22
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 79f8d37af06e725cfe5927936240a36b87cba274 (commit) via b01d552087a846e543e69bd1a6cd477f4b15936c (commit) from 40acafbb21bfaf6e75fa06df75aaf762079d2dd0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 79f8d37af06e725cfe5927936240a36b87cba274 Author: QuzarDC <qu...@co...> Date: Fri May 16 21:17:25 2025 -0400 Deprecate `snd_stream_prefill()` The function was only capable of possibly crashing, otherwise would have no effect and be repeated at the call of start. Left an inline compatibility replacement. commit b01d552087a846e543e69bd1a6cd477f4b15936c Author: QuzarDC <qu...@co...> Date: Tue May 13 17:25:46 2025 -0400 Prevent `snd_stream_prefill` from crashing before `snd_stream_start`. `snd_stream_fill` (and thus prefill) is currently not able to be run before the first call to `snd_stream_start` as the number of channels is undefined at the time. This behavior worked partially prior to #346 as the logic for most of the code was `if(channels == 2) ... else{}` so channels being zero didn't cause issues. What I've done is added assert checks to the fill function and a short-circuit in prefill to prevent crashes in these circumstances. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/exports-naomi.txt | 1 - kernel/arch/dreamcast/exports-pristine.txt | 1 - kernel/arch/dreamcast/include/dc/sound/stream.h | 10 ++++---- kernel/arch/dreamcast/sound/snd_stream.c | 33 +++++++++---------------- 4 files changed, 17 insertions(+), 28 deletions(-) diff --git a/kernel/arch/dreamcast/exports-naomi.txt b/kernel/arch/dreamcast/exports-naomi.txt index 2f1d5a17..326910cb 100644 --- a/kernel/arch/dreamcast/exports-naomi.txt +++ b/kernel/arch/dreamcast/exports-naomi.txt @@ -174,7 +174,6 @@ snd_stream_pan snd_stream_alloc snd_stream_destroy snd_stream_reinit -snd_stream_prefill snd_pcm16_split snd_pcm16_split_sq snd_pcm8_split diff --git a/kernel/arch/dreamcast/exports-pristine.txt b/kernel/arch/dreamcast/exports-pristine.txt index db35ee09..a6ff29e7 100644 --- a/kernel/arch/dreamcast/exports-pristine.txt +++ b/kernel/arch/dreamcast/exports-pristine.txt @@ -244,7 +244,6 @@ snd_stream_pan snd_stream_alloc snd_stream_destroy snd_stream_reinit -snd_stream_prefill snd_pcm16_split snd_pcm16_split_sq snd_pcm8_split diff --git a/kernel/arch/dreamcast/include/dc/sound/stream.h b/kernel/arch/dreamcast/include/dc/sound/stream.h index 50e32bee..bcca4a06 100644 --- a/kernel/arch/dreamcast/include/dc/sound/stream.h +++ b/kernel/arch/dreamcast/include/dc/sound/stream.h @@ -191,13 +191,13 @@ void snd_stream_filter_remove(snd_stream_hnd_t hnd, /** \brief Prefill the stream buffers. - This function prefills the stream buffers before starting it. This is - implicitly called by snd_stream_start(), so there's probably no good reason - to call this yourself. + This function has no effect. The stream is prefilled on start. + This is deprecated and should be removed if used. - \param hnd The stream to prefill buffers on. + \param hnd Param. */ -void snd_stream_prefill(snd_stream_hnd_t hnd); +static const int __snd_stream_prefill __depr("snd_stream_prefill has no effect and should be removed") = 0; +#define snd_stream_prefill(x) ((void)__snd_stream_prefill) /** \brief Initialize the stream system. diff --git a/kernel/arch/dreamcast/sound/snd_stream.c b/kernel/arch/dreamcast/sound/snd_stream.c index 9e11de86..7f51a9f4 100644 --- a/kernel/arch/dreamcast/sound/snd_stream.c +++ b/kernel/arch/dreamcast/sound/snd_stream.c @@ -316,25 +316,6 @@ void snd_pcm16_split_sq(uint32_t *data, uintptr_t left, uintptr_t right, size_t g2_unlock(ctx); } - -/* Prefill buffers -- implicitly called by snd_stream_start() */ -void snd_stream_prefill(snd_stream_hnd_t hnd) { - strchan_t *stream; - - CHECK_HND(hnd); - stream = &streams[hnd]; - - if(!stream->get_data && !stream->req_data) { - return; - } - - snd_stream_fill(hnd, 0, stream->buffer_size / 2); - snd_stream_fill(hnd, stream->buffer_size / 2, stream->buffer_size / 2); - - /* Start playing from the beginning */ - stream->last_write_pos = 0; -} - /* Initialize stream system */ int snd_stream_init(void) { return snd_stream_init_ex(2, SND_STREAM_BUFFER_MAX); @@ -535,8 +516,12 @@ static void snd_stream_start_type(snd_stream_hnd_t hnd, uint32_t type, uint32_t } } - /* Prefill buffers */ - snd_stream_prefill(hnd); + /* As long as there's a way to get/request data, prefill buffers */ + snd_stream_fill(hnd, 0, streams[hnd].buffer_size / 2); + snd_stream_fill(hnd, streams[hnd].buffer_size / 2, streams[hnd].buffer_size / 2); + + /* Start playing from the beginning */ + streams[hnd].last_write_pos = 0; /* Make sure these are sync'd (and/or delayed) */ snd_sh4_to_aica_stop(); @@ -690,6 +675,12 @@ static size_t snd_stream_fill(snd_stream_hnd_t hnd, uint32_t offset, size_t size int got_bytes = 0; void *data = NULL; + /* The stream hasn't been initted or is invalid. */ + CHECK_HND(hnd); + + /* The stream has been initted but not allocated. */ + assert(chans != 0); + if(stream->req_data) { got_bytes = stream->req_data(hnd, (left | SPU_RAM_UNCACHED_BASE), hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-05-21 18:20:17
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 40acafbb21bfaf6e75fa06df75aaf762079d2dd0 (commit) from 07614ba6df19ea975310f41fcb4932dcbe8b7adc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 40acafbb21bfaf6e75fa06df75aaf762079d2dd0 Author: darc <da...@pr...> Date: Wed May 21 13:01:25 2025 -0500 Fix warnings previously hidden behind ifdef guards ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/fs/fs_vmu.c | 2 +- kernel/fs/elf.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/kernel/arch/dreamcast/fs/fs_vmu.c b/kernel/arch/dreamcast/fs/fs_vmu.c index 7518d017..59ffc09c 100644 --- a/kernel/arch/dreamcast/fs/fs_vmu.c +++ b/kernel/arch/dreamcast/fs/fs_vmu.c @@ -520,7 +520,7 @@ static ssize_t vmu_write(void * hnd, const void *buffer, size_t cnt) { /* insert the data in buffer into fh->data at fh->loc */ if(__is_defined(VMUFS_DEBUG)) { - dbglog(DBG_KDEBUG, "VMUFS: adding %d bytes of data at loc %d (%d avail)\n", + dbglog(DBG_KDEBUG, "VMUFS: adding %d bytes of data at loc %ld (%ld avail)\n", cnt, fh->loc, fh->filesize * 512); } diff --git a/kernel/fs/elf.c b/kernel/fs/elf.c index c080f17a..2d40db4b 100644 --- a/kernel/fs/elf.c +++ b/kernel/fs/elf.c @@ -194,12 +194,12 @@ int elf_load(const char * fn, klibrary_t * shell, elf_prog_t * out) { for(i = 0; i < hdr->shnum; i++) { if(shdrs[i].flags & SHF_ALLOC) { if(shdrs[i].type == SHT_NOBITS) { - DBG((" setting %d bytes of zeros at %08x\n", + DBG((" setting %ld bytes of zeros at %08lx\n", shdrs[i].size, shdrs[i].addr)); memset(imgout + shdrs[i].addr, 0, shdrs[i].size); } else { - DBG((" copying %d bytes from %08x to %08x\n", + DBG((" copying %ld bytes from %08lx to %08lx\n", shdrs[i].size, shdrs[i].offset, shdrs[i].addr)); memcpy(imgout + shdrs[i].addr, img + shdrs[i].offset, @@ -232,7 +232,7 @@ int elf_load(const char * fn, klibrary_t * shell, elf_prog_t * out) { } /* Patch it in */ - DBG((" symbol '%s' patched to 0x%lx\n", + DBG((" symbol '%s' patched to 0x%x\n", (const char *)(symtab[i].name), sym->ptr)); symtab[i].value = sym->ptr; @@ -266,7 +266,7 @@ int elf_load(const char * fn, klibrary_t * shell, elf_prog_t * out) { sym = ELF32_R_SYM(relatab[j].info); if(symtab[sym].shndx == SHN_UNDEF) { - DBG((" Writing undefined RELA %08x(%08lx+%08lx) -> %08x\n", + DBG((" Writing undefined RELA %08lx(%08lx+%08lx) -> %08lx\n", symtab[sym].value + relatab[j].addend, symtab[sym].value, relatab[j].addend, @@ -278,7 +278,7 @@ int elf_load(const char * fn, klibrary_t * shell, elf_prog_t * out) { + relatab[j].addend; } else { - DBG((" Writing RELA %08x(%08x+%08x+%08x+%08x) -> %08x\n", + DBG((" Writing RELA %08lx(%08lx+%08lx+%08lx+%08lx) -> %08lx\n", vma + shdrs[symtab[sym].shndx].addr + symtab[sym].value + relatab[j].addend, vma, shdrs[symtab[sym].shndx].addr, symtab[sym].value, relatab[j].addend, vma + shdrs[sect].addr + relatab[j].offset)); @@ -317,7 +317,7 @@ int elf_load(const char * fn, klibrary_t * shell, elf_prog_t * out) { uint32 value = symtab[sym].value; if(sect == 1 && j < 5) { - DBG((" Writing undefined %s %08x -> %08x", + DBG((" Writing undefined %s %08lx -> %08lx", pcrel ? "PCREL" : "ABSREL", value, vma + shdrs[sect].addr + reltab[j].offset)); @@ -332,7 +332,7 @@ int elf_load(const char * fn, klibrary_t * shell, elf_prog_t * out) { += value; if(sect == 1 && j < 5) { - DBG(("(%08x)\n", *((uint32 *)(imgout + shdrs[sect].addr + reltab[j].offset)))); + DBG(("(%08lx)\n", *((uint32 *)(imgout + shdrs[sect].addr + reltab[j].offset)))); } } else { @@ -340,7 +340,7 @@ int elf_load(const char * fn, klibrary_t * shell, elf_prog_t * out) { + symtab[sym].value; if(sect == 1 && j < 5) { - DBG((" Writing %s %08x(%08x+%08x+%08x) -> %08x", + DBG((" Writing %s %08lx(%08lx+%08lx+%08lx) -> %08lx", pcrel ? "PCREL" : "ABSREL", value, vma, shdrs[symtab[sym].shndx].addr, symtab[sym].value, @@ -356,7 +356,7 @@ int elf_load(const char * fn, klibrary_t * shell, elf_prog_t * out) { += value; if(sect == 1 && j < 5) { - DBG(("(%08x)\n", *((uint32 *)(imgout + shdrs[sect].addr + reltab[j].offset)))); + DBG(("(%08lx)\n", *((uint32 *)(imgout + shdrs[sect].addr + reltab[j].offset)))); } } } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-05-21 17:44:01
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 07614ba6df19ea975310f41fcb4932dcbe8b7adc (commit) via 0249db7c24f94d5938fb78ab120c40211680823e (commit) via d816e5ebf989de54721ded90a7d86aba9684e89e (commit) via c00e94b5c26b25329ab439d386f7cd0be175a929 (commit) via d516a642d461a0ed4456252234225da1ff0c7a17 (commit) from 1a9179047ae8a8e449efdc45a57ed976a63419d3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 07614ba6df19ea975310f41fcb4932dcbe8b7adc Author: Paul Cercueil <pa...@cr...> Date: Tue May 20 21:42:30 2025 +0200 Un-hide code behind ifdef guards Hiding code behind ifdef guards has the nasty issue that the code is only seen by the compiler under a specific configuration. As time passes, the guarded code might become stale, causing some rarely used configurations to fail to build. This can be solved by using the __is_defined() macro to conditionally execute the code only if the given guard macro is defined. The difference is that the compiler will see the code, and report issues if it cannot build it, but ultimately drop it as dead code if the guard macro is not defined. Signed-off-by: Paul Cercueil <pa...@cr...> commit 0249db7c24f94d5938fb78ab120c40211680823e Author: Paul Cercueil <pa...@cr...> Date: Tue May 20 23:12:06 2025 +0200 Add missing <kos/dbglog.h> includes Under certain build conditions, the dbglog() was being used without the correct include, causing a build failure. Signed-off-by: Paul Cercueil <pa...@cr...> commit d816e5ebf989de54721ded90a7d86aba9684e89e Author: Paul Cercueil <pa...@cr...> Date: Tue May 20 23:10:42 2025 +0200 fs: Fix debug print in ELF code A debug print was referencing a struct field that does not exist. Signed-off-by: Paul Cercueil <pa...@cr...> commit c00e94b5c26b25329ab439d386f7cd0be175a929 Author: Paul Cercueil <pa...@cr...> Date: Tue May 20 21:40:23 2025 +0200 cdefs.h: Add __is_defined() macro This macro will resolve to a compile-time constant value of 1 (true) if the macro passed as argument resolves to 1, and will resolve to 0 (false) otherwise. Signed-off-by: Paul Cercueil <pa...@cr...> commit d516a642d461a0ed4456252234225da1ff0c7a17 Author: Paul Cercueil <pa...@cr...> Date: Tue May 20 21:39:22 2025 +0200 cdefs.h: Add __stringify() macro Just a simple macro to return a C string from the argument. Signed-off-by: Paul Cercueil <pa...@cr...> ----------------------------------------------------------------------- Summary of changes: include/kos/cdefs.h | 13 ++++ include/kos/version.h | 10 +-- kernel/arch/dreamcast/fs/fs_vmu.c | 27 +++---- .../dreamcast/hardware/maple/maple_init_shutdown.c | 27 ++++--- kernel/arch/dreamcast/hardware/maple/maple_irq.c | 31 ++++---- kernel/arch/dreamcast/hardware/maple/maple_queue.c | 15 ++-- kernel/arch/dreamcast/hardware/maple/maple_utils.c | 4 +- .../dreamcast/hardware/network/broadband_adapter.c | 44 ++++------- .../dreamcast/hardware/pvr/pvr_init_shutdown.c | 26 +++---- kernel/arch/dreamcast/hardware/pvr/pvr_irq.c | 56 +++++++------- kernel/arch/dreamcast/hardware/pvr/pvr_mem.c | 85 ++++++++++------------ kernel/arch/dreamcast/hardware/pvr/pvr_scene.c | 25 +++---- kernel/arch/dreamcast/include/dc/maple.h | 2 - kernel/arch/dreamcast/kernel/irq.c | 4 +- kernel/arch/dreamcast/kernel/stack.c | 11 ++- kernel/arch/dreamcast/sound/snd_mem.c | 46 ++++++------ kernel/fs/elf.c | 11 ++- kernel/libc/koslib/assert.c | 9 +-- 18 files changed, 210 insertions(+), 236 deletions(-) diff --git a/include/kos/cdefs.h b/include/kos/cdefs.h index 22ff1e16..e016a51b 100644 --- a/include/kos/cdefs.h +++ b/include/kos/cdefs.h @@ -277,6 +277,19 @@ #define _array_size_chk(arr) 0 #endif +/** \brief Create a string from the argument. + + \param arg The text to stringify. + */ +#define __stringify(arg) ""#arg + +/** \brief Check if a macro is defined to 1. + + \param macro The macro to check + \return 1 if the macro is defined to 1, 0 otherwise. + */ +#define __is_defined(macro) !__builtin_strcmp(__stringify(macro), "1") + /** @} */ #endif /* __KOS_CDEFS_H */ diff --git a/include/kos/version.h b/include/kos/version.h index 5fe98b1a..9b7e3baf 100644 --- a/include/kos/version.h +++ b/include/kos/version.h @@ -263,9 +263,9 @@ `major.minor.patch` */ #define KOS_VERSION_MAKE_STRING(major, minor, patch) \ - KOS_STRINGIFY(major) "." \ - KOS_STRINGIFY(minor) "." \ - KOS_STRINGIFY(patch) + __stringify(major) "." \ + __stringify(minor) "." \ + __stringify(patch) /** @} */ /** \name Version Checking @@ -381,10 +381,6 @@ (KOS_VERSION_MAKE_COMPARISON(major, minor, patch, >, version)) /** @} */ -/** \cond INTERNAL */ -#define KOS_STRINGIFY(str) #str -/** \endcond */ - /** @} */ #include <kos/cdefs.h> diff --git a/kernel/arch/dreamcast/fs/fs_vmu.c b/kernel/arch/dreamcast/fs/fs_vmu.c index f79cd7b8..7518d017 100644 --- a/kernel/arch/dreamcast/fs/fs_vmu.c +++ b/kernel/arch/dreamcast/fs/fs_vmu.c @@ -166,16 +166,17 @@ static vmu_fh_t *vmu_open_vmu_dir(void) { names[num][0] = p + 'a'; names[num][1] = u + '0'; num++; -#ifdef VMUFS_DEBUG - dbglog(DBG_KDEBUG, "vmu_open_vmu_dir: found memcard (%c%d)\n", 'a' + p, u); -#endif + + if(__is_defined(VMUFS_DEBUG)) { + dbglog(DBG_KDEBUG, "vmu_open_vmu_dir: found memcard (%c%d)\n", + 'a' + p, u); + } } } } -#ifdef VMUFS_DEBUG - dbglog(DBG_KDEBUG, "# of memcards found: %d\n", num); -#endif + if(__is_defined(VMUFS_DEBUG)) + dbglog(DBG_KDEBUG, "# of memcards found: %d\n", num); if(!(dh = malloc(sizeof(vmu_dh_t)))) return NULL; @@ -500,9 +501,8 @@ static ssize_t vmu_write(void * hnd, const void *buffer, size_t cnt) { n = n / 512; -#ifdef VMUFS_DEBUG - dbglog(DBG_KDEBUG, "VMUFS: extending file's filesize by %d\n", n); -#endif + if(__is_defined(VMUFS_DEBUG)) + dbglog(DBG_KDEBUG, "VMUFS: extending file's filesize by %d\n", n); /* We alloc another 512*n bytes for the file */ tmp = realloc(fh->data, (fh->filesize + n) * 512); @@ -519,10 +519,11 @@ static ssize_t vmu_write(void * hnd, const void *buffer, size_t cnt) { } /* insert the data in buffer into fh->data at fh->loc */ -#ifdef VMUFS_DEBUG - dbglog(DBG_KDEBUG, "VMUFS: adding %d bytes of data at loc %d (%d avail)\n", - cnt, fh->loc, fh->filesize * 512); -#endif + if(__is_defined(VMUFS_DEBUG)) { + dbglog(DBG_KDEBUG, "VMUFS: adding %d bytes of data at loc %d (%d avail)\n", + cnt, fh->loc, fh->filesize * 512); + } + memcpy(fh->data + fh->loc + fh->start, buffer, cnt); fh->loc += cnt; diff --git a/kernel/arch/dreamcast/hardware/maple/maple_init_shutdown.c b/kernel/arch/dreamcast/hardware/maple/maple_init_shutdown.c index 524aca63..c23848ce 100644 --- a/kernel/arch/dreamcast/hardware/maple/maple_init_shutdown.c +++ b/kernel/arch/dreamcast/hardware/maple/maple_init_shutdown.c @@ -58,20 +58,22 @@ static void maple_hw_init(void) { } /* Allocate the DMA send buffer */ -#if MAPLE_DMA_DEBUG - maple_state.dma_buffer = aligned_alloc(32, MAPLE_DMA_SIZE + 1024); -#else - maple_state.dma_buffer = aligned_alloc(32, MAPLE_DMA_SIZE); -#endif + if(__is_defined(MAPLE_DMA_DEBUG)) + maple_state.dma_buffer = aligned_alloc(32, MAPLE_DMA_SIZE + 1024); + else + maple_state.dma_buffer = aligned_alloc(32, MAPLE_DMA_SIZE); + assert_msg(maple_state.dma_buffer != NULL, "Couldn't allocate maple DMA buffer"); assert_msg((((uint32)maple_state.dma_buffer) & 0x1f) == 0, "DMA buffer was unaligned; bug in dlmalloc; please report!"); /* Force it into the P2 area */ maple_state.dma_buffer = (uint8*)((((uint32)maple_state.dma_buffer) & MEM_AREA_CACHE_MASK) | MEM_AREA_P2_BASE); -#if MAPLE_DMA_DEBUG - maple_state.dma_buffer += 512; - maple_sentinel_setup(maple_state.dma_buffer - 512, MAPLE_DMA_SIZE + 1024); -#endif + + if(__is_defined(MAPLE_DMA_DEBUG)) { + maple_state.dma_buffer += 512; + maple_sentinel_setup(maple_state.dma_buffer - 512, MAPLE_DMA_SIZE + 1024); + } + maple_state.dma_in_progress = 0; dbglog(DBG_INFO, " DMA Buffer at %08lx\n", (uint32)maple_state.dma_buffer); @@ -117,9 +119,10 @@ void maple_hw_shutdown(void) { /* We must cast this back to P1 or cache issues will arise */ if(maple_state.dma_buffer != NULL) { ptr = (uint32)maple_state.dma_buffer; -#if MAPLE_DMA_DEBUG - ptr -= 512; -#endif + + if(__is_defined(MAPLE_DMA_DEBUG)) + ptr -= 512; + ptr = (ptr & MEM_AREA_CACHE_MASK) | MEM_AREA_P1_BASE; free((void *)ptr); maple_state.dma_buffer = NULL; diff --git a/kernel/arch/dreamcast/hardware/maple/maple_irq.c b/kernel/arch/dreamcast/hardware/maple/maple_irq.c index 80fdb6a4..0f116a4a 100644 --- a/kernel/arch/dreamcast/hardware/maple/maple_irq.c +++ b/kernel/arch/dreamcast/hardware/maple/maple_irq.c @@ -14,6 +14,7 @@ #include <dc/maple.h> #include <dc/asic.h> #include <dc/pvr.h> +#include <kos/dbglog.h> #include <kos/thread.h> /*********************************************************************/ @@ -48,10 +49,11 @@ static void vbl_chk_disconnect(maple_state_t *state, int p, int u) { (void)state; if(maple_dev_valid(p, u)) { -#if MAPLE_IRQ_DEBUG - dbglog(DBG_KDEBUG, "maple: detach on device %c%c\n", - 'A' + p, '0' + u); -#endif + if(__is_defined(MAPLE_IRQ_DEBUG)) { + dbglog(DBG_KDEBUG, "maple: detach on device %c%c\n", + 'A' + p, '0' + u); + } + if(maple_driver_detach(p, u) >= 0) { assert(!maple_dev_valid(p, u)); } @@ -150,10 +152,11 @@ static void vbl_autodet_callback(maple_state_t *state, maple_frame_t *frm) { else if(resp->response == MAPLE_RESPONSE_DEVINFO) { /* Device is present, check for connections */ if(!dev) { -#if MAPLE_IRQ_DEBUG - dbglog(DBG_KDEBUG, "maple: attach on device %c%c\n", - 'A' + p, '0' + u); -#endif + if(__is_defined(MAPLE_IRQ_DEBUG)) { + dbglog(DBG_KDEBUG, "maple: attach on device %c%c\n", + 'A' + p, '0' + u); + } + if(maple_driver_attach(frm) == 0) { assert(maple_dev_valid(p, u)); } @@ -253,9 +256,10 @@ void maple_dma_irq_hnd(uint32 code, void *data) { /* ACK the receipt */ state->dma_in_progress = 0; -#if MAPLE_DMA_DEBUG - maple_sentinel_verify("state->dma_buffer", state->dma_buffer, MAPLE_DMA_SIZE); -#endif + if(__is_defined(MAPLE_DMA_DEBUG)) { + maple_sentinel_verify("state->dma_buffer", state->dma_buffer, + MAPLE_DMA_SIZE); + } /* For each queued frame, call its callback if it's done */ TAILQ_FOREACH_SAFE(i, &state->frame_queue, frameq, tmp) { @@ -272,9 +276,8 @@ void maple_dma_irq_hnd(uint32 code, void *data) { continue; } -#if MAPLE_DMA_DEBUG - maple_sentinel_verify("i->recv_buf", i->recv_buf, 1024); -#endif + if(__is_defined(MAPLE_DMA_DEBUG)) + maple_sentinel_verify("i->recv_buf", i->recv_buf, 1024); /* Mark it as responded to */ i->state = MAPLE_FRAME_RESPONDED; diff --git a/kernel/arch/dreamcast/hardware/maple/maple_queue.c b/kernel/arch/dreamcast/hardware/maple/maple_queue.c index 6875b3b6..5c1d5922 100644 --- a/kernel/arch/dreamcast/hardware/maple/maple_queue.c +++ b/kernel/arch/dreamcast/hardware/maple/maple_queue.c @@ -155,18 +155,17 @@ void maple_frame_init(maple_frame_t *frame) { if(buf_ptr & 0x1f) buf_ptr = (buf_ptr & ~0x1f) + 0x20; -#if MAPLE_DMA_DEBUG - buf_ptr += 512; -#endif + if(__is_defined(MAPLE_DMA_DEBUG)) + buf_ptr += 512; + buf_ptr = (buf_ptr & MEM_AREA_CACHE_MASK) | MEM_AREA_P2_BASE; frame->recv_buf = (uint8*)buf_ptr; /* Clear out the receive buffer */ -#if MAPLE_DMA_DEBUG - maple_sentinel_setup(frame->recv_buf - 512, 1024 + 1024); -#else - memset(frame->recv_buf, 0, 1024); -#endif + if(__is_defined(MAPLE_DMA_DEBUG)) + maple_sentinel_setup(frame->recv_buf - 512, 1024 + 1024); + else + memset(frame->recv_buf, 0, 1024); /* Initialize other state stuff */ frame->cmd = -1; diff --git a/kernel/arch/dreamcast/hardware/maple/maple_utils.c b/kernel/arch/dreamcast/hardware/maple/maple_utils.c index b1a58570..522a3ea5 100644 --- a/kernel/arch/dreamcast/hardware/maple/maple_utils.c +++ b/kernel/arch/dreamcast/hardware/maple/maple_utils.c @@ -167,9 +167,9 @@ void maple_gun_read_pos(int *x, int *y) { *y = maple_state.gun_y; } -#if MAPLE_DMA_DEBUG /* Debugging help */ void maple_sentinel_setup(void * buffer, int bufsize) { + assert(__is_defined(MAPLE_DMA_DEBUG)); assert(bufsize % 4 == 0); memset(buffer, 0xdeadbeef, bufsize); } @@ -178,6 +178,7 @@ void maple_sentinel_verify(const char * bufname, void * buffer, int bufsize) { int i; uint32 *b32; + assert(__is_defined(MAPLE_DMA_DEBUG)); assert(bufsize % 4 == 0); b32 = ((uint32 *)buffer) - 512 / 4; @@ -200,4 +201,3 @@ void maple_sentinel_verify(const char * bufname, void * buffer, int bufsize) { } } } -#endif diff --git a/kernel/arch/dreamcast/hardware/network/broadband_adapter.c b/kernel/arch/dreamcast/hardware/network/broadband_adapter.c index 9201a9d8..95de93fb 100644 --- a/kernel/arch/dreamcast/hardware/network/broadband_adapter.c +++ b/kernel/arch/dreamcast/hardware/network/broadband_adapter.c @@ -485,9 +485,7 @@ static semaphore_t bba_rx_sema2; static void bba_rx(void); -#ifdef TX_SEMA static semaphore_t tx_sema; -#endif static uint8 * next_dst; static uint8 * next_src; @@ -543,10 +541,9 @@ static int bba_copy_dma(uint8 * dst, uint32 s, int len) { src -= add; dst -= add; -#ifndef USE_P2_AREA /* Invalidate the dcache over the range of the data. */ - dcache_inval_range((uint32) dst, len); -#endif + if(!__is_defined(USE_P2_AREA)) + dcache_inval_range((uint32) dst, len); if(!dma_used) { dma_used = 1; @@ -574,13 +571,9 @@ static int bba_copy_dma(uint8 * dst, uint32 s, int len) { /* XXX Could probably use a memcpy8 here, even */ static int bba_copy_packet(uint8 * dst, uint32 src, int len) { -#if !RX_NOWRAP - - if((src + len) < RX_BUFFER_LEN) { -#endif + if(__is_defined(RX_NOWRAP) || (src + len) < RX_BUFFER_LEN) { /* Straight copy is ok */ return bba_copy_dma(dst, rtl_mem + src, len); -#if !RX_NOWRAP } else { /* Have to copy around the ring end */ @@ -589,8 +582,6 @@ static int bba_copy_packet(uint8 * dst, uint32 src, int len) { return bba_copy_dma(dst + (RX_BUFFER_LEN - src), rtl_mem, len - (RX_BUFFER_LEN - src)); } - -#endif } static int rx_enq(int ring_offset, size_t pkt_size) { @@ -603,12 +594,10 @@ static int rx_enq(int ring_offset, size_t pkt_size) { /* Receive buffer: temporary space to copy out received data */ -#ifdef USE_P2_AREA - rx_pkt[rxin].rxbuff = rxbuff + 32 + (rxbuff_pos | MEM_AREA_P2_BASE) + (ring_offset & 31); -#else - rx_pkt[rxin].rxbuff = rxbuff + 32 + rxbuff_pos + (ring_offset & 31); -#endif - + if(__is_defined(USE_P2_AREA)) + rx_pkt[rxin].rxbuff = rxbuff + 32 + (rxbuff_pos | MEM_AREA_P2_BASE) + (ring_offset & 31); + else + rx_pkt[rxin].rxbuff = rxbuff + 32 + rxbuff_pos + (ring_offset & 31); rxbuff_pos = (rxbuff_pos + pkt_size + 63) & (RXBSZ - 32); @@ -620,11 +609,7 @@ static int rx_enq(int ring_offset, size_t pkt_size) { } /* Transmit a single packet */ -#ifdef TX_SEMA static int bba_rtx(const uint8 * pkt, int len, int wait) -#else -static int bba_tx(const uint8 * pkt, int len, int wait) -#endif { if(!link_stable) { if(wait == BBA_TX_WAIT) { @@ -683,10 +668,12 @@ static int bba_tx(const uint8 * pkt, int len, int wait) return BBA_TX_OK; } -#ifdef TX_SEMA int bba_tx(const uint8 * pkt, int len, int wait) { int res; + if(!__is_defined(TX_SEMA)) + return bba_rtx(pkt, len, wait); + if(irq_inside_int()) { if(sem_trywait(&tx_sema)) { //printf("bba_tx called from an irq while a thread was running it !\n"); @@ -701,7 +688,6 @@ int bba_tx(const uint8 * pkt, int len, int wait) { return res; } -#endif void bba_lock(void) { //sem_wait(&bba_rx_sema2); @@ -1109,9 +1095,8 @@ int bba_init(void) { /* Use the netcore callback */ bba_set_rx_callback(bba_if_netinput); -#ifdef TX_SEMA - sem_init(&tx_sema, 1); -#endif + if(__is_defined(TX_SEMA)) + sem_init(&tx_sema, 1); /* VP : Initialize rx thread */ // Note: The thread itself is not created here, but when we actually @@ -1186,9 +1171,8 @@ int bba_shutdown(void) { if(bba_if.flags & NETIF_INITIALIZED) bba_if.if_shutdown(&bba_if); -#ifdef TX_SEMA - sem_destroy(&tx_sema); -#endif + if(__is_defined(TX_SEMA)) + sem_destroy(&tx_sema); return 0; } diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_init_shutdown.c b/kernel/arch/dreamcast/hardware/pvr/pvr_init_shutdown.c index 41036b4a..7aa3b019 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_init_shutdown.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_init_shutdown.c @@ -161,19 +161,19 @@ int pvr_init(const pvr_init_params_t *params) { asic_evt_set_handler(ASIC_EVT_PVR_RENDERDONE_TSP, pvr_int_handler, NULL); asic_evt_enable(ASIC_EVT_PVR_RENDERDONE_TSP, ASIC_IRQ_DEFAULT); -#ifdef PVR_RENDER_DBG - /* Hook up interrupt handlers for error events */ - asic_evt_set_handler(ASIC_EVT_PVR_ISP_OUTOFMEM, pvr_int_handler, NULL); - asic_evt_enable(ASIC_EVT_PVR_ISP_OUTOFMEM, ASIC_IRQ_DEFAULT); - asic_evt_set_handler(ASIC_EVT_PVR_STRIP_HALT, pvr_int_handler, NULL); - asic_evt_enable(ASIC_EVT_PVR_STRIP_HALT, ASIC_IRQ_DEFAULT); - asic_evt_set_handler(ASIC_EVT_PVR_OPB_OUTOFMEM, pvr_int_handler, NULL); - asic_evt_enable(ASIC_EVT_PVR_OPB_OUTOFMEM, ASIC_IRQ_DEFAULT); - asic_evt_set_handler(ASIC_EVT_PVR_TA_INPUT_ERR, pvr_int_handler, NULL); - asic_evt_enable(ASIC_EVT_PVR_TA_INPUT_ERR, ASIC_IRQ_DEFAULT); - asic_evt_set_handler(ASIC_EVT_PVR_TA_INPUT_OVERFLOW, pvr_int_handler, NULL); - asic_evt_enable(ASIC_EVT_PVR_TA_INPUT_OVERFLOW, ASIC_IRQ_DEFAULT); -#endif + if(__is_defined(PVR_RENDER_DBG)) { + /* Hook up interrupt handlers for error events */ + asic_evt_set_handler(ASIC_EVT_PVR_ISP_OUTOFMEM, pvr_int_handler, NULL); + asic_evt_enable(ASIC_EVT_PVR_ISP_OUTOFMEM, ASIC_IRQ_DEFAULT); + asic_evt_set_handler(ASIC_EVT_PVR_STRIP_HALT, pvr_int_handler, NULL); + asic_evt_enable(ASIC_EVT_PVR_STRIP_HALT, ASIC_IRQ_DEFAULT); + asic_evt_set_handler(ASIC_EVT_PVR_OPB_OUTOFMEM, pvr_int_handler, NULL); + asic_evt_enable(ASIC_EVT_PVR_OPB_OUTOFMEM, ASIC_IRQ_DEFAULT); + asic_evt_set_handler(ASIC_EVT_PVR_TA_INPUT_ERR, pvr_int_handler, NULL); + asic_evt_enable(ASIC_EVT_PVR_TA_INPUT_ERR, ASIC_IRQ_DEFAULT); + asic_evt_set_handler(ASIC_EVT_PVR_TA_INPUT_OVERFLOW, pvr_int_handler, NULL); + asic_evt_enable(ASIC_EVT_PVR_TA_INPUT_OVERFLOW, ASIC_IRQ_DEFAULT); + } /* 3d-specific parameters; these are all about rendering and nothing to do with setting up the video; some stuff in here diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_irq.c b/kernel/arch/dreamcast/hardware/pvr/pvr_irq.c index 5ace04d7..711b271b 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_irq.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_irq.c @@ -14,9 +14,7 @@ #include <kos/genwait.h> #include <kos/regfield.h> -#ifdef PVR_RENDER_DBG #include <stdio.h> -#endif /* PVR interrupt handler; the way things are setup, we're gonna get @@ -176,34 +174,34 @@ void pvr_int_handler(uint32 code, void *data) { break; } -#ifdef PVR_RENDER_DBG - /* Show register values on each interrupt */ - switch (code) { - case ASIC_EVT_PVR_ISP_OUTOFMEM: - DBG(("[ERROR]: ASIC_EVT_PVR_ISP_OUTOFMEM\n")); - break; - - case ASIC_EVT_PVR_STRIP_HALT: - DBG(("[ERROR]: ASIC_EVT_PVR_STRIP_HALT\n")); - break; - - case ASIC_EVT_PVR_OPB_OUTOFMEM: - DBG(("[ERROR]: ASIC_EVT_PVR_OPB_OUTOFMEM\n")); - DBG(("PVR_TA_OPB_START: %08lx\nPVR_TA_OPB_END: %08lx\nPVR_TA_OPB_POS: %08lx\n", - PVR_GET(PVR_TA_OPB_START), - PVR_GET(PVR_TA_OPB_END), - PVR_GET(PVR_TA_OPB_POS) << 2)); - break; - - case ASIC_EVT_PVR_TA_INPUT_ERR: - DBG(("[ERROR]: ASIC_EVT_PVR_TA_INPUT_ERR\n")); - break; - - case ASIC_EVT_PVR_TA_INPUT_OVERFLOW: - DBG(("[ERROR]: ASIC_EVT_PVR_TA_INPUT_OVERFLOW\n")); ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-05-21 17:27:06
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 1a9179047ae8a8e449efdc45a57ed976a63419d3 (commit) from 5ac5dbae9c76ad4a239f3e0afb76d782dd5471df (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1a9179047ae8a8e449efdc45a57ed976a63419d3 Author: darc <da...@pr...> Date: Tue May 20 12:38:48 2025 -0500 Move gitignore declarations to sub-project dirs ----------------------------------------------------------------------- Summary of changes: .gitignore | 49 +--------------------- examples/dreamcast/basic/exec/.gitignore | 1 + examples/dreamcast/conio/adventure/.gitignore | 2 + examples/dreamcast/gldc/basic/vq/.gitignore | 1 + examples/dreamcast/gldc/nehe/nehe26/.gitignore | 1 + examples/dreamcast/kgl/basic/vq/.gitignore | 1 + examples/dreamcast/kgl/nehe/nehe26/.gitignore | 1 + examples/dreamcast/library/.gitignore | 2 + examples/dreamcast/png/.gitignore | 1 + examples/dreamcast/pvr/bumpmap/.gitignore | 2 + .../dreamcast/pvr/modifier_volume_tex/.gitignore | 1 + examples/dreamcast/pvr/texture_render/.gitignore | 1 + examples/dreamcast/video/screenshot/.gitignore | 1 + kernel/arch/dreamcast/kernel/.gitignore | 2 + kernel/arch/dreamcast/sound/.gitignore | 1 + kernel/arch/dreamcast/sound/arm/.gitignore | 1 + kernel/exports/.gitignore | 1 + kernel/stubs/.gitignore | 1 + utils/bin2c/.gitignore | 1 + utils/bincnv/.gitignore | 1 + utils/dcbumpgen/.gitignore | 1 + utils/genromfs/.gitignore | 1 + utils/gentexfont/.gitignore | 1 + utils/isotest/.gitignore | 1 + utils/kmgenc/.gitignore | 1 + utils/makeip/.gitignore | 1 + utils/makejitter/.gitignore | 1 + utils/naomibintool/.gitignore | 1 + utils/naominetboot/.gitignore | 1 + utils/scramble/.gitignore | 1 + utils/vqenc/.gitignore | 1 + utils/wav2adpcm/.gitignore | 1 + 32 files changed, 37 insertions(+), 47 deletions(-) create mode 100644 examples/dreamcast/basic/exec/.gitignore create mode 100644 examples/dreamcast/conio/adventure/.gitignore create mode 100644 examples/dreamcast/gldc/basic/vq/.gitignore create mode 100644 examples/dreamcast/gldc/nehe/nehe26/.gitignore create mode 100644 examples/dreamcast/kgl/basic/vq/.gitignore create mode 100644 examples/dreamcast/kgl/nehe/nehe26/.gitignore create mode 100644 examples/dreamcast/library/.gitignore create mode 100644 examples/dreamcast/png/.gitignore create mode 100644 examples/dreamcast/pvr/bumpmap/.gitignore create mode 100644 examples/dreamcast/pvr/modifier_volume_tex/.gitignore create mode 100644 examples/dreamcast/pvr/texture_render/.gitignore create mode 100644 examples/dreamcast/video/screenshot/.gitignore create mode 100644 kernel/arch/dreamcast/kernel/.gitignore create mode 100644 kernel/arch/dreamcast/sound/.gitignore create mode 100644 kernel/arch/dreamcast/sound/arm/.gitignore create mode 100644 kernel/exports/.gitignore create mode 100644 kernel/stubs/.gitignore create mode 100644 utils/bin2c/.gitignore create mode 100644 utils/bincnv/.gitignore create mode 100644 utils/dcbumpgen/.gitignore create mode 100644 utils/genromfs/.gitignore create mode 100644 utils/gentexfont/.gitignore create mode 100644 utils/isotest/.gitignore create mode 100644 utils/kmgenc/.gitignore create mode 100644 utils/makejitter/.gitignore create mode 100644 utils/naomibintool/.gitignore create mode 100644 utils/naominetboot/.gitignore create mode 100644 utils/scramble/.gitignore create mode 100644 utils/vqenc/.gitignore create mode 100644 utils/wav2adpcm/.gitignore diff --git a/.gitignore b/.gitignore index cb2657a4..a4e8474b 100644 --- a/.gitignore +++ b/.gitignore @@ -10,52 +10,7 @@ .*.swp .DS_Store .vscode/ -doc/reference/ environ.sh romdisk.img -kernel/stubs/*.c -kernel/exports/kernel_exports.c -kernel/arch/dreamcast/kernel/arch_exports.c -kernel/arch/dreamcast/kernel/banner.h -kernel/arch/dreamcast/sound/snd_stream_drv.c -kernel/arch/dreamcast/sound/arm/stream.drv -utils/bincnv/bincnv -utils/genromfs/genromfs -utils/vqenc/vqenc -utils/wav2adpcm/wav2adpcm -utils/kmgenc/kmgenc -utils/bin2c/bin2c -utils/bincnv/bincnv -utils/gentexfont/gentexfont -utils/isotest/isotest -utils/makejitter/makejitter -utils/dcbumpgen/dcbumpgen -utils/scramble/scramble -utils/makeip/makeip -utils/naomibintool/naomibintool -utils/naominetboot/naominetboot -examples/dreamcast/basic/exec/romdisk/sub.bin -examples/dreamcast/kgl/basic/vq/fruit.vq -examples/dreamcast/kgl/nehe/nehe26/data/txt2bin -examples/dreamcast/gldc/basic/vq/fruit.vq -examples/dreamcast/gldc/nehe/nehe26/data/txt2bin -examples/dreamcast/conio/adventure/data.c -examples/dreamcast/conio/adventure/datagen -examples/dreamcast/png/romdisk_boot.img -examples/dreamcast/pvr/bumpmap/romdisk/bricks.kmg -examples/dreamcast/pvr/bumpmap/romdisk/bumpmap.raw -examples/dreamcast/pvr/modifier_volume_tex/romdisk/fruit.kmg -examples/dreamcast/pvr/texture_render/texture_render.bin -examples/dreamcast/video/screenshot/screenshot*.ppm -examples/dreamcast/library/exports.c -examples/dreamcast/library/exports_stubs.c -examples/dreamcast/library/*/exports.c -examples/dreamcast/library/*/exports_stubs.c -utils/dc-chain/logs -utils/dc-chain/*.tar.bz2 -utils/dc-chain/*.tar.gz -utils/dc-chain/binutils-* -utils/dc-chain/gcc-* -utils/dc-chain/newlib-* -utils/dc-chain/gdb-* -utils/dc-chain/insight-* +/doc/reference/ +/ports/ diff --git a/examples/dreamcast/basic/exec/.gitignore b/examples/dreamcast/basic/exec/.gitignore new file mode 100644 index 00000000..2e6b6d00 --- /dev/null +++ b/examples/dreamcast/basic/exec/.gitignore @@ -0,0 +1 @@ +romdisk/sub.bin diff --git a/examples/dreamcast/conio/adventure/.gitignore b/examples/dreamcast/conio/adventure/.gitignore new file mode 100644 index 00000000..15c61ac7 --- /dev/null +++ b/examples/dreamcast/conio/adventure/.gitignore @@ -0,0 +1,2 @@ +data.c +datagen diff --git a/examples/dreamcast/gldc/basic/vq/.gitignore b/examples/dreamcast/gldc/basic/vq/.gitignore new file mode 100644 index 00000000..4ce9dd50 --- /dev/null +++ b/examples/dreamcast/gldc/basic/vq/.gitignore @@ -0,0 +1 @@ +fruit.vq diff --git a/examples/dreamcast/gldc/nehe/nehe26/.gitignore b/examples/dreamcast/gldc/nehe/nehe26/.gitignore new file mode 100644 index 00000000..cbf6ad08 --- /dev/null +++ b/examples/dreamcast/gldc/nehe/nehe26/.gitignore @@ -0,0 +1 @@ +data/txt2bin diff --git a/examples/dreamcast/kgl/basic/vq/.gitignore b/examples/dreamcast/kgl/basic/vq/.gitignore new file mode 100644 index 00000000..4ce9dd50 --- /dev/null +++ b/examples/dreamcast/kgl/basic/vq/.gitignore @@ -0,0 +1 @@ +fruit.vq diff --git a/examples/dreamcast/kgl/nehe/nehe26/.gitignore b/examples/dreamcast/kgl/nehe/nehe26/.gitignore new file mode 100644 index 00000000..cbf6ad08 --- /dev/null +++ b/examples/dreamcast/kgl/nehe/nehe26/.gitignore @@ -0,0 +1 @@ +data/txt2bin diff --git a/examples/dreamcast/library/.gitignore b/examples/dreamcast/library/.gitignore new file mode 100644 index 00000000..4c936eea --- /dev/null +++ b/examples/dreamcast/library/.gitignore @@ -0,0 +1,2 @@ +exports.c +exports_stubs.c diff --git a/examples/dreamcast/png/.gitignore b/examples/dreamcast/png/.gitignore new file mode 100644 index 00000000..88488290 --- /dev/null +++ b/examples/dreamcast/png/.gitignore @@ -0,0 +1 @@ +romdisk_boot.img diff --git a/examples/dreamcast/pvr/bumpmap/.gitignore b/examples/dreamcast/pvr/bumpmap/.gitignore new file mode 100644 index 00000000..5e74dd6d --- /dev/null +++ b/examples/dreamcast/pvr/bumpmap/.gitignore @@ -0,0 +1,2 @@ +romdisk/bricks.kmg +romdisk/bumpmap.raw diff --git a/examples/dreamcast/pvr/modifier_volume_tex/.gitignore b/examples/dreamcast/pvr/modifier_volume_tex/.gitignore new file mode 100644 index 00000000..86814965 --- /dev/null +++ b/examples/dreamcast/pvr/modifier_volume_tex/.gitignore @@ -0,0 +1 @@ +romdisk/fruit.kmg diff --git a/examples/dreamcast/pvr/texture_render/.gitignore b/examples/dreamcast/pvr/texture_render/.gitignore new file mode 100644 index 00000000..05593098 --- /dev/null +++ b/examples/dreamcast/pvr/texture_render/.gitignore @@ -0,0 +1 @@ +texture_render.bin diff --git a/examples/dreamcast/video/screenshot/.gitignore b/examples/dreamcast/video/screenshot/.gitignore new file mode 100644 index 00000000..078e7823 --- /dev/null +++ b/examples/dreamcast/video/screenshot/.gitignore @@ -0,0 +1 @@ +screenshot*.ppm diff --git a/kernel/arch/dreamcast/kernel/.gitignore b/kernel/arch/dreamcast/kernel/.gitignore new file mode 100644 index 00000000..989e5ff4 --- /dev/null +++ b/kernel/arch/dreamcast/kernel/.gitignore @@ -0,0 +1,2 @@ +arch_exports.c +banner.h diff --git a/kernel/arch/dreamcast/sound/.gitignore b/kernel/arch/dreamcast/sound/.gitignore new file mode 100644 index 00000000..0396d8e2 --- /dev/null +++ b/kernel/arch/dreamcast/sound/.gitignore @@ -0,0 +1 @@ +snd_stream_drv.c diff --git a/kernel/arch/dreamcast/sound/arm/.gitignore b/kernel/arch/dreamcast/sound/arm/.gitignore new file mode 100644 index 00000000..a38dc1ed --- /dev/null +++ b/kernel/arch/dreamcast/sound/arm/.gitignore @@ -0,0 +1 @@ +stream.drv diff --git a/kernel/exports/.gitignore b/kernel/exports/.gitignore new file mode 100644 index 00000000..7f12227d --- /dev/null +++ b/kernel/exports/.gitignore @@ -0,0 +1 @@ +kernel_exports.c diff --git a/kernel/stubs/.gitignore b/kernel/stubs/.gitignore new file mode 100644 index 00000000..064a8d8e --- /dev/null +++ b/kernel/stubs/.gitignore @@ -0,0 +1 @@ +*.c diff --git a/utils/bin2c/.gitignore b/utils/bin2c/.gitignore new file mode 100644 index 00000000..366f3d3e --- /dev/null +++ b/utils/bin2c/.gitignore @@ -0,0 +1 @@ +bin2c diff --git a/utils/bincnv/.gitignore b/utils/bincnv/.gitignore new file mode 100644 index 00000000..4aaffc82 --- /dev/null +++ b/utils/bincnv/.gitignore @@ -0,0 +1 @@ +bincnv diff --git a/utils/dcbumpgen/.gitignore b/utils/dcbumpgen/.gitignore new file mode 100644 index 00000000..ca123d7b --- /dev/null +++ b/utils/dcbumpgen/.gitignore @@ -0,0 +1 @@ +dcbumpgen diff --git a/utils/genromfs/.gitignore b/utils/genromfs/.gitignore new file mode 100644 index 00000000..14354858 --- /dev/null +++ b/utils/genromfs/.gitignore @@ -0,0 +1 @@ +genromfs diff --git a/utils/gentexfont/.gitignore b/utils/gentexfont/.gitignore new file mode 100644 index 00000000..c6f746a8 --- /dev/null +++ b/utils/gentexfont/.gitignore @@ -0,0 +1 @@ +gentexfont diff --git a/utils/isotest/.gitignore b/utils/isotest/.gitignore new file mode 100644 index 00000000..4c1c51d5 --- /dev/null +++ b/utils/isotest/.gitignore @@ -0,0 +1 @@ +isotest diff --git a/utils/kmgenc/.gitignore b/utils/kmgenc/.gitignore new file mode 100644 index 00000000..f636b53b --- /dev/null +++ b/utils/kmgenc/.gitignore @@ -0,0 +1 @@ +kmgenc diff --git a/utils/makeip/.gitignore b/utils/makeip/.gitignore index 9da03220..b1fc47b3 100644 --- a/utils/makeip/.gitignore +++ b/utils/makeip/.gitignore @@ -2,6 +2,7 @@ *.exe IP.BIN ip.bin +makeip src/makeip src/ip.txt src/*.mr diff --git a/utils/makejitter/.gitignore b/utils/makejitter/.gitignore new file mode 100644 index 00000000..f75c1c55 --- /dev/null +++ b/utils/makejitter/.gitignore @@ -0,0 +1 @@ +makejitter diff --git a/utils/naomibintool/.gitignore b/utils/naomibintool/.gitignore new file mode 100644 index 00000000..4c613ef1 --- /dev/null +++ b/utils/naomibintool/.gitignore @@ -0,0 +1 @@ +naomibintool diff --git a/utils/naominetboot/.gitignore b/utils/naominetboot/.gitignore new file mode 100644 index 00000000..0555999c --- /dev/null +++ b/utils/naominetboot/.gitignore @@ -0,0 +1 @@ +naominetboot diff --git a/utils/scramble/.gitignore b/utils/scramble/.gitignore new file mode 100644 index 00000000..b9279f2f --- /dev/null +++ b/utils/scramble/.gitignore @@ -0,0 +1 @@ +scramble diff --git a/utils/vqenc/.gitignore b/utils/vqenc/.gitignore new file mode 100644 index 00000000..867046ef --- /dev/null +++ b/utils/vqenc/.gitignore @@ -0,0 +1 @@ +vqenc diff --git a/utils/wav2adpcm/.gitignore b/utils/wav2adpcm/.gitignore new file mode 100644 index 00000000..735858b1 --- /dev/null +++ b/utils/wav2adpcm/.gitignore @@ -0,0 +1 @@ +wav2adpcm hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-05-21 16:36:52
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 5ac5dbae9c76ad4a239f3e0afb76d782dd5471df (commit) from 49e939a5c0fea9af48357bf250dba14db975fc8a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5ac5dbae9c76ad4a239f3e0afb76d782dd5471df Author: QuzarDC <qu...@co...> Date: Sun May 18 04:22:28 2025 -0400 `libkosext2fs`: Ensure buffer can store uint32s. As the malloc'd returned buffer is accessed as `uint32_t *` we should ensure that the size of it is a multiple of 4 otherwise we could read into unallocated memory. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/libkosext2fs/inode.c b/addons/libkosext2fs/inode.c index a8cb184f..64695b72 100644 --- a/addons/libkosext2fs/inode.c +++ b/addons/libkosext2fs/inode.c @@ -989,9 +989,11 @@ static ext2_dirent_t *search_indir_23(ext2_fs_t *fs, const uint32_t *iblock, uint32_t *buf; int i, block_ents; ext2_dirent_t *rv; + /* Ensure the buffer will hold uint32_ts */ + size_t bufsize = __align_up(block_size, sizeof(buf[0])); /* We're going to need this buffer... */ - if(!(buf = (uint32_t *)malloc(block_size))) { + if(!(buf = (uint32_t *)malloc(bufsize))) { *err = -ENOMEM; return NULL; } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-05-21 00:12:19
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 49e939a5c0fea9af48357bf250dba14db975fc8a (commit) via 2629afe3291d1bc1e065f0d559cdeace38a23692 (commit) from 7569b6ff7402754c7fa4bca9bc77f43b8005ba82 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 49e939a5c0fea9af48357bf250dba14db975fc8a Author: darc <da...@pr...> Date: Tue May 20 18:40:44 2025 -0500 Update __newlib_lock_acquire_recursive() - Remove unnecessary irq enable/disable from __newlib_lock_acquire_recursive() - Update __newlib_lock_acquire_recursive() to use thd_get_current() commit 2629afe3291d1bc1e065f0d559cdeace38a23692 Author: Falco Girgis <gyr...@gm...> Date: Tue Jan 9 06:51:52 2024 -0600 Implemented Newlib try_lock() functions - __newlib_lock_try_acquire() and __newlib_lock_try_acquire_recursive() were stubbed out to assert and abort due to not being implemented - Implemented both using the new spinlock_trylock() API - Also had to fix their prototypes, since they both should be returning an integer for whether the lock was successfully obtained ----------------------------------------------------------------------- Summary of changes: include/sys/lock.h | 4 +-- kernel/libc/newlib/lock_common.c | 58 +++++++++++++++++++++------------------- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/include/sys/lock.h b/include/sys/lock.h index 9b93a959..eec60041 100644 --- a/include/sys/lock.h +++ b/include/sys/lock.h @@ -52,13 +52,13 @@ typedef __newlib_recursive_lock_t _LOCK_RECURSIVE_T; void __newlib_lock_init(__newlib_lock_t*); void __newlib_lock_close(__newlib_lock_t*); void __newlib_lock_acquire(__newlib_lock_t*); -void __newlib_lock_try_acquire(__newlib_lock_t*); +int __newlib_lock_try_acquire(__newlib_lock_t*); void __newlib_lock_release(__newlib_lock_t*); void __newlib_lock_init_recursive(__newlib_recursive_lock_t*); void __newlib_lock_close_recursive(__newlib_recursive_lock_t*); void __newlib_lock_acquire_recursive(__newlib_recursive_lock_t*); -void __newlib_lock_try_acquire_recursive(__newlib_recursive_lock_t*); +int __newlib_lock_try_acquire_recursive(__newlib_recursive_lock_t*); void __newlib_lock_release_recursive(__newlib_recursive_lock_t*); /** \endcond */ diff --git a/kernel/libc/newlib/lock_common.c b/kernel/libc/newlib/lock_common.c index 2105e017..d9e35ccf 100644 --- a/kernel/libc/newlib/lock_common.c +++ b/kernel/libc/newlib/lock_common.c @@ -1,8 +1,9 @@ /* KallistiOS ##version## lock_common.c - Copyright (C)2004 Megan Potter - + Copyright (C) 2004 Megan Potter + Copyright (C) 2024 Falco Girgis + Copyright (C) 2025 Eric Fradella */ #include <assert.h> @@ -11,51 +12,40 @@ #include <kos/thread.h> #include <sys/lock.h> -void __newlib_lock_init(__newlib_lock_t * lock) { +void __newlib_lock_init(__newlib_lock_t *lock) { spinlock_init(lock); } -void __newlib_lock_close(__newlib_lock_t * lock) { +void __newlib_lock_close(__newlib_lock_t *lock) { (void)lock; } -void __newlib_lock_acquire(__newlib_lock_t * lock) { +void __newlib_lock_acquire(__newlib_lock_t *lock) { spinlock_lock(lock); } -void __newlib_lock_try_acquire(__newlib_lock_t * lock) { - (void)lock; - assert_msg(0, "We don't support try_acquire"); +int __newlib_lock_try_acquire(__newlib_lock_t *lock) { + return spinlock_trylock(lock); } -void __newlib_lock_release(__newlib_lock_t * lock) { +void __newlib_lock_release(__newlib_lock_t *lock) { spinlock_unlock(lock); } -void __newlib_lock_init_recursive(__newlib_recursive_lock_t * lock) { +void __newlib_lock_init_recursive(__newlib_recursive_lock_t *lock) { lock->owner = NULL; lock->nest = 0; spinlock_init(&lock->lock); } -void __newlib_lock_close_recursive(__newlib_recursive_lock_t * lock) { +void __newlib_lock_close_recursive(__newlib_recursive_lock_t *lock) { /* Empty */ (void)lock; } -void __newlib_lock_acquire_recursive(__newlib_recursive_lock_t * lock) { - int old; - int iscur; - - // Check to see if we already own it. If so, everything is clear - // to incr nest. Otherwise, we can safely go on to do a normal - // spinlock wait. - old = irq_disable(); - iscur = lock->owner == thd_current; - irq_restore(old); - - if(iscur) { +void __newlib_lock_acquire_recursive(__newlib_recursive_lock_t *lock) { + if(lock->owner == thd_get_current()) { lock->nest++; return; } @@ -64,16 +54,28 @@ void __newlib_lock_acquire_recursive(__newlib_recursive_lock_t * lock) { spinlock_lock(&lock->lock); // We own it now, so it's safe to init the rest of this. - lock->owner = thd_current; + lock->owner = thd_get_current(); lock->nest = 1; } -void __newlib_lock_try_acquire_recursive(__newlib_recursive_lock_t * lock) { - (void)lock; - assert_msg(0, "We don't support try_acquire"); +/* Similar to __newlib_lock_acquire_recursive(), except that it can + fail to obtain the lock. */ +int __newlib_lock_try_acquire_recursive(__newlib_recursive_lock_t *lock) { + if(lock->owner == thd_get_current()) { + lock->nest++; + return 1; + } + + if(spinlock_trylock(&lock->lock)) { + lock->owner = thd_get_current(); + lock->nest = 1; + return 1; + } + + return 0; } -void __newlib_lock_release_recursive(__newlib_recursive_lock_t * lock) { +void __newlib_lock_release_recursive(__newlib_recursive_lock_t *lock) { // Check to see how much we own it. if(lock->nest == 1) { lock->owner = NULL; hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-05-20 20:14:58
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 7569b6ff7402754c7fa4bca9bc77f43b8005ba82 (commit) from b45535a7cee6f8164165d29ff95a6c0ec40c8de6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7569b6ff7402754c7fa4bca9bc77f43b8005ba82 Author: QuzarDC <qu...@co...> Date: Tue May 20 15:49:52 2025 -0400 Fix missing include in speedtest. Add dbglog.h after removal from stdio in #1000 ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/filesystem/sd/speedtest/sd-speedtest.c | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/dreamcast/filesystem/sd/speedtest/sd-speedtest.c b/examples/dreamcast/filesystem/sd/speedtest/sd-speedtest.c index 76422c15..f2489049 100644 --- a/examples/dreamcast/filesystem/sd/speedtest/sd-speedtest.c +++ b/examples/dreamcast/filesystem/sd/speedtest/sd-speedtest.c @@ -25,6 +25,7 @@ #include <kos/init.h> #include <kos/dbgio.h> +#include <kos/dbglog.h> #include <kos/blockdev.h> KOS_INIT_FLAGS(INIT_DEFAULT); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-05-20 20:14:44
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via b45535a7cee6f8164165d29ff95a6c0ec40c8de6 (commit) from 7cd49f8777ae38a8dc533f751c0fa3b51f7c1c47 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b45535a7cee6f8164165d29ff95a6c0ec40c8de6 Author: QuzarDC <qu...@co...> Date: Sat May 17 18:14:31 2025 -0400 mrbtris: Fix incompatible type error `read_buttons` had no params (not even `void`) and gcc finally sees that this is a problem. Added anonymous `void *` to match `thd_create`. ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/mruby/mrbtris/dckos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/dreamcast/mruby/mrbtris/dckos.c b/examples/dreamcast/mruby/mrbtris/dckos.c index b8b23ffd..894fd2ed 100644 --- a/examples/dreamcast/mruby/mrbtris/dckos.c +++ b/examples/dreamcast/mruby/mrbtris/dckos.c @@ -52,7 +52,7 @@ struct InputBuf { static mrb_value btn_mrb_buffer; // buf has to be BUFSIZE elements at least -void *read_buttons() { +void *read_buttons(void*) { while(1) { input_buf.index = (input_buf.index + 1) % BUFSIZE; //printf("index: %" PRIu32 "\n", buf_index); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-05-20 19:17:39
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 7cd49f8777ae38a8dc533f751c0fa3b51f7c1c47 (commit) via d1db6cdd7e6abcf86bb0442ee0bc846ca4f906e8 (commit) from 738e494979dc3fff0d7f8e406f5b6a34712038b4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7cd49f8777ae38a8dc533f751c0fa3b51f7c1c47 Author: QuzarDC <qu...@co...> Date: Mon May 12 03:17:22 2025 -0400 Remove kos/dbglog.h from sys/stdio.h This was exposing a lot of stuff for no reason. Helps towards #840 to avoid having internal types spill out. Have replaced the inclusion with the two includes dbglog was exposing prior to #995, which should also help with reducing the impact to kos-ports. commit d1db6cdd7e6abcf86bb0442ee0bc846ca4f906e8 Author: QuzarDC <qu...@co...> Date: Mon May 12 02:05:47 2025 -0400 Add explicit includes of <kos/dbglog.h> All of these were adding it implicitly via stdio.h. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/ext2internal.h | 14 ++++++++------ addons/libkosfat/fatinternal.h | 16 +++++++++------- addons/libnavi/navi_flash.c | 1 + addons/libnavi/navi_ide.c | 1 + include/sys/stdio.h | 6 ++++-- kernel/arch/dreamcast/fs/fs_dcload.c | 1 + kernel/arch/dreamcast/fs/fs_iso9660.c | 1 + kernel/arch/dreamcast/fs/fs_vmu.c | 1 + kernel/arch/dreamcast/fs/vmufs.c | 1 + kernel/arch/dreamcast/hardware/flashrom.c | 1 + kernel/arch/dreamcast/hardware/g2dma.c | 1 + .../arch/dreamcast/hardware/maple/maple_init_shutdown.c | 1 + kernel/arch/dreamcast/hardware/maple/maple_utils.c | 1 + kernel/arch/dreamcast/hardware/maple/sip.c | 1 + kernel/arch/dreamcast/hardware/maple/vmu.c | 1 + .../arch/dreamcast/hardware/network/broadband_adapter.c | 1 + kernel/arch/dreamcast/hardware/network/lan_adapter.c | 1 + kernel/arch/dreamcast/hardware/pvr/pvr_dma.c | 1 + kernel/arch/dreamcast/hardware/pvr/pvr_fog.c | 2 ++ kernel/arch/dreamcast/hardware/pvr/pvr_init_shutdown.c | 1 + kernel/arch/dreamcast/hardware/pvr/pvr_mem_core.c | 1 + kernel/arch/dreamcast/hardware/pvr/pvr_scene.c | 1 + kernel/arch/dreamcast/hardware/video.c | 1 + kernel/arch/dreamcast/kernel/init.c | 1 + kernel/arch/dreamcast/kernel/irq.c | 1 + kernel/arch/dreamcast/kernel/mm.c | 1 + kernel/arch/dreamcast/sound/snd_iface.c | 1 + kernel/arch/dreamcast/sound/snd_mem.c | 1 + kernel/arch/dreamcast/sound/snd_sfxmgr.c | 1 + kernel/arch/dreamcast/sound/snd_stream.c | 1 + kernel/arch/dreamcast/util/screenshot.c | 1 + kernel/arch/dreamcast/util/vmu_pkg.c | 1 + kernel/fs/elf.c | 1 + kernel/fs/fs.c | 1 + kernel/fs/fs_dev.c | 1 + kernel/fs/fs_random.c | 1 + kernel/fs/fs_romdisk.c | 1 + kernel/libc/koslib/assert.c | 2 ++ kernel/libc/koslib/malloc.c | 1 + kernel/net/net_arp.c | 1 + kernel/net/net_core.c | 1 + kernel/net/net_icmp.c | 1 + kernel/net/net_icmp6.c | 1 + kernel/thread/genwait.c | 1 + kernel/thread/rwsem.c | 1 + kernel/thread/sem.c | 1 + kernel/thread/thread.c | 1 + 47 files changed, 67 insertions(+), 15 deletions(-) diff --git a/addons/libkosext2fs/ext2internal.h b/addons/libkosext2fs/ext2internal.h index 20808cdb..55ffd87f 100644 --- a/addons/libkosext2fs/ext2internal.h +++ b/addons/libkosext2fs/ext2internal.h @@ -45,13 +45,15 @@ struct ext2fs_struct { #define EXT2_FS_FLAG_SB_DIRTY 1 #ifdef EXT2_NOT_IN_KOS -#include <stdio.h> -#define DBG_DEBUG 0 -#define DBG_KDEBUG 0 -#define DBG_WARNING 0 -#define DBG_ERROR 0 + #include <stdio.h> + #define DBG_DEBUG 0 + #define DBG_KDEBUG 0 + #define DBG_WARNING 0 + #define DBG_ERROR 0 -#define dbglog(lvl, ...) printf(__VA_ARGS__) + #define dbglog(lvl, ...) printf(__VA_ARGS__) +#else + #include <kos/dbglog.h> #endif #endif /* !__EXT2_EXT2INTERNAL_H */ diff --git a/addons/libkosfat/fatinternal.h b/addons/libkosfat/fatinternal.h index 9ff7abcf..b35b0c7b 100644 --- a/addons/libkosfat/fatinternal.h +++ b/addons/libkosfat/fatinternal.h @@ -39,13 +39,15 @@ struct fatfs_struct { #define FAT_FS_FLAG_SB_DIRTY 1 #ifdef FAT_NOT_IN_KOS -#include <stdio.h> -#define DBG_DEBUG 0 -#define DBG_KDEBUG 0 -#define DBG_WARNING 0 -#define DBG_ERROR 0 - -#define dbglog(lvl, ...) printf(__VA_ARGS__) + #include <stdio.h> + #define DBG_DEBUG 0 + #define DBG_KDEBUG 0 + #define DBG_WARNING 0 + #define DBG_ERROR 0 + + #define dbglog(lvl, ...) printf(__VA_ARGS__) +#else + #include <kos/dbglog.h> #endif #endif /* !__FAT_FATINTERNAL_H */ diff --git a/addons/libnavi/navi_flash.c b/addons/libnavi/navi_flash.c index dd00a72c..69934137 100644 --- a/addons/libnavi/navi_flash.c +++ b/addons/libnavi/navi_flash.c @@ -9,6 +9,7 @@ #include <assert.h> #include <stdio.h> #include <navi/flash.h> +#include <kos/dbglog.h> #include <kos/thread.h> /* diff --git a/addons/libnavi/navi_ide.c b/addons/libnavi/navi_ide.c index fff802e9..4e1185ca 100644 --- a/addons/libnavi/navi_ide.c +++ b/addons/libnavi/navi_ide.c @@ -10,6 +10,7 @@ #include <stdio.h> #include <navi/ide.h> #include <dc/g2bus.h> +#include <kos/dbglog.h> #include <kos/thread.h> /* diff --git a/include/sys/stdio.h b/include/sys/stdio.h index effd05b8..c186d86c 100644 --- a/include/sys/stdio.h +++ b/include/sys/stdio.h @@ -26,7 +26,9 @@ # define _funlockfile(fp) #endif -// Added for old KOS source compatibility -#include <kos/dbglog.h> +/* Keep compat with old dbglog.h inclusion */ +#include <unistd.h> +#include <stdarg.h> +#include <kos/fs.h> #endif /* _NEWLIB_STDIO_H */ diff --git a/kernel/arch/dreamcast/fs/fs_dcload.c b/kernel/arch/dreamcast/fs/fs_dcload.c index 81a00ac0..93e7ca5e 100644 --- a/kernel/arch/dreamcast/fs/fs_dcload.c +++ b/kernel/arch/dreamcast/fs/fs_dcload.c @@ -22,6 +22,7 @@ printf goes to the dc-tool console #include <dc/fs_dcload.h> #include <arch/spinlock.h> #include <kos/dbgio.h> +#include <kos/dbglog.h> #include <kos/fs.h> #include <kos/init.h> diff --git a/kernel/arch/dreamcast/fs/fs_iso9660.c b/kernel/arch/dreamcast/fs/fs_iso9660.c index 0246c77f..e0f8b435 100644 --- a/kernel/arch/dreamcast/fs/fs_iso9660.c +++ b/kernel/arch/dreamcast/fs/fs_iso9660.c @@ -36,6 +36,7 @@ ISO9660 systems, as these were used as references as well. #include <kos/mutex.h> #include <kos/fs.h> #include <kos/opts.h> +#include <kos/dbglog.h> #include <stdlib.h> #include <stdio.h> diff --git a/kernel/arch/dreamcast/fs/fs_vmu.c b/kernel/arch/dreamcast/fs/fs_vmu.c index 060df026..f79cd7b8 100644 --- a/kernel/arch/dreamcast/fs/fs_vmu.c +++ b/kernel/arch/dreamcast/fs/fs_vmu.c @@ -15,6 +15,7 @@ #include <arch/types.h> #include <kos/mutex.h> +#include <kos/dbglog.h> #include <dc/fs_vmu.h> #include <dc/vmufs.h> #include <dc/maple.h> diff --git a/kernel/arch/dreamcast/fs/vmufs.c b/kernel/arch/dreamcast/fs/vmufs.c index 67e8a27c..726c223f 100644 --- a/kernel/arch/dreamcast/fs/vmufs.c +++ b/kernel/arch/dreamcast/fs/vmufs.c @@ -10,6 +10,7 @@ #include <string.h> #include <time.h> +#include <kos/dbglog.h> #include <kos/mutex.h> #include <dc/vmufs.h> #include <dc/maple.h> diff --git a/kernel/arch/dreamcast/hardware/flashrom.c b/kernel/arch/dreamcast/hardware/flashrom.c index d2c3b9b5..764e4327 100644 --- a/kernel/arch/dreamcast/hardware/flashrom.c +++ b/kernel/arch/dreamcast/hardware/flashrom.c @@ -19,6 +19,7 @@ #include <stdlib.h> #include <dc/flashrom.h> #include <dc/syscalls.h> +#include <kos/dbglog.h> #include <arch/irq.h> static void strcpy_no_term(char *dest, const char *src, size_t destsize) { diff --git a/kernel/arch/dreamcast/hardware/g2dma.c b/kernel/arch/dreamcast/hardware/g2dma.c index d618a4b4..ed37533d 100644 --- a/kernel/arch/dreamcast/hardware/g2dma.c +++ b/kernel/arch/dreamcast/hardware/g2dma.c @@ -11,6 +11,7 @@ #include <errno.h> #include <dc/asic.h> #include <dc/g2bus.h> +#include <kos/dbglog.h> #include <kos/sem.h> #include <kos/thread.h> diff --git a/kernel/arch/dreamcast/hardware/maple/maple_init_shutdown.c b/kernel/arch/dreamcast/hardware/maple/maple_init_shutdown.c index dd1e9e8c..524aca63 100644 --- a/kernel/arch/dreamcast/hardware/maple/maple_init_shutdown.c +++ b/kernel/arch/dreamcast/hardware/maple/maple_init_shutdown.c @@ -14,6 +14,7 @@ #include <dc/vblank.h> #include <kos/thread.h> #include <kos/init.h> +#include <kos/dbglog.h> #include <dc/maple/controller.h> #include <dc/maple/keyboard.h> diff --git a/kernel/arch/dreamcast/hardware/maple/maple_utils.c b/kernel/arch/dreamcast/hardware/maple/maple_utils.c index c12db5c6..b1a58570 100644 --- a/kernel/arch/dreamcast/hardware/maple/maple_utils.c +++ b/kernel/arch/dreamcast/hardware/maple/maple_utils.c @@ -10,6 +10,7 @@ #include <string.h> #include <arch/memory.h> #include <dc/maple.h> +#include <kos/dbglog.h> /* Enable / Disable the bus */ void maple_bus_enable(void) { diff --git a/kernel/arch/dreamcast/hardware/maple/sip.c b/kernel/arch/dreamcast/hardware/maple/sip.c index f51cc9ee..7dfb2189 100644 --- a/kernel/arch/dreamcast/hardware/maple/sip.c +++ b/kernel/arch/dreamcast/hardware/maple/sip.c @@ -9,6 +9,7 @@ #include <string.h> #include <stdlib.h> #include <arch/irq.h> +#include <kos/dbglog.h> #include <kos/genwait.h> #include <dc/maple.h> #include <dc/maple/sip.h> diff --git a/kernel/arch/dreamcast/hardware/maple/vmu.c b/kernel/arch/dreamcast/hardware/maple/vmu.c index 2a4fc304..f41a862d 100644 --- a/kernel/arch/dreamcast/hardware/maple/vmu.c +++ b/kernel/arch/dreamcast/hardware/maple/vmu.c @@ -19,6 +19,7 @@ #include <kos/thread.h> #include <kos/genwait.h> #include <kos/platform.h> +#include <kos/dbglog.h> #include <dc/maple.h> #include <dc/maple/vmu.h> #include <dc/math.h> diff --git a/kernel/arch/dreamcast/hardware/network/broadband_adapter.c b/kernel/arch/dreamcast/hardware/network/broadband_adapter.c index 36df6dad..9201a9d8 100644 --- a/kernel/arch/dreamcast/hardware/network/broadband_adapter.c +++ b/kernel/arch/dreamcast/hardware/network/broadband_adapter.c @@ -19,6 +19,7 @@ #include <arch/irq.h> #include <arch/cache.h> #include <arch/memory.h> +#include <kos/dbglog.h> #include <kos/net.h> #include <kos/thread.h> #include <kos/sem.h> diff --git a/kernel/arch/dreamcast/hardware/network/lan_adapter.c b/kernel/arch/dreamcast/hardware/network/lan_adapter.c index 37243343..1507179e 100644 --- a/kernel/arch/dreamcast/hardware/network/lan_adapter.c +++ b/kernel/arch/dreamcast/hardware/network/lan_adapter.c @@ -15,6 +15,7 @@ #include <dc/flashrom.h> #include <dc/net/lan_adapter.h> #include <arch/irq.h> +#include <kos/dbglog.h> #include <kos/net.h> #include <kos/thread.h> diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_dma.c b/kernel/arch/dreamcast/hardware/pvr/pvr_dma.c index 6f40f895..aeb28b39 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_dma.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_dma.c @@ -17,6 +17,7 @@ #include <dc/sq.h> #include <kos/thread.h> #include <kos/sem.h> +#include <kos/dbglog.h> #include "pvr_internal.h" diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_fog.c b/kernel/arch/dreamcast/hardware/pvr/pvr_fog.c index b7da92d3..a582da49 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_fog.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_fog.c @@ -8,6 +8,8 @@ #include <assert.h> #include <stdio.h> #include <dc/pvr.h> +#include <kos/dbglog.h> + #include "pvr_internal.h" #include "pvr_fog_tables.h" diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_init_shutdown.c b/kernel/arch/dreamcast/hardware/pvr/pvr_init_shutdown.c index c70758cf..41036b4a 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_init_shutdown.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_init_shutdown.c @@ -12,6 +12,7 @@ #include <dc/video.h> #include <dc/asic.h> #include <dc/vblank.h> +#include <kos/dbglog.h> #include "pvr_internal.h" /* diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_mem_core.c b/kernel/arch/dreamcast/hardware/pvr/pvr_mem_core.c index 65b573e1..dbed3407 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_mem_core.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_mem_core.c @@ -33,6 +33,7 @@ #include "pvr_mem_core.h" +#include <kos/dbglog.h> #include <kos/opts.h> #undef DEBUG diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_scene.c b/kernel/arch/dreamcast/hardware/pvr/pvr_scene.c index 74d8a3d1..eee57285 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_scene.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_scene.c @@ -10,6 +10,7 @@ #include <stdint.h> #include <stdio.h> #include <string.h> +#include <kos/dbglog.h> #include <kos/genwait.h> #include <kos/regfield.h> #include <kos/thread.h> diff --git a/kernel/arch/dreamcast/hardware/video.c b/kernel/arch/dreamcast/hardware/video.c index 62a2fe28..d54e2788 100644 --- a/kernel/arch/dreamcast/hardware/video.c +++ b/kernel/arch/dreamcast/hardware/video.c @@ -10,6 +10,7 @@ #include <dc/video.h> #include <dc/pvr.h> #include <dc/sq.h> +#include <kos/dbglog.h> #include <kos/platform.h> #include <string.h> #include <stdio.h> diff --git a/kernel/arch/dreamcast/kernel/init.c b/kernel/arch/dreamcast/kernel/init.c index c9f6ccfc..765f8850 100644 --- a/kernel/arch/dreamcast/kernel/init.c +++ b/kernel/arch/dreamcast/kernel/init.c @@ -11,6 +11,7 @@ #include <stdbool.h> #include <stdlib.h> #include <kos/dbgio.h> +#include <kos/dbglog.h> #include <kos/init.h> #include <kos/platform.h> #include <arch/arch.h> diff --git a/kernel/arch/dreamcast/kernel/irq.c b/kernel/arch/dreamcast/kernel/irq.c index f9b8a2a1..f74e984a 100644 --- a/kernel/arch/dreamcast/kernel/irq.c +++ b/kernel/arch/dreamcast/kernel/irq.c @@ -18,6 +18,7 @@ #include <arch/timer.h> #include <arch/stack.h> #include <kos/dbgio.h> +#include <kos/dbglog.h> #include <kos/thread.h> #include <kos/library.h> #include <kos/regfield.h> diff --git a/kernel/arch/dreamcast/kernel/mm.c b/kernel/arch/dreamcast/kernel/mm.c index cce8885b..37641fe0 100644 --- a/kernel/arch/dreamcast/kernel/mm.c +++ b/kernel/arch/dreamcast/kernel/mm.c @@ -17,6 +17,7 @@ #include <arch/types.h> #include <arch/arch.h> #include <arch/irq.h> +#include <kos/dbglog.h> #include <errno.h> #include <stdio.h> diff --git a/kernel/arch/dreamcast/sound/snd_iface.c b/kernel/arch/dreamcast/sound/snd_iface.c index ba57e0f8..c32787e6 100644 --- a/kernel/arch/dreamcast/sound/snd_iface.c +++ b/kernel/arch/dreamcast/sound/snd_iface.c @@ -12,6 +12,7 @@ #include <assert.h> #include <stdio.h> +#include <kos/dbglog.h> #include <kos/mutex.h> #include <arch/timer.h> #include <dc/g2bus.h> diff --git a/kernel/arch/dreamcast/sound/snd_mem.c b/kernel/arch/dreamcast/sound/snd_mem.c index a458817a..b477370c 100644 --- a/kernel/arch/dreamcast/sound/snd_mem.c +++ b/kernel/arch/dreamcast/sound/snd_mem.c @@ -14,6 +14,7 @@ #include <sys/queue.h> #include <dc/sound/sound.h> #include <arch/spinlock.h> +#include <kos/dbglog.h> /* diff --git a/kernel/arch/dreamcast/sound/snd_sfxmgr.c b/kernel/arch/dreamcast/sound/snd_sfxmgr.c index e09bfcbb..31f974a9 100644 --- a/kernel/arch/dreamcast/sound/snd_sfxmgr.c +++ b/kernel/arch/dreamcast/sound/snd_sfxmgr.c @@ -17,6 +17,7 @@ #include <sys/queue.h> #include <sys/ioctl.h> +#include <kos/dbglog.h> #include <kos/fs.h> #include <arch/irq.h> #include <dc/spu.h> diff --git a/kernel/arch/dreamcast/sound/snd_stream.c b/kernel/arch/dreamcast/sound/snd_stream.c index 87ebf169..9e11de86 100644 --- a/kernel/arch/dreamcast/sound/snd_stream.c +++ b/kernel/arch/dreamcast/sound/snd_stream.c @@ -17,6 +17,7 @@ #include <errno.h> #include <sys/queue.h> +#include <kos/dbglog.h> #include <kos/mutex.h> #include <arch/cache.h> #include <arch/timer.h> diff --git a/kernel/arch/dreamcast/util/screenshot.c b/kernel/arch/dreamcast/util/screenshot.c index 5e6de6d8..da3cc837 100644 --- a/kernel/arch/dreamcast/util/screenshot.c +++ b/kernel/arch/dreamcast/util/screenshot.c @@ -12,6 +12,7 @@ #include <stdlib.h> #include <string.h> #include <dc/video.h> +#include <kos/dbglog.h> #include <kos/fs.h> #include <arch/irq.h> diff --git a/kernel/arch/dreamcast/util/vmu_pkg.c b/kernel/arch/dreamcast/util/vmu_pkg.c index faba9589..1082146d 100644 --- a/kernel/arch/dreamcast/util/vmu_pkg.c +++ b/kernel/arch/dreamcast/util/vmu_pkg.c @@ -9,6 +9,7 @@ #include <stdio.h> #include <string.h> #include <dc/vmu_pkg.h> +#include <kos/dbglog.h> #include <kos/fs.h> #include <kos/regfield.h> diff --git a/kernel/fs/elf.c b/kernel/fs/elf.c index 1430a4c6..a267826f 100644 --- a/kernel/fs/elf.c +++ b/kernel/fs/elf.c @@ -15,6 +15,7 @@ #include <kos/exports.h> #include <kos/thread.h> #include <kos/library.h> +#include <kos/dbglog.h> /* What's our architecture code we're expecting? */ #if defined(_arch_dreamcast) diff --git a/kernel/fs/fs.c b/kernel/fs/fs.c index ce5ffef6..01f669dc 100644 --- a/kernel/fs/fs.c +++ b/kernel/fs/fs.c @@ -39,6 +39,7 @@ something like this: #include <kos/mutex.h> #include <kos/nmmgr.h> #include <kos/dbgio.h> +#include <kos/dbglog.h> /* File handle structure; this is an entirely internal structure so it does not go in a header file. */ diff --git a/kernel/fs/fs_dev.c b/kernel/fs/fs_dev.c index 919f000a..5ca09161 100644 --- a/kernel/fs/fs_dev.c +++ b/kernel/fs/fs_dev.c @@ -11,6 +11,7 @@ #include <errno.h> #include <arch/types.h> +#include <kos/dbglog.h> #include <kos/fs_dev.h> #include <sys/queue.h> diff --git a/kernel/fs/fs_random.c b/kernel/fs/fs_random.c index e8c3de4e..01f9edda 100644 --- a/kernel/fs/fs_random.c +++ b/kernel/fs/fs_random.c @@ -14,6 +14,7 @@ #include <arch/types.h> #include <kos/mutex.h> #include <kos/fs_random.h> +#include <kos/dbglog.h> ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: quzar <qu...@us...> - 2025-05-20 19:00:45
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "UNNAMED PROJECT". The branch, master has been updated via a8fdcfb92c1eb840da3569a1642621f48e259dbf (commit) via 4deffc189b3aa9fe30d6f314245b5751f6fdef12 (commit) via b115268896278cc44162114cd5bbed8aac1bf031 (commit) via fec75522499217277cdac76bbac80f73cc5913b2 (commit) from 1d75c9e421f3453cdbe16bf91a39366d5f0be972 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a8fdcfb92c1eb840da3569a1642621f48e259dbf Merge: 1d75c9e 4deffc1 Author: Donald Haase <qu...@ya...> Date: Tue May 20 14:27:21 2025 -0400 Merge pull request #3 from KallistiOS/missing_dbglog_fixes Missing dbglog fixes commit 4deffc189b3aa9fe30d6f314245b5751f6fdef12 Author: QuzarDC <qu...@co...> Date: Sun May 11 23:57:19 2025 -0400 Fix some minor type warnings. commit b115268896278cc44162114cd5bbed8aac1bf031 Author: QuzarDC <qu...@co...> Date: Sun May 11 23:45:53 2025 -0400 Correct usage of packed attribute. commit fec75522499217277cdac76bbac80f73cc5913b2 Author: QuzarDC <qu...@co...> Date: Sun May 11 23:44:53 2025 -0400 Fix missing dbglog include. It was previously being exported via stdio, now have to include it explicitly. ----------------------------------------------------------------------- Summary of changes: src/font.c | 44 +++++++++++++++++++++++--------------------- src/texture.c | 2 ++ 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/font.c b/src/font.c index 8cdde08..ccd8470 100644 --- a/src/font.c +++ b/src/font.c @@ -11,6 +11,8 @@ #include <string.h> #include <stdlib.h> #include <kos/fs.h> +#include <kos/dbglog.h> + #include "font.h" #include "prim.h" @@ -56,27 +58,27 @@ */ #define PACKED __attribute__((packed)) -typedef struct { - uint8 magic[4] PACKED; - uint32 endian PACKED; - uint32 format PACKED; - uint32 txr_width PACKED; - uint32 txr_height PACKED; - int32 max_ascent PACKED; - int32 max_descent PACKED; - uint32 glyph_cnt PACKED; +typedef struct PACKED { + char magic[4]; + uint32 endian; + uint32 format; + uint32 txr_width; + uint32 txr_height; + int32 max_ascent; + int32 max_descent; + uint32 glyph_cnt; } txfhdr_t; -typedef struct { - int16 idx PACKED; - int8 w PACKED; - int8 h PACKED; - int8 x_offset PACKED; - int8 y_offset PACKED; - int8 advance PACKED; - char padding PACKED; - uint16 x PACKED; - uint16 y PACKED; +typedef struct PACKED { + int16 idx; + int8 w; + int8 h; + int8 x_offset; + int8 y_offset; + int8 advance; + char padding; + uint16 x; + uint16 y; } txfglyph_t; /* This function DEFINITELY has function growth hormone inbalance syndrome, @@ -89,7 +91,7 @@ plx_font_t * plx_font_load(const char * fn) { int i, x, y; float xstep, ystep, w, h; uint8 * bmtmp = NULL; - uint32 bmsize; + ssize_t bmsize; uint16 * txrtmp = NULL; int stride; @@ -114,7 +116,7 @@ plx_font_t * plx_font_load(const char * fn) { goto fail_2; /* bail */ } - if (hdr.magic[0] != 0xff || strncmp("txf", hdr.magic+1, 3)) { + if ((uint8)hdr.magic[0] != 0xff || strncmp("txf", hdr.magic+1, 3)) { dbglog(DBG_WARNING, "plx_font_load: invalid font file '%s'\n", fn); goto fail_2; /* bail */ } diff --git a/src/texture.c b/src/texture.c index 59be19e..033c42a 100644 --- a/src/texture.c +++ b/src/texture.c @@ -10,6 +10,8 @@ #include <stdio.h> #include <string.h> #include <stdlib.h> +#include <kos/dbglog.h> + #include "texture.h" #include <png/png.h> #include <jpeg/jpeg.h> hooks/post-receive -- UNNAMED PROJECT |
From: quzar <qu...@us...> - 2025-05-20 18:59:11
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "UNNAMED PROJECT". The branch, master has been updated via 945bc70f652c0fca656cafe3a2723a14577e49e7 (commit) from a9469557bddda8bc37a77935b770dbcfb5dc4203 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 945bc70f652c0fca656cafe3a2723a14577e49e7 Author: QuzarDC <qu...@co...> Date: Mon May 12 01:22:52 2025 -0400 Explicitly include dbglog It was being implicitly included via stdio ----------------------------------------------------------------------- Summary of changes: src/sound.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound.cpp b/src/sound.cpp index 9b41395..d1fee93 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -9,6 +9,7 @@ #include "sound.h" #include <cassert> +#include <kos/dbglog.h> int Sound::m_default_vol = 240; hooks/post-receive -- UNNAMED PROJECT |
From: kosmirror <kos...@us...> - 2025-05-20 16:38:27
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 738e494979dc3fff0d7f8e406f5b6a34712038b4 (commit) from 47c712a850c37337babfe6004d2ac37483f8f29c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 738e494979dc3fff0d7f8e406f5b6a34712038b4 Author: QuzarDC <qu...@co...> Date: Sat May 17 19:11:17 2025 -0400 Clean up `pvr_init_params_t` usage in examples. As we've expanded the members of the struct, the new ones are each set to have 0 as the default behavior in order to be able to allow backwards compatibility in most cases. Catching all these up by filling in those implicit 0s with explicit ones as better demonstration of the params available and to clear up warnings as the compatibility behavior generates. ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/2ndmix/2ndmix.c | 5 ++++- examples/dreamcast/cpp/clock/clock.cc | 6 +++++- examples/dreamcast/cpp/dcplib/fnt_test.cc | 6 +++++- examples/dreamcast/gldc/benchmarks/quadmark/quadmark.c | 2 +- examples/dreamcast/gldc/benchmarks/trimark/trimark.c | 2 +- examples/dreamcast/gldc/benchmarks/tristripmark/tristripmark.c | 2 +- examples/dreamcast/kgl/basic/scissor/scissor.c | 5 ++++- examples/dreamcast/kgl/benchmarks/quadmark/quadmark.c | 2 +- examples/dreamcast/kgl/benchmarks/trimark/trimark.c | 2 +- examples/dreamcast/kgl/benchmarks/tristripmark/tristripmark.c | 2 +- examples/dreamcast/libdream/ta/ta.c | 2 +- examples/dreamcast/parallax/bubbles/bubbles.c | 5 ++++- examples/dreamcast/parallax/serpent_dma/serpent.c | 7 +++++-- examples/dreamcast/pvr/bumpmap/bump.c | 2 +- examples/dreamcast/pvr/cheap_shadow/shadow.c | 2 +- examples/dreamcast/pvr/modifier_volume/modifier.c | 2 +- examples/dreamcast/pvr/modifier_volume_tex/modifier.c | 2 +- examples/dreamcast/pvr/pvrline/pvrline.c | 2 +- examples/dreamcast/pvr/pvrmark/pvrmark.c | 2 +- examples/dreamcast/pvr/pvrmark_strips/pvrmark_strips.c | 2 +- .../dreamcast/pvr/pvrmark_strips_direct/pvrmark_strips_direct.c | 2 +- examples/dreamcast/pvr/texture_render/texture_render.c | 2 +- 22 files changed, 43 insertions(+), 23 deletions(-) diff --git a/examples/dreamcast/2ndmix/2ndmix.c b/examples/dreamcast/2ndmix/2ndmix.c index 4a4089a8..fb368646 100644 --- a/examples/dreamcast/2ndmix/2ndmix.c +++ b/examples/dreamcast/2ndmix/2ndmix.c @@ -823,7 +823,10 @@ pvr_init_params_t params = { { PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_0 }, /* Vertex buffer size 512K */ - 512 * 1024 + 512 * 1024, + + /* Defaults for the rest */ + 0, 0, 0, 0, 0 }; KOS_INIT_FLAGS(INIT_DEFAULT); diff --git a/examples/dreamcast/cpp/clock/clock.cc b/examples/dreamcast/cpp/clock/clock.cc index c403ca09..a5ce9287 100644 --- a/examples/dreamcast/cpp/clock/clock.cc +++ b/examples/dreamcast/cpp/clock/clock.cc @@ -145,7 +145,11 @@ int read_input() { } int main(int argc, char **argv) { - pvr_init_params_t pvrInit = { {PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_32, PVR_BINSIZE_0, PVR_BINSIZE_0}, 512 * 1024}; + pvr_init_params_t pvrInit = { + {PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_32, PVR_BINSIZE_0, PVR_BINSIZE_0}, + 512 * 1024, 0, 0, 0, 0, 0 + }; + pvr_init(&pvrInit); text = new fntRenderer(); diff --git a/examples/dreamcast/cpp/dcplib/fnt_test.cc b/examples/dreamcast/cpp/dcplib/fnt_test.cc index 320e3df4..2c9f714f 100644 --- a/examples/dreamcast/cpp/dcplib/fnt_test.cc +++ b/examples/dreamcast/cpp/dcplib/fnt_test.cc @@ -205,7 +205,11 @@ int read_input() { } int main(int argc, char **argv) { - pvr_init_params_t pvrInit = { {PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_32, PVR_BINSIZE_0, PVR_BINSIZE_0}, 512 * 1024}; + pvr_init_params_t pvrInit = { + {PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_32, PVR_BINSIZE_0, PVR_BINSIZE_0}, + 512 * 1024, 0, 0, 0, 0, 0 + }; + pvr_init(&pvrInit); text = new fntRenderer(); diff --git a/examples/dreamcast/gldc/benchmarks/quadmark/quadmark.c b/examples/dreamcast/gldc/benchmarks/quadmark/quadmark.c index 70dbc651..492470b8 100644 --- a/examples/dreamcast/gldc/benchmarks/quadmark/quadmark.c +++ b/examples/dreamcast/gldc/benchmarks/quadmark/quadmark.c @@ -16,7 +16,7 @@ pvr_init_params_t pvr_params = { { PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0 }, - 512 * 1024 + 512 * 1024, 0, 0, 0, 0, 0 }; enum { PHASE_HALVE, PHASE_INCR, PHASE_DECR, PHASE_FINAL }; diff --git a/examples/dreamcast/gldc/benchmarks/trimark/trimark.c b/examples/dreamcast/gldc/benchmarks/trimark/trimark.c index 83d6273e..39cb93b6 100644 --- a/examples/dreamcast/gldc/benchmarks/trimark/trimark.c +++ b/examples/dreamcast/gldc/benchmarks/trimark/trimark.c @@ -16,7 +16,7 @@ pvr_init_params_t pvr_params = { { PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0 }, - 512 * 1024 + 512 * 1024, 0, 0, 0, 0, 0 }; enum { PHASE_HALVE, PHASE_INCR, PHASE_DECR, PHASE_FINAL }; diff --git a/examples/dreamcast/gldc/benchmarks/tristripmark/tristripmark.c b/examples/dreamcast/gldc/benchmarks/tristripmark/tristripmark.c index aa4b9a0d..fd524d4f 100644 --- a/examples/dreamcast/gldc/benchmarks/tristripmark/tristripmark.c +++ b/examples/dreamcast/gldc/benchmarks/tristripmark/tristripmark.c @@ -16,7 +16,7 @@ pvr_init_params_t pvr_params = { { PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0 }, - 512 * 1024 + 512 * 1024, 0, 0, 0, 0, 0 }; enum { PHASE_HALVE, PHASE_INCR, PHASE_DECR, PHASE_FINAL }; diff --git a/examples/dreamcast/kgl/basic/scissor/scissor.c b/examples/dreamcast/kgl/basic/scissor/scissor.c index d69d33aa..9a6e05b3 100644 --- a/examples/dreamcast/kgl/basic/scissor/scissor.c +++ b/examples/dreamcast/kgl/basic/scissor/scissor.c @@ -209,7 +209,10 @@ pvr_init_params_t params = { { PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_0 }, /* Vertex buffer size 512K */ - 512 * 1024 + 512 * 1024, + + /* Defaults for the rest */ + 0, 0, 0, 0, 0 }; int main(int argc, char **argv) { diff --git a/examples/dreamcast/kgl/benchmarks/quadmark/quadmark.c b/examples/dreamcast/kgl/benchmarks/quadmark/quadmark.c index 5951d2b1..7c036316 100644 --- a/examples/dreamcast/kgl/benchmarks/quadmark/quadmark.c +++ b/examples/dreamcast/kgl/benchmarks/quadmark/quadmark.c @@ -16,7 +16,7 @@ pvr_init_params_t pvr_params = { { PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0 }, - 512 * 1024 + 512 * 1024, 0, 0, 0, 0, 0 }; enum { PHASE_HALVE, PHASE_INCR, PHASE_DECR, PHASE_FINAL }; diff --git a/examples/dreamcast/kgl/benchmarks/trimark/trimark.c b/examples/dreamcast/kgl/benchmarks/trimark/trimark.c index c4451b5c..a27d36ee 100644 --- a/examples/dreamcast/kgl/benchmarks/trimark/trimark.c +++ b/examples/dreamcast/kgl/benchmarks/trimark/trimark.c @@ -16,7 +16,7 @@ pvr_init_params_t pvr_params = { { PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0 }, - 512 * 1024 + 512 * 1024, 0, 0, 0, 0, 0 }; enum { PHASE_HALVE, PHASE_INCR, PHASE_DECR, PHASE_FINAL }; diff --git a/examples/dreamcast/kgl/benchmarks/tristripmark/tristripmark.c b/examples/dreamcast/kgl/benchmarks/tristripmark/tristripmark.c index 96f00f90..67aa529a 100644 --- a/examples/dreamcast/kgl/benchmarks/tristripmark/tristripmark.c +++ b/examples/dreamcast/kgl/benchmarks/tristripmark/tristripmark.c @@ -16,7 +16,7 @@ pvr_init_params_t pvr_params = { { PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0 }, - 512 * 1024 + 512 * 1024, 0, 0, 0, 0, 0 }; enum { PHASE_HALVE, PHASE_INCR, PHASE_DECR, PHASE_FINAL }; diff --git a/examples/dreamcast/libdream/ta/ta.c b/examples/dreamcast/libdream/ta/ta.c index 74600270..a08bd5fa 100644 --- a/examples/dreamcast/libdream/ta/ta.c +++ b/examples/dreamcast/libdream/ta/ta.c @@ -155,7 +155,7 @@ void draw_frame(void) { /* Main program: init and loop drawing polygons */ pvr_init_params_t pvr_params = { { PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0 }, - 64 * 1024 + 64 * 1024, 0, 0, 0, 0, 0 }; int main(int argc, char **argv) { pvr_init(&pvr_params); diff --git a/examples/dreamcast/parallax/bubbles/bubbles.c b/examples/dreamcast/parallax/bubbles/bubbles.c index 5e4c54d4..ab9c06be 100644 --- a/examples/dreamcast/parallax/bubbles/bubbles.c +++ b/examples/dreamcast/parallax/bubbles/bubbles.c @@ -249,7 +249,10 @@ pvr_init_params_t params = { 0, /* Extra OPBs */ - 3 + 3, + + /* Vertex buffer double-buffering enabled */ + 0 }; int main(int argc, char **argv) { diff --git a/examples/dreamcast/parallax/serpent_dma/serpent.c b/examples/dreamcast/parallax/serpent_dma/serpent.c index bdb51aa1..b83d713f 100644 --- a/examples/dreamcast/parallax/serpent_dma/serpent.c +++ b/examples/dreamcast/parallax/serpent_dma/serpent.c @@ -256,11 +256,14 @@ pvr_init_params_t params = { /* No FSAA */ 0, - /* Translucent Autosort enabled. */ + /* Translucent Autosort enabled */ 0, /* Extra OPBs */ - 3 + 3, + + /* Vertex buffer double-buffering enabled */ + 0 }; // DMA buffers. This should ideally be in separate memory banks to take diff --git a/examples/dreamcast/pvr/bumpmap/bump.c b/examples/dreamcast/pvr/bumpmap/bump.c index c33d669b..b0e107d3 100644 --- a/examples/dreamcast/pvr/bumpmap/bump.c +++ b/examples/dreamcast/pvr/bumpmap/bump.c @@ -207,7 +207,7 @@ static pvr_init_params_t pvr_params = { PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_16 }, - 512 * 1024 + 512 * 1024, 0, 0, 0, 0, 0 }; int main(int argc, char *argv[]) { diff --git a/examples/dreamcast/pvr/cheap_shadow/shadow.c b/examples/dreamcast/pvr/cheap_shadow/shadow.c index 349f5126..b98df10b 100644 --- a/examples/dreamcast/pvr/cheap_shadow/shadow.c +++ b/examples/dreamcast/pvr/cheap_shadow/shadow.c @@ -194,7 +194,7 @@ static pvr_init_params_t pvr_params = { PVR_BINSIZE_16, PVR_BINSIZE_16, PVR_BINSIZE_16, PVR_BINSIZE_16, PVR_BINSIZE_0 }, - 512 * 1024 + 512 * 1024, 0, 0, 0, 0, 0 }; int main(int argc, char *argv[]) { diff --git a/examples/dreamcast/pvr/modifier_volume/modifier.c b/examples/dreamcast/pvr/modifier_volume/modifier.c index e3c98f8f..e3f62cff 100644 --- a/examples/dreamcast/pvr/modifier_volume/modifier.c +++ b/examples/dreamcast/pvr/modifier_volume/modifier.c @@ -179,7 +179,7 @@ static pvr_init_params_t pvr_params = { PVR_BINSIZE_16, PVR_BINSIZE_16, PVR_BINSIZE_16, PVR_BINSIZE_16, PVR_BINSIZE_0 }, - 512 * 1024 + 512 * 1024, 0, 0, 0, 0, 0 }; int main(int argc, char *argv[]) { diff --git a/examples/dreamcast/pvr/modifier_volume_tex/modifier.c b/examples/dreamcast/pvr/modifier_volume_tex/modifier.c index b28800ca..3ce04a9b 100644 --- a/examples/dreamcast/pvr/modifier_volume_tex/modifier.c +++ b/examples/dreamcast/pvr/modifier_volume_tex/modifier.c @@ -230,7 +230,7 @@ static pvr_init_params_t pvr_params = { PVR_BINSIZE_16, PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0 }, - 512 * 1024 + 512 * 1024, 0, 0, 0, 0, 0 }; int main(int argc, char *argv[]) { diff --git a/examples/dreamcast/pvr/pvrline/pvrline.c b/examples/dreamcast/pvr/pvrline/pvrline.c index ee6632fb..e320a6b7 100644 --- a/examples/dreamcast/pvr/pvrline/pvrline.c +++ b/examples/dreamcast/pvr/pvrline/pvrline.c @@ -23,7 +23,7 @@ KOS_INIT_FLAGS(INIT_DEFAULT); /* enable OP and TR lists */ pvr_init_params_t pvr_params = { -{ PVR_BINSIZE_16, 0, PVR_BINSIZE_16, 0, 0 }, VERTBUF_SIZE, 1, 0, 0, 3 +{ PVR_BINSIZE_16, 0, PVR_BINSIZE_16, 0, 0 }, VERTBUF_SIZE, 1, 0, 0, 3, 0 }; uint8_t __attribute__((aligned(32))) op_buf[VERTBUF_SIZE]; diff --git a/examples/dreamcast/pvr/pvrmark/pvrmark.c b/examples/dreamcast/pvr/pvrmark/pvrmark.c index 8d0eccd6..d5f8c32a 100644 --- a/examples/dreamcast/pvr/pvrmark/pvrmark.c +++ b/examples/dreamcast/pvr/pvrmark/pvrmark.c @@ -10,7 +10,7 @@ pvr_init_params_t pvr_params = { { PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0 }, - 1024 * 1024 + 1024 * 1024, 0, 0, 0, 0, 0 }; enum { PHASE_HALVE, PHASE_INCR, PHASE_DECR, PHASE_FINAL }; diff --git a/examples/dreamcast/pvr/pvrmark_strips/pvrmark_strips.c b/examples/dreamcast/pvr/pvrmark_strips/pvrmark_strips.c index bcca11e8..d24d61d4 100644 --- a/examples/dreamcast/pvr/pvrmark_strips/pvrmark_strips.c +++ b/examples/dreamcast/pvr/pvrmark_strips/pvrmark_strips.c @@ -10,7 +10,7 @@ pvr_init_params_t pvr_params = { { PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0 }, - 512 * 1024 + 512 * 1024, 0, 0, 0, 0, 0 }; enum { PHASE_HALVE, PHASE_INCR, PHASE_DECR, PHASE_FINAL }; diff --git a/examples/dreamcast/pvr/pvrmark_strips_direct/pvrmark_strips_direct.c b/examples/dreamcast/pvr/pvrmark_strips_direct/pvrmark_strips_direct.c index 6f0bd3ad..46de7984 100644 --- a/examples/dreamcast/pvr/pvrmark_strips_direct/pvrmark_strips_direct.c +++ b/examples/dreamcast/pvr/pvrmark_strips_direct/pvrmark_strips_direct.c @@ -19,7 +19,7 @@ enum { PHASE_HALVE, PHASE_INCR, PHASE_DECR, PHASE_FINAL }; static pvr_init_params_t pvr_params = { { PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0 }, - 512 * 1024 + 512 * 1024, 0, 0, 0, 0, 0 }; static int polycnt; diff --git a/examples/dreamcast/pvr/texture_render/texture_render.c b/examples/dreamcast/pvr/texture_render/texture_render.c index b5aa600e..1be7d2ea 100644 --- a/examples/dreamcast/pvr/texture_render/texture_render.c +++ b/examples/dreamcast/pvr/texture_render/texture_render.c @@ -190,7 +190,7 @@ void draw_textured(void) { pvr_init_params_t pvr_params = { { PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0 }, - 64 * 1024 + 64 * 1024, 0, 0, 0, 0, 0 }; int main(int argc, char **argv) { hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-05-20 16:37:53
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 47c712a850c37337babfe6004d2ac37483f8f29c (commit) from 357ae137e9098d64eb6e6b874a92abf27548436a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 47c712a850c37337babfe6004d2ac37483f8f29c Author: QuzarDC <qu...@co...> Date: Sun May 18 00:05:25 2025 -0400 Fix use-after-free in `fs_close`. Seems this was added in #634 with the notion of clearing out the readdir index tracking on file close. The problem is that the only time it would apply is when there are 0 references, which means the file handle has already been freed based on the behavior of `fs_hnd_unref`. ----------------------------------------------------------------------- Summary of changes: kernel/fs/fs.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/kernel/fs/fs.c b/kernel/fs/fs.c index f7cb5c56..ce5ffef6 100644 --- a/kernel/fs/fs.c +++ b/kernel/fs/fs.c @@ -340,10 +340,6 @@ int fs_close(file_t fd) { /* Deref it and remove it from our table */ retval = fs_hnd_unref(h); - /* Reset our position */ - if(h->refcnt == 0) - h->idx = 0; - fd_table[fd] = NULL; return retval ? -1 : 0; } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-05-20 16:37:21
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 357ae137e9098d64eb6e6b874a92abf27548436a (commit) via 89020a2b80d908970fa70579b90a299382310892 (commit) from 25b74b464113b554ed9431d47f502beeaa14162d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 357ae137e9098d64eb6e6b874a92abf27548436a Author: QuzarDC <qu...@co...> Date: Sun May 18 00:34:55 2025 -0400 `fs_ramdisk`: Avoid OOM Check for NULL return from malloc in `ramdisk_get_parent`. commit 89020a2b80d908970fa70579b90a299382310892 Author: QuzarDC <qu...@co...> Date: Sun May 18 00:33:42 2025 -0400 `fs_ramdisk`: Switch to stdint types. ----------------------------------------------------------------------- Summary of changes: kernel/fs/fs_ramdisk.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/kernel/fs/fs_ramdisk.c b/kernel/fs/fs_ramdisk.c index 1fb7f738..181f7d20 100644 --- a/kernel/fs/fs_ramdisk.c +++ b/kernel/fs/fs_ramdisk.c @@ -36,10 +36,9 @@ cache data from disk rather than as a general purpose file system. #include <kos/fs_ramdisk.h> #include <kos/opts.h> -#include <arch/types.h> - #include <string.h> #include <strings.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <assert.h> @@ -55,7 +54,7 @@ char *strdup(const char *); /* File definition */ typedef struct rd_file { char * name; /* File name -- allocated */ - uint32 size; /* Actual file size */ + uint32_t size; /* Actual file size */ int type; /* File type */ int openfor; /* Lock constant */ int usage; /* Usage count (unopened is 0) */ @@ -70,7 +69,7 @@ typedef struct rd_file { which is defined below. datasize has no meaning for a directory. */ void * data; /* Data block pointer */ - uint32 datasize; /* Size of data block pointer */ + uint32_t datasize; /* Size of data block pointer */ LIST_ENTRY(rd_file) dirlist; /* Directory list entry */ } rd_file_t; @@ -95,7 +94,7 @@ static rd_dir_t *rootdir = NULL; static struct { rd_file_t *file; /* ramdisk file struct */ int dir; /* >0 if a directory */ - uint32 ptr; /* Current read position in bytes */ + uint32_t ptr; /* Current read position in bytes */ dirent_t dirent; /* A static dirent to pass back to clients */ int omode; /* Open mode */ } fh[FS_RAMDISK_MAX_FILES]; @@ -176,6 +175,10 @@ static int ramdisk_get_parent(rd_dir_t * parent, const char * fn, rd_dir_t ** do } else { pname = (char *)malloc((p - fn) + 1); + + if(!pname) + return -2; + strncpy(pname, fn, p - fn); pname[p - fn] = 0; @@ -334,7 +337,7 @@ static void * ramdisk_open(vfs_handler_t * vfs, const char *fn, int mode) { /* If we opened a dir, then ptr is actually a pointer to the first file entry. */ if(mode & O_DIR) { - fh[fd].ptr = (uint32)LIST_FIRST((rd_dir_t *)f->data); + fh[fd].ptr = (uint32_t)LIST_FIRST((rd_dir_t *)f->data); } /* Increase the usage count */ @@ -390,7 +393,7 @@ static ssize_t ramdisk_read(void * h, void *buf, size_t bytes) { bytes = fh[fd].file->size - fh[fd].ptr; /* Copy out the requested amount */ - memcpy(buf, ((uint8 *)fh[fd].file->data) + fh[fd].ptr, bytes); + memcpy(buf, ((uint8_t *)fh[fd].file->data) + fh[fd].ptr, bytes); fh[fd].ptr += bytes; rv = bytes; @@ -421,7 +424,7 @@ static ssize_t ramdisk_write(void * h, const void *buf, size_t bytes) { } /* Copy out the requested amount */ - memcpy(((uint8 *)fh[fd].file->data) + fh[fd].ptr, buf, bytes); + memcpy(((uint8_t *)fh[fd].file->data) + fh[fd].ptr, buf, bytes); fh[fd].ptr += bytes; if(fh[fd].file->size < fh[fd].ptr) { @@ -458,7 +461,7 @@ static off_t ramdisk_seek(void * h, off_t offset, int whence) { break; case SEEK_CUR: - if(offset < 0 && ((uint32)-offset) > fh[fd].ptr) { + if(offset < 0 && ((uint32_t)-offset) > fh[fd].ptr) { errno = EINVAL; return -1; } @@ -467,7 +470,7 @@ static off_t ramdisk_seek(void * h, off_t offset, int whence) { break; case SEEK_END: - if(offset < 0 && ((uint32)-offset) > fh[fd].file->size) { + if(offset < 0 && ((uint32_t)-offset) > fh[fd].file->size) { errno = EINVAL; return -1; } @@ -521,7 +524,7 @@ static dirent_t *ramdisk_readdir(void * h) { if(fd < FS_RAMDISK_MAX_FILES && fh[fd].file != NULL && fh[fd].ptr != 0 && fh[fd].dir) { /* Find the current file and advance to the next */ f = (rd_file_t *)fh[fd].ptr; - fh[fd].ptr = (uint32)LIST_NEXT(f, dirlist); + fh[fd].ptr = (uint32_t)LIST_NEXT(f, dirlist); /* Copy out the requested data */ strcpy(fh[fd].dirent.name, f->name); @@ -667,7 +670,7 @@ static int ramdisk_rewinddir(void * h) { } /* Rewind to the first file. */ - fh[fd].ptr = (uint32)LIST_FIRST((rd_dir_t *)fh[fd].file->data); + fh[fd].ptr = (uint32_t)LIST_FIRST((rd_dir_t *)fh[fd].file->data); return 0; } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-05-20 16:37:18
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 25b74b464113b554ed9431d47f502beeaa14162d (commit) via 2f27b6a2ddf182e085577124a8df0a05b7ec8ed3 (commit) from 4d828534c2a40828e141c2d8619ed4ac51b5fb1e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 25b74b464113b554ed9431d47f502beeaa14162d Author: QuzarDC <qu...@co...> Date: Mon May 19 22:03:33 2025 -0400 Remove custom type `ptr_t`. Was not being used in any `kos-port`, and previous commit removed uses in the main codebase. commit 2f27b6a2ddf182e085577124a8df0a05b7ec8ed3 Author: QuzarDC <qu...@co...> Date: Mon May 19 19:07:19 2025 -0400 Remove uses of internal `ptr_t` type in favor of stdint `uintptr_t`. Added includes where needed. Additionally removed the rest of the old type in genwait as it was such a small extra change. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/fs_ext2.c | 6 +++--- addons/libkosfat/fs_fat.c | 6 +++--- addons/libpthread/pthread_attr_setstack.c | 3 ++- include/kos/elf.h | 9 +++++---- include/kos/genwait.h | 5 +++-- kernel/arch/dreamcast/fs/fs_dcload.c | 5 +++-- kernel/arch/dreamcast/fs/fs_dclsocket.c | 3 ++- kernel/arch/dreamcast/fs/fs_vmu.c | 5 +++-- kernel/arch/dreamcast/hardware/pvr/pvr_scene.c | 3 ++- kernel/arch/dreamcast/include/arch/types.h | 3 --- kernel/fs/fs_romdisk.c | 7 ++++--- kernel/thread/genwait.c | 7 ++++--- kernel/thread/thread.c | 4 ++-- 13 files changed, 36 insertions(+), 30 deletions(-) diff --git a/addons/libkosext2fs/fs_ext2.c b/addons/libkosext2fs/fs_ext2.c index a3388a54..fa407b48 100644 --- a/addons/libkosext2fs/fs_ext2.c +++ b/addons/libkosext2fs/fs_ext2.c @@ -1703,7 +1703,7 @@ int fs_ext2_stat(vfs_handler_t *vfs, const char *path, struct stat *st, /* Root directory ext2 device */ if(len == 0 || (len == 1 && *path == '/')) { memset(st, 0, sizeof(struct stat)); - st->st_dev = (dev_t)((ptr_t)vfs); + st->st_dev = (dev_t)((uintptr_t)vfs); st->st_mode = S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH | S_IXUSR | S_IXGRP | S_IXOTH | S_IWUSR | S_IWGRP | S_IWOTH; st->st_size = -1; @@ -1723,7 +1723,7 @@ int fs_ext2_stat(vfs_handler_t *vfs, const char *path, struct stat *st, /* Fill in the structure */ memset(st, 0, sizeof(struct stat)); - st->st_dev = (dev_t)((ptr_t)vfs); + st->st_dev = (dev_t)((uintptr_t)vfs); st->st_ino = inode_num; st->st_mode = inode->i_mode & 0x0FFF; st->st_nlink = inode->i_links_count; @@ -1823,7 +1823,7 @@ static int fs_ext2_fstat(void *h, struct stat *st) { /* Fill in the structure */ memset(st, 0, sizeof(struct stat)); - st->st_dev = (dev_t)((ptr_t)fs->vfsh); + st->st_dev = (dev_t)((uintptr_t)fs->vfsh); st->st_ino = fh[fd].inode_num; st->st_mode = inode->i_mode & 0x0FFF; st->st_nlink = inode->i_links_count; diff --git a/addons/libkosfat/fs_fat.c b/addons/libkosfat/fs_fat.c index 636a7132..373bc3e2 100644 --- a/addons/libkosfat/fs_fat.c +++ b/addons/libkosfat/fs_fat.c @@ -1052,7 +1052,7 @@ static int fs_fat_stat(vfs_handler_t *vfs, const char *path, struct stat *st, /* Root directory fat device */ if(len == 0 || (len == 1 && *path == '/')) { memset(st, 0, sizeof(struct stat)); - st->st_dev = (dev_t)((ptr_t)fs->vfsh); + st->st_dev = (dev_t)((uintptr_t)fs->vfsh); st->st_mode = S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH | S_IXUSR | S_IXGRP | S_IXOTH | S_IWUSR | S_IWGRP | S_IWOTH; st->st_size = -1; @@ -1074,7 +1074,7 @@ static int fs_fat_stat(vfs_handler_t *vfs, const char *path, struct stat *st, /* Fill in the structure */ memset(st, 0, sizeof(struct stat)); irv = 0; - st->st_dev = (dev_t)((ptr_t)fs->vfsh); + st->st_dev = (dev_t)((uintptr_t)fs->vfsh); st->st_ino = ent.cluster_low | (ent.cluster_high << 16); st->st_nlink = 1; st->st_uid = 0; @@ -1266,7 +1266,7 @@ static int fs_fat_fstat(void *h, struct stat *buf) { /* Fill in the structure */ memset(buf, 0, sizeof(struct stat)); - buf->st_dev = (dev_t)((ptr_t)fs->vfsh); + buf->st_dev = (dev_t)((uintptr_t)fs->vfsh); buf->st_ino = ent->cluster_low | (ent->cluster_high << 16); buf->st_nlink = 1; buf->st_uid = 0; diff --git a/addons/libpthread/pthread_attr_setstack.c b/addons/libpthread/pthread_attr_setstack.c index 43087936..23d97bab 100644 --- a/addons/libpthread/pthread_attr_setstack.c +++ b/addons/libpthread/pthread_attr_setstack.c @@ -7,10 +7,11 @@ #include "pthread-internal.h" #include <pthread.h> #include <errno.h> +#include <stdint.h> int pthread_attr_setstack(pthread_attr_t *restrict attr, void *restrict stackaddr, size_t stacksize) { - ptr_t addr = (ptr_t)stackaddr; + uintptr_t addr = (uintptr_t)stackaddr; if(!attr) return EINVAL; diff --git a/include/kos/elf.h b/include/kos/elf.h index 635107cb..a9398f96 100644 --- a/include/kos/elf.h +++ b/include/kos/elf.h @@ -24,6 +24,7 @@ #include <sys/cdefs.h> __BEGIN_DECLS +#include <stdint.h> #include <arch/types.h> #include <sys/queue.h> @@ -306,10 +307,10 @@ typedef struct elf_prog { uint32 size; /**< \brief Memory image size (rounded up to page size) */ /* Library exports */ - ptr_t lib_get_name; /**< \brief Pointer to get_name() function */ - ptr_t lib_get_version; /**< \brief Pointer to get_version() function */ - ptr_t lib_open; /**< \brief Pointer to library's open function */ - ptr_t lib_close; /**< \brief Pointer to library's close function */ + uintptr_t lib_get_name; /**< \brief Pointer to get_name() function */ + uintptr_t lib_get_version; /**< \brief Pointer to get_version() function */ + uintptr_t lib_open; /**< \brief Pointer to library's open function */ + uintptr_t lib_close; /**< \brief Pointer to library's close function */ char fn[256]; /**< \brief Filename of library */ } elf_prog_t; diff --git a/include/kos/genwait.h b/include/kos/genwait.h index 14840d36..d2927f6a 100644 --- a/include/kos/genwait.h +++ b/include/kos/genwait.h @@ -27,6 +27,7 @@ __BEGIN_DECLS #include <kos/thread.h> +#include <stdint.h> /** \brief Sleep on an object. @@ -132,7 +133,7 @@ int genwait_wake_thd(void *obj, kthread_t *thd, int err); \param now The current system time, in milliseconds since boot */ -void genwait_check_timeouts(uint64 now); +void genwait_check_timeouts(uint64_t now); /** \brief Look for the next timeout event time. @@ -143,7 +144,7 @@ void genwait_check_timeouts(uint64 now); \return The next timeout time in milliseconds since boot, or 0 if there are no pending genwait_wait() calls */ -uint64 genwait_next_timeout(void); +uint64_t genwait_next_timeout(void); /** \cond */ /* Initialize the genwait system */ diff --git a/kernel/arch/dreamcast/fs/fs_dcload.c b/kernel/arch/dreamcast/fs/fs_dcload.c index ed5263c5..81a00ac0 100644 --- a/kernel/arch/dreamcast/fs/fs_dcload.c +++ b/kernel/arch/dreamcast/fs/fs_dcload.c @@ -26,6 +26,7 @@ printf goes to the dc-tool console #include <kos/init.h> #include <errno.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -351,7 +352,7 @@ static int dcload_stat(vfs_handler_t *vfs, const char *path, struct stat *st, /* Root directory '/pc' */ if(len == 0 || (len == 1 && *path == '/')) { memset(st, 0, sizeof(struct stat)); - st->st_dev = (dev_t)((ptr_t)vfs); + st->st_dev = (dev_t)((uintptr_t)vfs); st->st_mode = S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO; st->st_size = -1; st->st_nlink = 2; @@ -365,7 +366,7 @@ static int dcload_stat(vfs_handler_t *vfs, const char *path, struct stat *st, if(!retval) { memset(st, 0, sizeof(struct stat)); - st->st_dev = (dev_t)((ptr_t)vfs); + st->st_dev = (dev_t)((uintptr_t)vfs); st->st_ino = filestat.st_ino; st->st_mode = filestat.st_mode; st->st_nlink = filestat.st_nlink; diff --git a/kernel/arch/dreamcast/fs/fs_dclsocket.c b/kernel/arch/dreamcast/fs/fs_dclsocket.c index d2c49b03..aa9bb62f 100644 --- a/kernel/arch/dreamcast/fs/fs_dclsocket.c +++ b/kernel/arch/dreamcast/fs/fs_dclsocket.c @@ -24,6 +24,7 @@ #include <arpa/inet.h> #include <string.h> #include <stdlib.h> +#include <stdint.h> #include <unistd.h> #include <errno.h> #include <dirent.h> @@ -528,7 +529,7 @@ static int dcls_stat(vfs_handler_t *vfs, const char *fn, struct stat *rv, if(!retval) { memset(rv, 0, sizeof(struct stat)); - rv->st_dev = (dev_t)((ptr_t)vfs); + rv->st_dev = (dev_t)((uintptr_t)vfs); rv->st_ino = filestat.st_ino; rv->st_mode = filestat.st_mode; rv->st_nlink = filestat.st_nlink; diff --git a/kernel/arch/dreamcast/fs/fs_vmu.c b/kernel/arch/dreamcast/fs/fs_vmu.c index e28eb49b..060df026 100644 --- a/kernel/arch/dreamcast/fs/fs_vmu.c +++ b/kernel/arch/dreamcast/fs/fs_vmu.c @@ -6,6 +6,7 @@ */ +#include <stdint.h> #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -729,7 +730,7 @@ static int vmu_stat(vfs_handler_t *vfs, const char *path, struct stat *st, /* Get the number of free blocks */ memset(st, 0, sizeof(struct stat)); - st->st_dev = (dev_t)((ptr_t)dev); + st->st_dev = (dev_t)((uintptr_t)dev); st->st_mode = S_IFDIR | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; st->st_size = vmufs_free_blocks(dev); @@ -806,7 +807,7 @@ static int vmu_fstat(void *fd, struct stat *st) { fh = (vmu_fh_t *)fd; memset(st, 0, sizeof(struct stat)); - st->st_dev = (dev_t)((ptr_t)fh->dev); + st->st_dev = (dev_t)((uintptr_t)fh->dev); st->st_mode = S_IRWXU | S_IRWXG | S_IRWXO; st->st_mode |= (fh->strtype == VMU_DIR) ? S_IFDIR : S_IFREG; st->st_size = (fh->strtype == VMU_DIR) ? diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_scene.c b/kernel/arch/dreamcast/hardware/pvr/pvr_scene.c index 84a95dee..74d8a3d1 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_scene.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_scene.c @@ -7,6 +7,7 @@ */ #include <assert.h> +#include <stdint.h> #include <stdio.h> #include <string.h> #include <kos/genwait.h> @@ -39,7 +40,7 @@ void *pvr_set_vertbuf(pvr_list_t list, void *buffer, size_t len) { assert(pvr_state.lists_enabled & BIT(list)); // Make sure the buffer parameters are valid. - assert(!(((ptr_t)buffer) & 31)); + assert(!(((uintptr_t)buffer) & 31)); assert(!(len & 63)); // Save the old value. diff --git a/kernel/arch/dreamcast/include/arch/types.h b/kernel/arch/dreamcast/include/arch/types.h index 3f96f91a..fe22aaeb 100644 --- a/kernel/arch/dreamcast/include/arch/types.h +++ b/kernel/arch/dreamcast/include/arch/types.h @@ -48,9 +48,6 @@ typedef volatile int32 vint32; /**< \brief 32-bit volatile signed type */ typedef volatile int16 vint16; /**< \brief 16-bit volatile signed type */ typedef volatile int8 vint8; /**< \brief 8-bit volatile signed type */ -/* Pointer arithmetic types */ -typedef uint32 ptr_t; /**< \brief Pointer arithmetic type */ - /* This type may be used for any generic handle type that is allowed to be negative (for errors) and has no specific bit count restraints. */ diff --git a/kernel/fs/fs_romdisk.c b/kernel/fs/fs_romdisk.c index f127af2c..1dcebcdf 100644 --- a/kernel/fs/fs_romdisk.c +++ b/kernel/fs/fs_romdisk.c @@ -23,6 +23,7 @@ on sunsite.unc.edu in /pub/Linux/system/recovery/, or as a package under Debian #include <kos/opts.h> #include <stdlib.h> #include <stdbool.h> +#include <stdint.h> #include <string.h> #include <strings.h> #include <stdio.h> @@ -462,7 +463,7 @@ static int romdisk_stat(vfs_handler_t *vfs, const char *path, struct stat *st, /* Root directory of romdisk */ if(len == 0 || (len == 1 && *path == '/')) { memset(st, 0, sizeof(struct stat)); - st->st_dev = (dev_t)((ptr_t)mnt); + st->st_dev = (dev_t)((uintptr_t)mnt); st->st_mode = S_IFDIR | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; st->st_size = -1; @@ -488,7 +489,7 @@ static int romdisk_stat(vfs_handler_t *vfs, const char *path, struct stat *st, } memset(st, 0, sizeof(struct stat)); - st->st_dev = (dev_t)((ptr_t)mnt); + st->st_dev = (dev_t)((uintptr_t)mnt); st->st_mode = md | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; st->st_size = -1; st->st_nlink = 2; @@ -562,7 +563,7 @@ static int romdisk_fstat(void *h, struct stat *st) { } memset(st, 0, sizeof(struct stat)); - st->st_dev = (dev_t)((ptr_t)fh[fd].mnt); + st->st_dev = (dev_t)((uintptr_t)fh[fd].mnt); st->st_mode = S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; st->st_mode |= (fh[fd].dir) ? S_IFDIR : S_IFREG; st->st_size = fh[fd].size; diff --git a/kernel/thread/genwait.c b/kernel/thread/genwait.c index 2324b302..8bffee22 100644 --- a/kernel/thread/genwait.c +++ b/kernel/thread/genwait.c @@ -16,6 +16,7 @@ #include <string.h> #include <stdio.h> +#include <stdint.h> #include <assert.h> #include <errno.h> @@ -28,7 +29,7 @@ on to something. :) */ #define TABLESIZE 128 static TAILQ_HEAD(slpquehead, kthread) slpque[TABLESIZE]; -#define LOOKUP(x) (((ptr_t)(x) >> 8) & (TABLESIZE - 1)) +#define LOOKUP(x) (((uintptr_t)(x) >> 8) & (TABLESIZE - 1)) /* Timed event queue. Anything that isn't ready to run yet, but will be ready to run at a later time will be placed here. Note that this doesn't @@ -218,7 +219,7 @@ int genwait_wake_thd(void *obj, kthread_t *thd, int err) { return 0; } -void genwait_check_timeouts(uint64 tm) { +void genwait_check_timeouts(uint64_t tm) { kthread_t *t; t = tq_next(); @@ -245,7 +246,7 @@ void genwait_check_timeouts(uint64 tm) { } } -uint64 genwait_next_timeout(void) { +uint64_t genwait_next_timeout(void) { kthread_t * t; t = tq_next(); diff --git a/kernel/thread/thread.c b/kernel/thread/thread.c index 7e9f9cdb..1a97568b 100644 --- a/kernel/thread/thread.c +++ b/kernel/thread/thread.c @@ -7,10 +7,10 @@ Copyright (C) 2023, 2024 Falco Girgis */ -#include <stdlib.h> #include <assert.h> #include <string.h> #include <malloc.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <assert.h> @@ -591,7 +591,7 @@ static inline void thd_schedule_inner(kthread_t *thd) { /* Make sure the thread hasn't underrun its stack */ if(thd_current->stack && thd_current->stack_size) { - if(CONTEXT_SP(thd_current->context) < (ptr_t)(thd_current->stack)) { + if(CONTEXT_SP(thd_current->context) < (uintptr_t)(thd_current->stack)) { thd_pslist(printf); thd_pslist_queue(printf); assert_msg(0, "Thread stack underrun"); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-05-20 03:16:53
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 4d828534c2a40828e141c2d8619ed4ac51b5fb1e (commit) via b80a209710b18034e0e7df316ca949f348050e69 (commit) from 71a97d30c731858205ca9deaaee4bc36ec8db409 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4d828534c2a40828e141c2d8619ed4ac51b5fb1e Author: DC-SWAT <sw...@21...> Date: Mon May 12 11:55:45 2025 +0700 cdrom: Added streaming example. commit b80a209710b18034e0e7df316ca949f348050e69 Author: DC-SWAT <sw...@21...> Date: Mon May 12 11:55:37 2025 +0700 cdrom: Implemented PIO and DMA stream transfer support ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/cdrom/stream/Makefile | 29 +++ examples/dreamcast/cdrom/stream/cd-stream-test.c | 231 +++++++++++++++++++++++ kernel/arch/dreamcast/exports-pristine.txt | 5 + kernel/arch/dreamcast/hardware/cdrom.c | 224 ++++++++++++++++++++++ kernel/arch/dreamcast/include/dc/cdrom.h | 64 +++++++ 5 files changed, 553 insertions(+) create mode 100644 examples/dreamcast/cdrom/stream/Makefile create mode 100644 examples/dreamcast/cdrom/stream/cd-stream-test.c diff --git a/examples/dreamcast/cdrom/stream/Makefile b/examples/dreamcast/cdrom/stream/Makefile new file mode 100644 index 00000000..a32fe89b --- /dev/null +++ b/examples/dreamcast/cdrom/stream/Makefile @@ -0,0 +1,29 @@ +# KallistiOS ##version## +# +# examples/dreamcast/cd/stream/Makefile +# (c) 2025 Ruslan Rostovtsev +# + +TARGET = cd-stream-test +OBJS = $(TARGET).o + +all: rm-elf $(TARGET).elf + +include $(KOS_BASE)/Makefile.rules + +clean: rm-elf + -rm -f $(OBJS) + +rm-elf: + -rm -f $(TARGET).elf $(TARGET).bin + +$(TARGET).elf: $(OBJS) + kos-cc -o $(TARGET).elf $(OBJS) + +run: $(TARGET).elf + $(KOS_LOADER) $(TARGET).elf + +dist: $(TARGET).elf + -rm -f $(OBJS) + $(KOS_STRIP) $(TARGET).elf + $(KOS_OBJCOPY) -R .stack -O binary $(TARGET).elf $(TARGET).bin diff --git a/examples/dreamcast/cdrom/stream/cd-stream-test.c b/examples/dreamcast/cdrom/stream/cd-stream-test.c new file mode 100644 index 00000000..b3a2044d --- /dev/null +++ b/examples/dreamcast/cdrom/stream/cd-stream-test.c @@ -0,0 +1,231 @@ +/* KallistiOS ##version## + + cd-stream-test.c + Copyright (C) 2025 Ruslan Rostovtsev + + This example program simply shows how CD streams works. +*/ + +#include <stdio.h> +#include <errno.h> +#include <string.h> +#include <stdlib.h> +#include <stdint.h> +#include <errno.h> + +#include <dc/maple.h> +#include <dc/maple/controller.h> +#include <dc/cdrom.h> + +#include <arch/arch.h> +#include <arch/cache.h> + +#include <kos/init.h> +#include <kos/dbgio.h> +#include <kos/dbglog.h> + +#define BUFFER_SIZE (8 << 11) + +static uint8_t dma_buf[BUFFER_SIZE] __attribute__((aligned(32))); +static uint8_t pio_buf[BUFFER_SIZE] __attribute__((aligned(2))); + +static void __attribute__((__noreturn__)) wait_exit(void) { + maple_device_t *dev; + cont_state_t *state; + + printf("Press any button to exit.\n"); + + for(;;) { + dev = maple_enum_type(0, MAPLE_FUNC_CONTROLLER); + + if(dev) { + state = (cont_state_t *)maple_dev_status(dev); + + if(state) { + if(state->buttons) + arch_exit(); + } + } + } +} + +static void cd_stream_callback(void *param) { + (*(size_t *)param)++; +} + +static int cd_stream_test(uint32_t lba, uint8_t *buffer, size_t size, int mode) { + + int rs; + size_t cur_size = 0; + size_t cb_count = 0; + char *stream_name = (mode == CDROM_READ_PIO ? "PIO" : "DMA"); + + dbglog(DBG_DEBUG, "Start %s stream.\n", stream_name); + rs = cdrom_stream_start(lba, size / 2048, mode); + + if (rs != ERR_OK) { + dbglog(DBG_ERROR, "Failed to start stream for %s.\n", stream_name); + return -1; + } + + cdrom_stream_set_callback(cd_stream_callback, (void *)&cb_count); + rs = cdrom_stream_request(buffer, size / 2, 1); + + if (rs != ERR_OK) { + dbglog(DBG_ERROR, "Failed to request %s transfer.\n", stream_name); + return -1; + } + + rs = cdrom_stream_progress(&cur_size); + + if (rs != 0 || cur_size != (size / 2)) { + dbglog(DBG_ERROR, "Failed to check %s transfer: rs=%d sz=%d\n", + stream_name, rs, cur_size); + return -1; + } + + rs = cdrom_stream_request(buffer + (size / 2), size / 2, 1); + + if (rs != ERR_OK) { + dbglog(DBG_ERROR, "Failed to request %s transfer.\n", stream_name); + return -1; + } + + rs = cdrom_stream_progress(&cur_size); + + if (rs != 0 || cur_size != 0) { + dbglog(DBG_ERROR, "Failed to check %s transfer: rs=%d sz=%d\n", + stream_name, rs, cur_size); + return -1; + } + + rs = cdrom_stream_stop(false); + + if (rs != ERR_OK) { + dbglog(DBG_ERROR, "Failed to stop %s stream.\n", stream_name); + return -1; + } + + if (cb_count != 2) { + dbglog(DBG_ERROR, "%s transfer is done, but callback fails: %d\n", + stream_name, cb_count); + return -1; + } + + dbglog(DBG_DEBUG, "%s transfer is done.\n", stream_name); + return 0; +} + +int print_diff(uint8_t *pio_buf, uint8_t *dma_buf, size_t size) { + int i, j, rv = 0; + + for(i = 0; i < size; ++i) { + if (dma_buf[i] != pio_buf[i]) { + rv = i; + if (i >= 8) { + i -= 8; + } + break; + } + } + dbglog(DBG_INFO, "DMA[%d]: ", i); + + for(j = 0; j < 16; ++j) { + dbglog(DBG_INFO, "%02x", dma_buf[i + j]); + } + dbglog(DBG_INFO, "\nPIO[%d]: ", i); + + for(j = 0; j < 16; ++j) { + dbglog(DBG_INFO, "%02x", pio_buf[i + j]); + } + dbglog(DBG_INFO, "\n\n"); + return rv; +} + +int main(int argc, char *argv[]) { + int rs, i; + uint32_t lba; + CDROM_TOC toc; + + dbgio_dev_select("fb"); + dbglog(DBG_INFO, "CD-ROM stream test.\n\n"); + + rs = cdrom_read_toc(&toc, 0); + + if (rs != ERR_OK) { + dbglog(DBG_ERROR, "No disc present.\n"); + goto exit; + } + lba = cdrom_locate_data_track(&toc); + + if (lba == 0) { + dbglog(DBG_ERROR, "No data track on disc.\n"); + goto exit; + } + + memset(dma_buf, 0xff, BUFFER_SIZE); + /* Inside the cdrom driver the cache will be invalidated, + but we need to save what we wrote to it by memset. + In normal cases you don't need to do this. + */ + dcache_purge_range((uintptr_t)dma_buf, BUFFER_SIZE); + + rs = cd_stream_test(lba, dma_buf, BUFFER_SIZE, CDROM_READ_DMA); + + if (rs != ERR_OK) { + dbglog(DBG_ERROR, "DMA stream test failed.\n"); + goto exit; + } + + memset(pio_buf, 0xee, BUFFER_SIZE); + rs = cd_stream_test(lba, pio_buf, BUFFER_SIZE, CDROM_READ_PIO); + + if (rs != ERR_OK) { + dbglog(DBG_ERROR, "PIO stream test failed.\n"); + goto exit; + } + + if (memcmp(dma_buf, pio_buf, BUFFER_SIZE) == 0) { + dbglog(DBG_INFO, "Stream data matched.\n"); + goto exit; + } + + dbglog(DBG_ERROR, "Stream data mismatch:\n"); + i = print_diff(pio_buf, dma_buf, BUFFER_SIZE); + + if (dma_buf[i] == 0xff) { + dbglog(DBG_INFO, "Read DMA data.\n"); + memset(dma_buf, 0xff, BUFFER_SIZE); + /* Inside the cdrom driver the cache will be invalidated, + but we need to save what we wrote to it by memset. + In normal cases you don't need to do this. + */ + dcache_purge_range((uintptr_t)dma_buf, BUFFER_SIZE); + + rs = cdrom_read_sectors_ex(dma_buf, lba, + BUFFER_SIZE >> 11, CDROM_READ_DMA); + } + else { + dbglog(DBG_INFO, "Read PIO data.\n"); + memset(pio_buf, 0xee, BUFFER_SIZE); + rs = cdrom_read_sectors_ex(pio_buf, lba, + BUFFER_SIZE >> 11, CDROM_READ_PIO); + } + + if (rs != ERR_OK) { + dbglog(DBG_ERROR, "%s read sectors failed.\n", + dma_buf[i] == 0xff ? "DMA" : "PIO"); + } + else if (memcmp(dma_buf, pio_buf, BUFFER_SIZE)) { + dbglog(DBG_ERROR, "Stream and read data mismatch:\n"); + print_diff(pio_buf, dma_buf, BUFFER_SIZE); + } + else { + dbglog(DBG_INFO, "Stream and read data matched.\n"); + } + +exit: + dbglog(DBG_INFO, "\n"); + wait_exit(); + return 0; +} diff --git a/kernel/arch/dreamcast/exports-pristine.txt b/kernel/arch/dreamcast/exports-pristine.txt index 55479064..db35ee09 100644 --- a/kernel/arch/dreamcast/exports-pristine.txt +++ b/kernel/arch/dreamcast/exports-pristine.txt @@ -157,6 +157,11 @@ cdrom_get_subcode cdrom_read_toc cdrom_read_sectors cdrom_read_sectors_ex +cdrom_stream_start +cdrom_stream_stop +cdrom_stream_request +cdrom_stream_progress +cdrom_stream_set_callback cdrom_locate_data_track cdrom_cdda_play cdrom_cdda_pause diff --git a/kernel/arch/dreamcast/hardware/cdrom.c b/kernel/arch/dreamcast/hardware/cdrom.c index c60905ed..d76692e4 100644 --- a/kernel/arch/dreamcast/hardware/cdrom.c +++ b/kernel/arch/dreamcast/hardware/cdrom.c @@ -70,6 +70,12 @@ static semaphore_t dma_done = SEM_INITIALIZER(0); static asic_evt_handler_entry_t old_dma_irq = {NULL, NULL}; static int vblank_hnd = -1; +/* Streaming */ +static int stream_mode = -1; +static cdrom_stream_callback_t stream_cb = NULL; +static void *stream_cb_param = NULL; + +/* Initialization */ static bool inited = false; static int cur_sector_size = 2048; @@ -208,6 +214,11 @@ int cdrom_abort_cmd(uint32_t timeout, bool abort_dma) { } while(1); cmd_hnd = 0; + stream_mode = -1; + + if(stream_cb) { + cdrom_stream_set_callback(0, NULL); + } mutex_unlock(&_g1_ata_mutex); return rv; @@ -456,6 +467,216 @@ int cdrom_read_sectors(void *buffer, int sector, int cnt) { return cdrom_read_sectors_ex(buffer, sector, cnt, CDROM_READ_PIO); } +int cdrom_stream_start(int sector, int cnt, int mode) { + struct { + int sec; + int num; + } params; + int rv = ERR_SYS; + + params.sec = sector; + params.num = cnt; + + if(stream_mode != -1) { + cdrom_stream_stop(false); + } + stream_mode = mode; + + if(mode == CDROM_READ_DMA) { + rv = cdrom_exec_cmd_timed(CMD_DMAREAD_STREAM, ¶ms, 0); + } + else if(mode == CDROM_READ_PIO) { + rv = cdrom_exec_cmd_timed(CMD_PIOREAD_STREAM, ¶ms, 0); + } + + if(rv != ERR_OK) { + stream_mode = -1; + } + return rv; +} + +int cdrom_stream_stop(bool abort_dma) { + int rv = ERR_OK; + + if(cmd_hnd <= 0) { + return rv; + } + if(abort_dma && dma_in_progress) { + return cdrom_abort_cmd(1000, true); + } + mutex_lock(&_g1_ata_mutex); + + do { + syscall_gdrom_exec_server(); + cmd_response = syscall_gdrom_check_command(cmd_hnd, cmd_status); + + if(cmd_response < 0) { + rv = ERR_SYS; + break; + } + else if(cmd_response == COMPLETED || cmd_response == NO_ACTIVE) { + break; + } + else if(cmd_response == STREAMING) { + mutex_unlock(&_g1_ata_mutex); + return cdrom_abort_cmd(1000, false); + } + thd_pass(); + } while(1); + + cmd_hnd = 0; + stream_mode = -1; + mutex_unlock(&_g1_ata_mutex); + + if(stream_cb) { + cdrom_stream_set_callback(0, NULL); + } + return rv; +} + +int cdrom_stream_request(void *buffer, size_t size, bool block) { + int rs, rv = ERR_OK; + int32_t params[2]; + size_t check_size = -1; + + if(cmd_hnd <= 0) { + return ERR_NO_ACTIVE; + } + if(dma_in_progress) { + dbglog(DBG_ERROR, "cdrom_stream_request: Previous DMA request is in progress.\n"); + return ERR_SYS; + } + + if(stream_mode == CDROM_READ_DMA) { + params[0] = ((uintptr_t)buffer) & MEM_AREA_CACHE_MASK; + if(params[0] & 0x1f) { + dbglog(DBG_ERROR, "cdrom_stream_request: Unaligned memory for DMA (32-byte).\n"); + return ERR_SYS; + } + if((params[0] >> 24) == 0x0c) { + dcache_inval_range((uintptr_t)buffer, size); + } + } + else { + params[0] = (uintptr_t)buffer; + if(params[0] & 0x01) { + dbglog(DBG_ERROR, "cdrom_stream_request: Unaligned memory for PIO (2-byte).\n"); + return ERR_SYS; + } + } + + params[1] = size; + mutex_lock_scoped(&_g1_ata_mutex); + + if(stream_mode == CDROM_READ_DMA) { + + dma_in_progress = true; + dma_blocking = block; + + if(!block) { + dma_thd = thd_current; + if(irq_inside_int()) { + dma_thd = (kthread_t *)0xFFFFFFFF; + } + } + rs = syscall_gdrom_dma_transfer(cmd_hnd, params); + + if(rs < 0) { + dma_in_progress = false; + dma_blocking = false; + dma_thd = NULL; + return ERR_SYS; + } + if(!block) { + return rv; + } + sem_wait(&dma_done); + + do { + syscall_gdrom_exec_server(); + cmd_response = syscall_gdrom_check_command(cmd_hnd, cmd_status); + + if(cmd_response < 0) { + rv = ERR_SYS; + break; + } + else if(cmd_response == COMPLETED || cmd_response == NO_ACTIVE) { + cmd_hnd = 0; + break; + } + else if(syscall_gdrom_dma_check(cmd_hnd, &check_size) == 0) { + break; + } + thd_pass(); + + } while(1); + } + else if(stream_mode == CDROM_READ_PIO) { + + rs = syscall_gdrom_pio_transfer(cmd_hnd, params); + + if(rs < 0) { + return ERR_SYS; + } + do { + syscall_gdrom_exec_server(); + cmd_response = syscall_gdrom_check_command(cmd_hnd, cmd_status); + + if(cmd_response < 0) { + rv = ERR_SYS; + break; + } + else if(cmd_response == COMPLETED || cmd_response == NO_ACTIVE) { + cmd_hnd = 0; + break; + } + else if(syscall_gdrom_pio_check(cmd_hnd, &check_size) == 0) { + /* Syscalls doesn't call it on last reading in PIO mode. + Looks like a bug, fixing it. */ + if(check_size == 0 && stream_cb) { + stream_cb(stream_cb_param); + } + break; + } + thd_pass(); + } while(1); + } + + return rv; +} + +int cdrom_stream_progress(size_t *size) { + int rv = 0; + size_t check_size = 0; + ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-05-19 16:31:04
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 71a97d30c731858205ca9deaaee4bc36ec8db409 (commit) via 6717a0cf9ba2f87b655cb23cf2f5c9198d063d35 (commit) from 09b44b0d5e40e9302a71c9269e7df36c08377f1a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 71a97d30c731858205ca9deaaee4bc36ec8db409 Author: DC-SWAT <sw...@21...> Date: Mon May 19 09:50:07 2025 +0700 sci: Abort DMA on errors in SPI mode. Also minor log fixes. commit 6717a0cf9ba2f87b655cb23cf2f5c9198d063d35 Author: DC-SWAT <sw...@21...> Date: Mon May 19 09:46:36 2025 +0700 dmac: Added dma_is_running() and dma_transfer_abort() ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/hardware/dmac.c | 9 ++++++++- kernel/arch/dreamcast/hardware/sci.c | 13 +++++++------ kernel/arch/dreamcast/include/arch/dmac.h | 21 +++++++++++++++++++++ 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/kernel/arch/dreamcast/hardware/dmac.c b/kernel/arch/dreamcast/hardware/dmac.c index d486ee76..aec59034 100644 --- a/kernel/arch/dreamcast/hardware/dmac.c +++ b/kernel/arch/dreamcast/hardware/dmac.c @@ -108,7 +108,7 @@ static void dma_irq_handler(irq_t code, irq_context_t *context, void *d) { } } -static bool dma_is_running(dma_channel_t channel) { +bool dma_is_running(dma_channel_t channel) { uint32_t chcr = dmac_read(channel, DMA_REG_CHCR); return (chcr & (REG_CHCR_TRANSFER_END | REG_CHCR_DMAC_EN)) == REG_CHCR_DMAC_EN; @@ -166,3 +166,10 @@ size_t dma_transfer_get_remaining(dma_channel_t channel) { return tcr * dma_unit_size[unit_size]; } + +void dma_transfer_abort(dma_channel_t channel) { + irq_disable_scoped(); + + dmac_write(channel, DMA_REG_CHCR, 0); + genwait_wake_all((void *)&channels_cfg[channel]); +} diff --git a/kernel/arch/dreamcast/hardware/sci.c b/kernel/arch/dreamcast/hardware/sci.c index 4ce22bbf..40f6898f 100644 --- a/kernel/arch/dreamcast/hardware/sci.c +++ b/kernel/arch/dreamcast/hardware/sci.c @@ -1021,7 +1021,7 @@ sci_result_t sci_spi_read_data(uint8_t *rx_data, size_t len) { if(status & ORER) { SCSSR1 &= ~ORER; sci_set_transfer_mode(0); - dbglog(DBG_ERROR, "SCI: Overrun error\n"); + dbglog(DBG_ERROR, "SCI: Overrun error in SPI read data\n"); return SCI_ERR_OVERRUN; } } while(!(status & RDRF)); @@ -1082,7 +1082,7 @@ sci_result_t sci_spi_dma_write_data(const uint8_t *data, size_t len, dma_callbac while(!(SCSSR1 & TEND)) { if(++timeout_cnt > SCI_MAX_WAIT_CYCLES) { sci_set_transfer_mode(0); - dbglog(DBG_ERROR, "SCI: Timeout waiting for TEND in SPI read data\n"); + dbglog(DBG_ERROR, "SCI: Timeout waiting for TEND in SPI DMA write\n"); return SCI_ERR_TIMEOUT; } } @@ -1109,7 +1109,6 @@ sci_result_t sci_spi_dma_read_data(uint8_t *data, size_t len, dma_callback_t cal /* Configure DMA */ dma_config_t config = sci_dma_rx_config; - config.callback = callback; /* Prepare DMA */ dma_addr_t src = hw_to_dma_addr(SCRDR1_ADDR); @@ -1131,7 +1130,8 @@ sci_result_t sci_spi_dma_read_data(uint8_t *data, size_t len, dma_callback_t cal while(!(SCSSR1 & TDRE)) { if(++timeout_cnt > SCI_MAX_WAIT_CYCLES) { sci_set_transfer_mode(0); - dbglog(DBG_ERROR, "SCI: Timeout waiting for TDRE in SPI read data\n"); + dma_transfer_abort(sci_dma_rx_config.channel); + dbglog(DBG_ERROR, "SCI: Timeout waiting for TDRE in SPI DMA read\n"); return SCI_ERR_TIMEOUT; } } @@ -1149,7 +1149,8 @@ sci_result_t sci_spi_dma_read_data(uint8_t *data, size_t len, dma_callback_t cal while(!(SCSSR1 & TEND)) { if(++timeout_cnt > SCI_MAX_WAIT_CYCLES) { sci_set_transfer_mode(0); - dbglog(DBG_ERROR, "SCI: Timeout waiting for TEND in SPI read data\n"); + dma_transfer_abort(sci_dma_rx_config.channel); + dbglog(DBG_ERROR, "SCI: Timeout waiting for TEND in SPI DMA read\n"); return SCI_ERR_TIMEOUT; } } @@ -1173,6 +1174,6 @@ sci_result_t sci_spi_dma_read_data(uint8_t *data, size_t len, dma_callback_t cal } sci_result_t sci_dma_wait_complete(void) { - dma_wait_complete(DMA_CHANNEL_1); + dma_wait_complete(sci_dma_rx_config.channel); return check_sci_errors(); } diff --git a/kernel/arch/dreamcast/include/arch/dmac.h b/kernel/arch/dreamcast/include/arch/dmac.h index 7882add4..21b1530d 100644 --- a/kernel/arch/dreamcast/include/arch/dmac.h +++ b/kernel/arch/dreamcast/include/arch/dmac.h @@ -21,6 +21,7 @@ __BEGIN_DECLS #include <stdint.h> +#include <stdbool.h> /** \defgroup dmac DMA Controller API \brief API to use the SH4's DMA Controller @@ -227,6 +228,17 @@ int dma_transfer(const dma_config_t *cfg, dma_addr_t dst, dma_addr_t src, */ void dma_wait_complete(dma_channel_t channel); +/** \brief Check if a DMA transfer is running + \ingroup dmac + + This function will return true if a DMA transfer is running for the given + DMA channel. + + \param channel The DMA channel to check. + \return True if a DMA transfer is running, false otherwise. +*/ +bool dma_is_running(dma_channel_t channel); + /** \brief Get the remaining size of a DMA transfer \ingroup dmac @@ -239,6 +251,15 @@ void dma_wait_complete(dma_channel_t channel); */ size_t dma_transfer_get_remaining(dma_channel_t channel); +/** \brief Abort a DMA transfer + \ingroup dmac + + This function will abort a DMA transfer for the given DMA channel. + + \param channel The DMA channel to abort. +*/ +void dma_transfer_abort(dma_channel_t channel); + /** @} */ __END_DECLS hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-05-18 17:51:17
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 09b44b0d5e40e9302a71c9269e7df36c08377f1a (commit) from 9c5ee7e30560a4d03fa82547e4b365ee0db73e2a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 09b44b0d5e40e9302a71c9269e7df36c08377f1a Author: Zack Buhman <za...@bu...> Date: Sat May 17 16:14:49 2025 -0500 scif: disable MCE by default Enabling MCE is not a reasonable library default because the typical USB-UARTs that are connected to the Dreamcast have large ~1024 byte TX/RX buffers and the maximum Dreamcast SCIF baud rate is slow compared to the capabilities of these chips. Given the use-case for scif.c appears to be to allow for synchronously-blocking debug prints over scif, from a library/policy perspective MCE should be considered a "specialized" configuration. For KallistiOS users, the behavior prior to this commit was: - serial transmission may be silently permanently disabled due to the SCIF CTS pin being disconnected or tied high - it is not possible to use RTS/CTS as GPIO pins while also using scif.c ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/hardware/scif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/arch/dreamcast/hardware/scif.c b/kernel/arch/dreamcast/hardware/scif.c index 4ceab8ca..70b7254b 100644 --- a/kernel/arch/dreamcast/hardware/scif.c +++ b/kernel/arch/dreamcast/hardware/scif.c @@ -242,8 +242,8 @@ int scif_init(void) { for(i = 0; i < 800000; i++) __asm__("nop"); - /* Unreset, enable hardware flow control, triggers on 8 bytes */ - SCFCR2 = 0x48; + /* Unreset, disable hardware flow control, triggers on 8 bytes */ + SCFCR2 = 0x40; /* Disable manual pin control */ SCSPTR2 = 0; hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-05-16 23:52:16
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 9c5ee7e30560a4d03fa82547e4b365ee0db73e2a (commit) via acaf32f520a78901ebe8b6f16f65fb0a9820b54d (commit) via 582d1b668ee68d60ec816cefecd578c9fbd28bc2 (commit) via c615452e133aed38bdb7768a0fc5605a87b2c07d (commit) from ea4b4439718347a99c4e11bd2adb76cd11904bfd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9c5ee7e30560a4d03fa82547e4b365ee0db73e2a Author: DC-SWAT <sw...@21...> Date: Tue May 13 11:42:03 2025 +0700 sd: Added creation of a block device for the entire SD card. Also use DMA for writing if possible. commit acaf32f520a78901ebe8b6f16f65fb0a9820b54d Author: DC-SWAT <sw...@21...> Date: Sun May 11 01:57:12 2025 +0700 sd: Added exports for both Dreamcast and NAOMI. Also fix read data with size that not multiple by 32 and warning in SCI. commit 582d1b668ee68d60ec816cefecd578c9fbd28bc2 Author: DC-SWAT <sw...@21...> Date: Thu May 8 23:01:20 2025 +0700 sd: Enhance speed test functionality for both SD card interfaces. commit c615452e133aed38bdb7768a0fc5605a87b2c07d Author: DC-SWAT <sw...@21...> Date: Thu May 8 23:01:13 2025 +0700 sd: Refactor SD card interface to support SCI and SCIF. Added initialization parameters for CRC checking and interface selection. ----------------------------------------------------------------------- Summary of changes: .../filesystem/sd/speedtest/sd-speedtest.c | 70 +++-- kernel/arch/dreamcast/exports-naomi.txt | 10 + kernel/arch/dreamcast/exports-pristine.txt | 10 + kernel/arch/dreamcast/hardware/sd.c | 334 +++++++++++++++------ kernel/arch/dreamcast/include/dc/sd.h | 64 +++- 5 files changed, 369 insertions(+), 119 deletions(-) diff --git a/examples/dreamcast/filesystem/sd/speedtest/sd-speedtest.c b/examples/dreamcast/filesystem/sd/speedtest/sd-speedtest.c index cd127998..76422c15 100644 --- a/examples/dreamcast/filesystem/sd/speedtest/sd-speedtest.c +++ b/examples/dreamcast/filesystem/sd/speedtest/sd-speedtest.c @@ -1,10 +1,11 @@ /* KallistiOS ##version## - speedtest.c - Copyright (C) 2023 Ruslan Rostovtsev (SWAT) + sd-speedtest.c + Copyright (C) 2023, 2025 Ruslan Rostovtsev - This example program simply attempts to read some sectors from the first - partition of an SD device attached to SCIF and then show the timing information. + This example program performs speed tests for reading sectors from the first + partition of an SD device using both SCI-SPI and SCIF-SPI interfaces with + CRC checking enabled and disabled, and then shows the timing information. */ #include <stdio.h> @@ -12,6 +13,7 @@ #include <string.h> #include <stdlib.h> #include <stdint.h> +#include <stdbool.h> #include <errno.h> #include <dc/sd.h> @@ -27,7 +29,9 @@ KOS_INIT_FLAGS(INIT_DEFAULT); -static uint8_t tbuf[1024 * 512] __attribute__((aligned(32))); +#define TEST_BLOCK_COUNT 1024 + +static uint8_t tbuf[TEST_BLOCK_COUNT * 512] __attribute__((aligned(32))); static void __attribute__((__noreturn__)) wait_exit(void) { maple_device_t *dev; @@ -49,36 +53,38 @@ static void __attribute__((__noreturn__)) wait_exit(void) { } } -int main(int argc, char *argv[]) { +static int run_speed_test(sd_interface_t interface, bool check_crc) { + sd_init_params_t params = { + .interface = interface, + .check_crc = check_crc + }; kos_blockdev_t sd_dev; uint64_t begin, end, timer, average; uint64_t sum = 0; uint8_t pt; int i; - dbgio_dev_select("fb"); - dbglog(DBG_DEBUG, "Initializing SD card.\n"); + const char *interface_name = (interface == SD_IF_SCI) ? "SCI-SPI" : "SCIF-SPI"; - if(sd_init()) { - dbglog(DBG_DEBUG, "Could not initialize the SD card. Please make sure that you " - "have an SD card adapter plugged in and an SD card inserted.\n"); - wait_exit(); + while(sd_init_ex(¶ms)) { + dbglog(DBG_DEBUG, "Could not initialize the SD card on %s interface.\n", interface_name); + return -1; } /* Grab the block device for the first partition on the SD card. Note that you must have the SD card formatted with an MBR partitioning scheme. */ if(sd_blockdev_for_partition(0, &sd_dev, &pt)) { dbglog(DBG_DEBUG, "Could not find the first partition on the SD card!\n"); - wait_exit(); + sd_shutdown(); + return -1; } - dbglog(DBG_DEBUG, "Calculating average speed for reading 1024 blocks.\n"); - for(i = 0; i < 10; i++) { begin = timer_ms_gettime64(); - if(sd_dev.read_blocks(&sd_dev, 0, 1024, tbuf)) { + if(sd_dev.read_blocks(&sd_dev, 0, TEST_BLOCK_COUNT, tbuf)) { dbglog(DBG_DEBUG, "couldn't read block: %s\n", strerror(errno)); + sd_shutdown(); return -1; } @@ -89,10 +95,38 @@ int main(int argc, char *argv[]) { average = sum / 10; - dbglog(DBG_DEBUG, "SD card read average took %llu ms (%.3f KB/sec)\n", - average, (512 * 1024) / ((double)average)); + dbglog(DBG_DEBUG, "%s: read average took %llu ms (%.3f KB/sec)\n", + interface_name, average, (512 * TEST_BLOCK_COUNT) / ((double)average)); sd_shutdown(); + return 0; +} + +int main(int argc, char *argv[]) { + // dbgio_dev_select("fb"); + + dbglog(DBG_DEBUG, "Starting SD card speed tests\n"); + + dbglog(DBG_DEBUG, "Testing SCI-SPI interface with CRC disabled\n"); + if (run_speed_test(SD_IF_SCI, false) == 0) { + dbglog(DBG_DEBUG, "Testing SCI-SPI interface with CRC enabled\n"); + run_speed_test(SD_IF_SCI, true); + } + else { + dbglog(DBG_DEBUG, "Skipping SCI-SPI interface with CRC enabled\n"); + } + + dbglog(DBG_DEBUG, "Testing SCIF-SPI interface with CRC disabled\n"); + if (run_speed_test(SD_IF_SCIF, false) == 0) { + dbglog(DBG_DEBUG, "Testing SCIF-SPI interface with CRC enabled\n"); + run_speed_test(SD_IF_SCIF, true); + } + else { + dbglog(DBG_DEBUG, "Skipping SCIF-SPI interface with CRC enabled\n"); + } + + dbglog(DBG_DEBUG, "All tests completed\n"); + wait_exit(); return 0; } diff --git a/kernel/arch/dreamcast/exports-naomi.txt b/kernel/arch/dreamcast/exports-naomi.txt index 80432e19..2f1d5a17 100644 --- a/kernel/arch/dreamcast/exports-naomi.txt +++ b/kernel/arch/dreamcast/exports-naomi.txt @@ -77,6 +77,16 @@ sci_spi_read_data sci_spi_dma_write_data sci_spi_dma_read_data +# SD Card +sd_init +sd_init_ex +sd_shutdown +sd_read_blocks +sd_write_blocks +sd_get_size +sd_blockdev_for_partition +sd_blockdev_for_device + # Timers timer_prime timer_start diff --git a/kernel/arch/dreamcast/exports-pristine.txt b/kernel/arch/dreamcast/exports-pristine.txt index 41d8fe9c..55479064 100644 --- a/kernel/arch/dreamcast/exports-pristine.txt +++ b/kernel/arch/dreamcast/exports-pristine.txt @@ -95,6 +95,16 @@ sci_spi_read_data sci_spi_dma_write_data sci_spi_dma_read_data +# SD Card +sd_init +sd_init_ex +sd_shutdown +sd_read_blocks +sd_write_blocks +sd_get_size +sd_blockdev_for_partition +sd_blockdev_for_device + # Timers timer_prime timer_start diff --git a/kernel/arch/dreamcast/hardware/sd.c b/kernel/arch/dreamcast/hardware/sd.c index c687f9a2..fa81103f 100644 --- a/kernel/arch/dreamcast/hardware/sd.c +++ b/kernel/arch/dreamcast/hardware/sd.c @@ -2,6 +2,7 @@ sd.c Copyright (C) 2012, 2013 Lawrence Sebald + Copyright (C) 2025 Ruslan Rostovtsev */ /* The code contained herein is basically directly implementing what is @@ -9,10 +10,12 @@ #include <arch/types.h> #include <dc/scif.h> +#include <dc/sci.h> #include <dc/sd.h> #include <errno.h> #include <stdlib.h> #include <string.h> +#include <stdbool.h> /* For CRC16-CCITT */ #include <kos/net.h> @@ -26,9 +29,21 @@ #define CMD(n) ((n) | 0x40) -static int byte_mode = 0; -static int is_mmc = 0; -static int initted = 0; +static bool byte_mode = false; +static bool is_mmc = false; +static bool initted = false; +static bool check_crc = true; +static sd_interface_t current_interface = SD_IF_SCIF; + +/* Unified function pointers for both interfaces */ +static uint8_t (*spi_rw_byte)(uint8_t data) = NULL; +static void (*spi_set_cs)(bool enabled) = NULL; +static int (*spi_init)(bool fast) = NULL; +static void (*spi_shutdown)(void) = NULL; +static void (*spi_read_data)(uint8_t *data, size_t len) = NULL; +static void (*spi_write_data)(const uint8_t *data, size_t len) = NULL; +static uint8_t (*spi_read_byte)(void) = NULL; +static void (*spi_write_byte)(uint8_t data) = NULL; /* The type of the dev_data in the block device structure */ typedef struct sd_devdata { @@ -86,19 +101,83 @@ uint8 sd_crc7(const uint8 *data, int size, uint8 crc) { return crc & (0x7f << 1); } -static int sd_send_cmd(uint8 cmd, uint32 arg, int slow) { - uint8 (*dfunc)(uint8 data) = &scif_spi_rw_byte; +/* Unified wrappers for different interfaces */ +static uint8_t sci_rw_byte(uint8_t data) { + uint8_t rx; + sci_spi_rw_byte(data, &rx); + return rx; +} + +static bool current_speed = false; /* false = slow, true = fast */ + +static uint8_t scif_rw_byte_wrapper(uint8_t data) { + if(current_speed) + return scif_spi_rw_byte(data); + else + return scif_spi_slow_rw_byte(data); +} + +static void scif_write_data_wrapper(const uint8_t *data, size_t len) { + while(len--) { + scif_spi_write_byte(*data++); + } +} + +static uint8_t sci_read_byte_wrapper(void) { + uint8_t rx; + sci_spi_read_byte(&rx); + return rx; +} + +static void sci_write_byte_wrapper(uint8_t data) { + sci_spi_write_byte(data); +} + +static void sci_read_data_wrapper(uint8_t *data, size_t len) { + if(len & 31) + sci_spi_read_data(data, len); + else + sci_spi_dma_read_data(data, len, NULL, NULL); +} + +static void sci_write_data_wrapper(const uint8_t *data, size_t len) { + if(len & 31) + sci_spi_write_data(data, len); + else + sci_spi_dma_write_data(data, len, NULL, NULL); +} + +static void scif_shutdown_wrapper(void) { + scif_spi_shutdown(); +} + +static void sci_shutdown_wrapper(void) { + sci_shutdown(); +} + +static int scif_init_wrapper(bool fast) { + current_speed = fast; + return scif_spi_init(); +} + +static void scif_set_cs_wrapper(bool enabled) { + scif_spi_set_cs(enabled ? 0 : 1); +} + +static int sci_init_wrapper(bool fast) { + uint32_t baud = fast ? SCI_SPI_BAUD_MAX : SCI_SPI_BAUD_INIT; + return sci_init(baud, SCI_MODE_SPI, SCI_CLK_INT); +} + +static int sd_send_cmd(uint8_t cmd, uint32 arg) { uint8 rv; int i = 0; uint8 pkt[6]; - if(slow) - dfunc = &scif_spi_slow_rw_byte; - /* Wait for the SD card to be ready to accept our command... */ - dfunc(0xFF); + spi_rw_byte(0xFF); do { - rv = dfunc(0xFF); + rv = spi_rw_byte(0xFF); ++i; } while(rv != 0xFF && i < MAX_RETRIES); @@ -115,21 +194,21 @@ static int sd_send_cmd(uint8 cmd, uint32 arg, int slow) { pkt[5] = sd_crc7(pkt, 5, 0) | 0x01; /* Write out the packet to the device */ - dfunc(pkt[0]); - dfunc(pkt[1]); - dfunc(pkt[2]); - dfunc(pkt[3]); - dfunc(pkt[4]); - dfunc(pkt[5]); + spi_rw_byte(pkt[0]); + spi_rw_byte(pkt[1]); + spi_rw_byte(pkt[2]); + spi_rw_byte(pkt[3]); + spi_rw_byte(pkt[4]); + spi_rw_byte(pkt[5]); /* Ignore the first byte after sending a CMD12 */ if(cmd == CMD(12)) - dfunc(0xFF); + spi_rw_byte(0xFF); /* Wait for a response */ i = 0; do { - rv = dfunc(0xFF); + rv = spi_rw_byte(0xFF); ++i; } while((rv & 0x80) && i < 20); @@ -145,10 +224,10 @@ static int acmd41_loop(uint32 arg) { /* Try to send ACMD41 for a while. It could take up to 1 second to come back to us, but will likely take much less. */ while(i++ < MAX_RETRIES) { - if(sd_send_cmd(CMD(55), 0, 1) > 1) + if(sd_send_cmd(CMD(55), 0) > 1) return -1; - if((rv = sd_send_cmd(CMD(41), arg, 1)) > 1) + if((rv = sd_send_cmd(CMD(41), arg)) > 1) return -1; if(rv == 0) @@ -168,7 +247,7 @@ static int cmd1_loop(void) { /* Try to send CMD1 for a while. It could take up to 1 second to come back to us, but will likely take much less. */ while(i++ < MAX_RETRIES) { - if((rv = sd_send_cmd(CMD(1), 0, 1)) > 1) + if((rv = sd_send_cmd(CMD(1), 0)) > 1) return -1; if(rv == 0) @@ -183,15 +262,52 @@ static int cmd1_loop(void) { } int sd_init(void) { + sd_init_params_t params = { + .interface = SD_IF_SCIF, + .check_crc = true + }; + return sd_init_ex(¶ms); +} + +int sd_init_ex(const sd_init_params_t *params) { int i; uint8 buf[4]; if(initted) return 0; - byte_mode = is_mmc = 0; + if(!params) { + errno = EINVAL; + return -1; + } + + byte_mode = is_mmc = false; + check_crc = params->check_crc; + current_interface = params->interface; + + if(current_interface == SD_IF_SCIF) { + spi_rw_byte = &scif_rw_byte_wrapper; + spi_set_cs = &scif_set_cs_wrapper; + spi_init = &scif_init_wrapper; + spi_shutdown = &scif_shutdown_wrapper; + spi_read_data = &scif_spi_read_data; + spi_write_data = &scif_write_data_wrapper; + spi_read_byte = &scif_spi_read_byte; + spi_write_byte = &scif_spi_write_byte; + } + else { + spi_rw_byte = &sci_rw_byte; + spi_set_cs = &sci_spi_set_cs; + spi_init = &sci_init_wrapper; + spi_shutdown = &sci_shutdown_wrapper; + spi_read_data = &sci_read_data_wrapper; + spi_write_data = &sci_write_data_wrapper; + spi_read_byte = &sci_read_byte_wrapper; + spi_write_byte = &sci_write_byte_wrapper; + } - if(scif_spi_init()) + /* Initialize interface with low speed for reliability */ + if(spi_init(false)) return -1; /* Send 10 idle bytes so as to delay the required number of clock cycles @@ -199,82 +315,87 @@ int sd_init(void) { and sending 10 idle bytes is 80 cycles). Once that is done, deassert the /CS line. */ for(i = 0; i < 10; ++i) { - scif_spi_slow_rw_byte(0xFF); + spi_rw_byte(0xFF); } - scif_spi_set_cs(0); + spi_set_cs(true); /* Reset the card, putting it in its idle state. */ - if(sd_send_cmd(CMD(0), 0, 1) != 1) { - scif_spi_set_cs(1); + if(sd_send_cmd(CMD(0), 0) != 1) { + spi_set_cs(false); return -1; } /* Detect if we're using a v2 SD card. */ - if(sd_send_cmd(CMD(8), 0x000001AA, 1) == 1) { - buf[0] = scif_spi_slow_rw_byte(0xFF); - buf[1] = scif_spi_slow_rw_byte(0xFF); - buf[2] = scif_spi_slow_rw_byte(0xFF); - buf[3] = scif_spi_slow_rw_byte(0xFF); + if(sd_send_cmd(CMD(8), 0x000001AA) == 1) { + buf[0] = spi_rw_byte(0xFF); + buf[1] = spi_rw_byte(0xFF); + buf[2] = spi_rw_byte(0xFF); + buf[3] = spi_rw_byte(0xFF); if((buf[2] & 0x0F) != 0x01 || buf[3] != 0xAA) { - scif_spi_set_cs(1); + spi_set_cs(false); return -2; } /* ACMD41 until we're ready */ if(acmd41_loop(0x40000000)) { - scif_spi_set_cs(1); + spi_set_cs(false); return -1; } /* Detect if we do byte addressing or block addressing with CMD58 */ - if(sd_send_cmd(CMD(58), 0, 1)) { - scif_spi_set_cs(1); + if(sd_send_cmd(CMD(58), 0)) { + spi_set_cs(false); return -1; } - buf[0] = scif_spi_slow_rw_byte(0xFF); - buf[1] = scif_spi_slow_rw_byte(0xFF); - buf[2] = scif_spi_slow_rw_byte(0xFF); - buf[3] = scif_spi_slow_rw_byte(0xFF); + buf[0] = spi_rw_byte(0xFF); + buf[1] = spi_rw_byte(0xFF); + buf[2] = spi_rw_byte(0xFF); + buf[3] = spi_rw_byte(0xFF); if(!(buf[0] & 0x40)) - byte_mode = 1; + byte_mode = true; } else { /* ACMD41 (SDv1) or CMD1 (MMC) until we're ready */ if(acmd41_loop(0)) { /* Try with CMD1 instead then... */ if(cmd1_loop()) { - scif_spi_set_cs(1); + spi_set_cs(false); return -1; } /* If ACMD41 failed but CMD1 succeeded, we have a MMC card. */ - is_mmc = 1; + is_mmc = true; } /* Set the block length to 512 with CMD16 */ - if(sd_send_cmd(CMD(16), 512, 1)) { - scif_spi_set_cs(1); + if(sd_send_cmd(CMD(16), 512)) { + spi_set_cs(false); ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-05-16 23:49:15
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via ea4b4439718347a99c4e11bd2adb76cd11904bfd (commit) via 935e15970613fcef798a8209508d0c6cdd07d759 (commit) via 5cd80d7cc4cc755de074451e416136d954bddf74 (commit) via 21320c8b608eb387a205c64402c0eb3079b8daf0 (commit) via c3a6c177c54eb861cf0d41b5f5e8c91e3095718e (commit) via 523a7282d0a861ab75d6a92742ba9865fb1738d2 (commit) from 941c33acdc8d57e139942a12c45408db77607cec (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ea4b4439718347a99c4e11bd2adb76cd11904bfd Author: QuzarDC <qu...@co...> Date: Sun May 4 01:06:59 2025 -0400 Remove old duplicated keymaps. The `kbd_enqueue` function had its own copies of the US region keymaps that there was no reason for. Now the global key queue will instead be set by the standard US region keymap to maintain the same general behavior. The differences are that key 0x28 is now 10 rather than 13, and that shift functionality can be triggered by caps lock. commit 935e15970613fcef798a8209508d0c6cdd07d759 Author: QuzarDC <qu...@co...> Date: Tue Apr 15 22:53:35 2025 -0400 Demonstrate event handler in keyboard test. commit 5cd80d7cc4cc755de074451e416136d954bddf74 Author: QuzarDC <qu...@co...> Date: Tue Apr 15 18:05:48 2025 -0400 Add event-driven callback mechanism. Allows registration of a callback to be invoked whenever a key changes states (similar to how Qt, GTk, and high-level widgeting frameworks process key events). commit 21320c8b608eb387a205c64402c0eb3079b8daf0 Author: QuzarDC <qu...@co...> Date: Tue Apr 15 14:04:59 2025 -0400 Enhance key state tracking. This change shifts key state tracking from 3 states (not pressed, pressed, was pressed) to the full 4 possible combinations of is/was up/down. This added no storage overhead, and significantly simplifies the per-poll update that decays 'pressed' into 'was pressed' and 'was pressed' into 'not pressed' into a bit shift. Compatibility defines were left in place to help the process of updating, and compatibility should be maintained. To note, this still requires updates to the old SDL port as it was not using the defines provided for determining key state and was instead presuming the values mapped to SDL defines. commit c3a6c177c54eb861cf0d41b5f5e8c91e3095718e Author: QuzarDC <qu...@co...> Date: Mon Apr 14 23:15:00 2025 -0400 Rename MAX_PRESSED_KEYS define. So that it matches our general naming scheme with kbd prefix. commit 523a7282d0a861ab75d6a92742ba9865fb1738d2 Author: QuzarDC <qu...@co...> Date: Mon Apr 14 23:13:03 2025 -0400 Clean up types in the keyboard's private state. ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/libdream/keyboard/keyboard.c | 95 +++++++-- kernel/arch/dreamcast/hardware/maple/keyboard.c | 148 +++++++------- kernel/arch/dreamcast/include/dc/maple/keyboard.h | 230 ++++++++++++++++++---- 3 files changed, 345 insertions(+), 128 deletions(-) diff --git a/examples/dreamcast/libdream/keyboard/keyboard.c b/examples/dreamcast/libdream/keyboard/keyboard.c index 2ff10b44..ca49c064 100644 --- a/examples/dreamcast/libdream/keyboard/keyboard.c +++ b/examples/dreamcast/libdream/keyboard/keyboard.c @@ -4,11 +4,24 @@ /* Display constants */ #define SCREEN_WIDTH 640 #define SCREEN_HEIGHT 480 - -void kb_test(void) { +#define MARGIN_HORIZONTAL 20 +#define MARGIN_VERTICAL 20 +#define PATTERN_OFFSET 64 + +/* Structure holding cursor state */ +typedef struct { + int x; + int y; + mutex_t m; +} cursor_t; + +/* Function for performing textual input style polling logic by + popping keys off of the pending keyboard queue to process. +*/ +static void kb_test(cursor_t *cursor) { maple_device_t *cont, *kbd; cont_state_t *state; - int k, x = 20, y = 20 + BFONT_HEIGHT; + int k; printf("Now doing keyboard test\n"); @@ -29,14 +42,6 @@ void kb_test(void) { if(!kbd) continue; - thd_sleep(10); - - /* Check for keyboard input */ - /* if (kbd_poll(mkb)) { - printf("Error checking keyboard status\n"); - return; - } */ - /* Keep popping keys while there are more enqueued. */ while((k = kbd_queue_pop(kbd, true)) != KBD_QUEUE_END) { /* Quit if ESC key is pressed. */ @@ -50,35 +55,83 @@ void kb_test(void) { printf("Special key %04x\n", k); /* Handle every key that isn't the RETURN key. */ - if(k != '\r') { + else if(k != '\r') { + mutex_lock(&cursor->m); /* Draw the key we just pressed. */ - bfont_draw(vram_s + y * SCREEN_WIDTH + x, SCREEN_WIDTH, 0, k); + bfont_draw(vram_s + cursor->y * SCREEN_WIDTH + cursor->x, + SCREEN_WIDTH, 0, k); /* Advance the cursor horizontally. */ - x += BFONT_THIN_WIDTH; - } - else { - x = 20; - y += BFONT_HEIGHT; + cursor->x += BFONT_THIN_WIDTH; + + /* Implement wrapping if we're at the end of the line. */ + if(cursor->x >= (SCREEN_WIDTH - MARGIN_HORIZONTAL)) { + cursor->x = MARGIN_HORIZONTAL; + cursor->y += BFONT_HEIGHT; + } + + mutex_unlock(&cursor->m); } } + } +} - thd_sleep(10); +/* Asynchronous callback function which is invoked by the keyboard + driver any time a key's state changes. This is what you want to + use when using the keyboard as a traditional controller-like input- + device. +*/ +static void on_key_event(maple_device_t *dev, kbd_key_t key, + key_state_t state, kbd_mods_t mods, + kbd_leds_t leds, void *user_data) { + /* Retrieve keyboard state from maple device. */ + kbd_state_t *kbd_state = kbd_get_state(dev); + /* Fetch cursor from generic userdata pointer. */ + cursor_t *cursor = user_data; + + /* Print keyboard address + key ID and state change type. */ + printf("[%c%u] %c: %s\n", + 'A' + dev->port, dev->unit, + kbd_key_to_ascii(key, 1, mods, leds), + state.value == KEY_STATE_CHANGED_DOWN? "PRESSED" : "RELEASED"); + + /* Check whether the RETURN key was pressed (but not held): */ + if(key == KBD_KEY_ENTER && state.value == KEY_STATE_CHANGED_DOWN) { + if(mutex_trylock(&cursor->m)) return; + /* Advance cursor to the next line. */ + cursor->x = MARGIN_HORIZONTAL; + cursor->y += BFONT_HEIGHT; + mutex_unlock(&cursor->m); } } int main(int argc, char **argv) { int x, y; + /* Initialize our cursor in the top-left. */ + cursor_t cursor = { + .x = MARGIN_HORIZONTAL, + .y = MARGIN_VERTICAL + BFONT_HEIGHT, + .m = ERRORCHECK_MUTEX_INITIALIZER + }; + for(y = 0; y < SCREEN_HEIGHT; y++) for(x = 0; x < SCREEN_WIDTH; x++) { - int c = (x ^ y) & 255; + int c = ((x % PATTERN_OFFSET) ^ + (y % PATTERN_OFFSET)) & 0xff; vram_s[y * SCREEN_WIDTH + x] = ((c >> 3) << 12) | ((c >> 2) << 5) | ((c >> 3) << 0); } - kb_test(); + /* Install a custom keyboard event handler which will listen for + key state changes, passing it our cursor. This drives the keyboard + as a controller-like input device. + */ + kbd_set_event_handler(on_key_event, &cursor); + + /* Run our main logic which drives the keyboard as a text-input device. */ + kb_test(&cursor); return EXIT_SUCCESS; } diff --git a/kernel/arch/dreamcast/hardware/maple/keyboard.c b/kernel/arch/dreamcast/hardware/maple/keyboard.c index 9fd1b22c..7241bc71 100644 --- a/kernel/arch/dreamcast/hardware/maple/keyboard.c +++ b/kernel/arch/dreamcast/hardware/maple/keyboard.c @@ -41,12 +41,14 @@ typedef struct kbd_state_private { You should not access this variable directly. Please use the appropriate function to access it. */ kbd_q_key_t key_queue[KBD_QUEUE_SIZE]; - int queue_tail; /**< \brief Key queue tail. */ - int queue_head; /**< \brief Key queue head. */ - volatile int queue_len; /**< \brief Current length of queue. */ - - kbd_key_t kbd_repeat_key; /**< \brief Key that is repeating. */ - uint64_t kbd_repeat_timer; /**< \brief Time that the next repeat will trigger. */ + size_t queue_tail; /**< \brief Key queue tail. */ + size_t queue_head; /**< \brief Key queue head. */ + volatile size_t queue_len; /**< \brief Current length of queue. */ + + struct { + kbd_key_t key; /**< \brief Key that is repeating. */ + uint64_t timeout; /**< \brief Time that the next repeat will trigger. */ + } repeater; } kbd_state_private_t; /* These are global timings for key repeat. It would be possible to put @@ -66,6 +68,23 @@ void kbd_set_repeat_timing(uint16_t start, uint16_t interval) { repeat_timing.interval = interval; } +static struct { + kbd_event_handler_t cb; + void *ud; +} event_handler = { + NULL, NULL +}; + +void kbd_set_event_handler(kbd_event_handler_t callback, void *user_data) { + event_handler.cb = callback; + event_handler.ud = user_data; +} + +void kbd_get_event_handler(kbd_event_handler_t *callback, void **user_data) { + *callback = event_handler.cb; + *user_data = event_handler.ud; +} + /* Keyboard keymap. This structure represents a mapping from raw key values to ASCII values, if @@ -409,6 +428,16 @@ static const kbd_keymap_internal_t keymaps[] = { } }; +char kbd_key_to_ascii(kbd_key_t key, kbd_region_t region, kbd_mods_t mods, kbd_leds_t leds) { + + if(mods.ralt || (mods.lctrl && mods.lalt)) + return keymaps[region - 1].alt[key]; + else if((mods.raw & KBD_MOD_SHIFT) || leds.caps_lock) + return keymaps[region - 1].shifted[key]; + else + return keymaps[region - 1].base[key]; +} + /* The keyboard queue (global for now) */ static volatile int kbd_queue_active = 1; static volatile int kbd_queue_tail = 0, kbd_queue_head = 0; @@ -432,28 +461,6 @@ void kbd_set_queue(int active) { NOTE: We are only calling this within an IRQ context, so operations on kbd_state::queue_size are essentially atomic. */ static int kbd_enqueue(kbd_state_private_t *state, kbd_key_t keycode) { - static const char keymap_noshift[] = { - /*0*/ 0, 0, 0, 0, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', - 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', - 'u', 'v', 'w', 'x', 'y', 'z', - /*1e*/ '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', - /*28*/ 13, 27, 8, 9, 32, '-', '=', '[', ']', '\\', 0, ';', '\'', - /*35*/ '`', ',', '.', '/', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - /*46*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - /*53*/ 0, '/', '*', '-', '+', 13, '1', '2', '3', '4', '5', '6', - /*5f*/ '7', '8', '9', '0', '.', 0 - }; - static const char keymap_shift[] = { - /*0*/ 0, 0, 0, 0, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', - 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', - 'U', 'V', 'W', 'X', 'Y', 'Z', - /*1e*/ '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', - /*28*/ 13, 27, 8, 9, 32, '_', '+', '{', '}', '|', 0, ':', '"', - /*35*/ '~', '<', '>', '?', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - /*46*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - /*53*/ 0, '/', '*', '-', '+', 13, '1', '2', '3', '4', '5', '6', - /*5f*/ '7', '8', '9', '0', '.', 0 - }; uint16_t ascii = 0; /* Don't bother with bad keycodes. */ @@ -473,13 +480,9 @@ static int kbd_enqueue(kbd_state_private_t *state, kbd_key_t keycode) { if(!kbd_queue_active) return 0; - /* Figure out its key queue value */ - if(keycode < sizeof(keymap_noshift)) { - if(state->base.cond.modifiers.raw & KBD_MOD_SHIFT) - ascii = keymap_shift[keycode]; - else - ascii = keymap_noshift[keycode]; - } + /* Figure out its key queue value. */ + ascii = (uint16_t)kbd_key_to_ascii(keycode, KBD_REGION_US, + state->base.cond.modifiers, state->base.cond.leds); if(ascii == 0) ascii = ((uint16_t)keycode) << 8; @@ -522,16 +525,6 @@ kbd_state_t *kbd_get_state(maple_device_t *device) { return (kbd_state_t *)device->status; } -char kbd_key_to_ascii(kbd_key_t key, kbd_region_t region, kbd_mods_t mods, kbd_leds_t leds) { - - if(mods.ralt || (mods.lctrl && mods.lalt)) - return keymaps[region - 1].alt[key]; - else if((mods.raw & KBD_MOD_SHIFT) || leds.caps_lock) - return keymaps[region - 1].shifted[key]; - else - return keymaps[region - 1].base[key]; -} - /* Take a key off of a specific key queue. */ int kbd_queue_pop(maple_device_t *dev, bool xlat) { kbd_state_private_t *state = (kbd_state_private_t *)dev->status; @@ -567,52 +560,58 @@ static void kbd_check_poll(maple_frame_t *frm) { kbd_state_private_t *pstate = (kbd_state_private_t *)frm->dev->status; kbd_state_t *state = &pstate->base; kbd_cond_t *cond = (kbd_cond_t *)&state->cond; - int i; + size_t i; /* If the modifier keys have changed, end the key repeating. */ if(state->last_modifiers.raw != cond->modifiers.raw) { - pstate->kbd_repeat_key = KBD_KEY_NONE; - pstate->kbd_repeat_timer = 0; + pstate->repeater.key = KBD_KEY_NONE; + pstate->repeater.timeout = 0; } /* Update modifiers. */ state->last_modifiers = cond->modifiers; + /* Update all key states */ + for(i = 0; i < KBD_MAX_KEYS; ++i) { + state->key_states[i].raw = (state->key_states[i].raw << 1) & KEY_STATE_MASK; + } + /* Process all pressed keys */ - for(i = 0; i < MAX_PRESSED_KEYS; i++) { + for(i = 0; i < KBD_MAX_PRESSED_KEYS; i++) { /* Once we get to a 'none', the rest will be 'none' */ if(cond->keys[i] == KBD_KEY_NONE) { /* This could be used to indicate how many keys are pressed by setting it to ~i or i+1 or similar. This could be useful, but would make it a weird exception. */ /* If the first key in the key array is none, there are no non-modifer keys pressed at all. */ - if(i==0) state->matrix[KBD_KEY_NONE] = KEY_STATE_PRESSED; + if(!i) state->key_states[KBD_KEY_NONE].is_down = true; break; } /* Between None and A are error indicators. This would be a good place to do... something. If an error occurs the whole array will be error.*/ else if(cond->keys[i]>KBD_KEY_NONE && cond->keys[i]<KBD_KEY_A) { - state->matrix[cond->keys[i]] = KEY_STATE_PRESSED; + state->key_states[cond->keys[i]].is_down = true; break; } /* The rest of the keys are treated normally */ else { + /* Update key state */ + state->key_states[cond->keys[i]].is_down = true; + /* If the key hadn't been pressed. */ - if(state->matrix[cond->keys[i]] == KEY_STATE_NONE) { - state->matrix[cond->keys[i]] = KEY_STATE_PRESSED; + if(state->key_states[cond->keys[i]].value == KEY_STATE_CHANGED_DOWN) { kbd_enqueue(pstate, cond->keys[i]); - pstate->kbd_repeat_key = cond->keys[i]; + pstate->repeater.key = cond->keys[i]; if(repeat_timing.start) - pstate->kbd_repeat_timer = timer_ms_gettime64() + repeat_timing.start; + pstate->repeater.timeout = timer_ms_gettime64() + repeat_timing.start; } /* If the key was already being pressed and was our one allowed repeating key, then... */ - else if(state->matrix[cond->keys[i]] == KEY_STATE_WAS_PRESSED) { - state->matrix[cond->keys[i]] = KEY_STATE_PRESSED; - if(pstate->kbd_repeat_key == cond->keys[i]) { + else if(state->key_states[cond->keys[i]].value == KEY_STATE_HELD_DOWN) { + if(pstate->repeater.key == cond->keys[i]) { /* If repeat timing is enabled, bail if under interval */ if(repeat_timing.start) { uint64_t time = timer_ms_gettime64(); - if(time >= (pstate->kbd_repeat_timer)) - pstate->kbd_repeat_timer = time + repeat_timing.interval; + if(time >= (pstate->repeater.timeout)) + pstate->repeater.timeout = time + repeat_timing.interval; else continue; } @@ -620,23 +619,28 @@ static void kbd_check_poll(maple_frame_t *frm) { kbd_enqueue(pstate, cond->keys[i]); } } - else assert_msg(0, "invalid key matrix array detected"); + else assert_msg(0, "invalid key_states array detected"); } } - /* Now normalize the key matrix */ - /* If it was determined no keys are pressed, wipe the matrix */ - if(state->matrix[KBD_KEY_NONE] == KEY_STATE_PRESSED) - memset (state->matrix, KEY_STATE_NONE, KBD_MAX_KEYS); - /* Otherwise, walk through the whole matrix */ - else { - for(i = 0; i < KBD_MAX_KEYS; i++) { - if(state->matrix[i] == KEY_STATE_NONE) continue; + /* If we are using the event callback, check if any need called. */ + if(!event_handler.cb) return; + + for(i = KBD_KEY_A; i < KBD_MAX_KEYS; i++) { + switch(state->key_states[i].value) { + case KEY_STATE_CHANGED_DOWN: + case KEY_STATE_CHANGED_UP: + event_handler.cb(frm->dev, i, state->key_states[i], + cond->modifiers, cond->leds, event_handler.ud); + break; - else if(state->matrix[i] == KEY_STATE_WAS_PRESSED) state->matrix[i] = KEY_STATE_NONE; + case KEY_STATE_HELD_DOWN: + case KEY_STATE_HELD_UP: + break; - else if(state->matrix[i] == KEY_STATE_PRESSED) state->matrix[i] = KEY_STATE_WAS_PRESSED; - else assert_msg(0, "invalid key matrix array detected"); + default: + assert_msg(0, "Invalid key state found during callback check loop."); + break; } } } diff --git a/kernel/arch/dreamcast/include/dc/maple/keyboard.h b/kernel/arch/dreamcast/include/dc/maple/keyboard.h index a1da9a65..ea9862b7 100644 --- a/kernel/arch/dreamcast/include/dc/maple/keyboard.h +++ b/kernel/arch/dreamcast/include/dc/maple/keyboard.h @@ -313,27 +313,109 @@ typedef enum __packed kbd_key { char kbd_key_to_ascii(kbd_key_t key, kbd_region_t region, kbd_mods_t mods, kbd_leds_t leds); -/** \defgroup key_states Key States - \brief States each key can be in. +/** \defgroup key_state_grp Key States + \brief Types associated with key states + \ingroup kbd_status_grp + + Key states are represented by the kbd_state_t union type. The state may be + accessed by: + 1. Directly comparing key_state_t::value to a \ref key_state_value_t. + 2. Directly using a convenience bit field. + 3. Bitwise `AND` of key_state_t::raw with one of the + \ref key_state_flags. + + @{ +*/ + +/** \defgroup key_state_flags Flags + \brief Keyboard key state bit flags + + A key_state_t is a combination of two flags: + 1. `KEY_STATE_IS_DOWN`: whether the key is currently pressed + this frame. + 2. `KEY_STATE_WAS_DOWN`: whether the key was previously pressed + last frame. + + Between these two flags, you can know whether a key state transition + event has occurred (when the two flags have different values). - These are the different 'states' each key can be in. They are stored in - kbd_state_t->matrix, and manipulated/checked by kbd_check_poll. + \sa key_state_t::raw, key_state_value_t - none-> pressed or none - was pressed-> pressed or none - pressed-> was_pressed @{ */ -#define KEY_STATE_NONE 0 -#define KEY_STATE_WAS_PRESSED 1 -#define KEY_STATE_PRESSED 2 +#define KEY_STATE_IS_DOWN BIT(0) /**< \brief If key is currenty down */ +#define KEY_STATE_WAS_DOWN BIT(1) /**< \brief If key was previously down */ +/** \brief Mask of all key state flags */ +#define KEY_STATE_MASK (KEY_STATE_IS_DOWN | KEY_STATE_WAS_DOWN) +/** @} */ + +/** \brief Creates a packed key_state_t + + This macro is used to pack two frames worth of key state information + into a key_state_t, one bit per frame. +*/ +#define KEY_STATE_PACK(is_down, was_down) \ + (((!!(is_down))? KEY_STATE_IS_DOWN : 0) | \ + ((!!(was_down))? KEY_STATE_WAS_DOWN : 0)) + +/** \brief Valid values for key_state_t::value + + Enumerates each of the 4 different states a key can be in, + by combining two frames worth of key down information + into two bits. + + \note + Two of the values are for `HELD` states, meaning the same state has been + observed for both the current and the previous frame, while the other two + values are for `CHANGE` states, meaning the current frame has a different + state from the previous frame. + + \sa key_state_flags, key_state_t::value +*/ +typedef enum __packed key_state_value { + /** \brief Key has been in an up state for at least the last two frames */ + KEY_STATE_HELD_UP = KEY_STATE_PACK(false, false), + /** \brief Key transitioned from up to pressed this frame */ + KEY_STATE_CHANGED_DOWN = KEY_STATE_PACK(true, false), + /** \brief Key transitioned from down to released this frame */ + KEY_STATE_CHANGED_UP = KEY_STATE_PACK(false, true), + /** \brief Key has been held down for at least the last two frames */ + KEY_STATE_HELD_DOWN = KEY_STATE_PACK(true, true), +} key_state_value_t; + +/* Short-term compatibility helpers. */ +static const uint8_t KEY_STATE_NONE __depr("Please use KEY_STATE_HELD_UP.") = KEY_STATE_HELD_UP; +static const uint8_t KEY_STATE_WAS_PRESSED __depr("Please use KEY_STATE_CHANGED_UP.") = KEY_STATE_CHANGED_UP; +static const uint8_t KEY_STATE_PRESSED __depr("Please see key_state_value_t.") = KEY_STATE_HELD_DOWN; + +/** \brief Keyboard Key State + + Union containing the the previous and current frames' state information for + a keyboard key. + + \sa key_state_flags, key_state_value_t, kbd_state::key_states +*/ +typedef union key_state { + /** \brief Convenience Bitfields */ + struct { + bool is_down : 1; /**< \brief Whether down the current frame */ + bool was_down : 1; /**< \brief Whether down the previous frame */ + uint8_t : 6; + }; + key_state_value_t value; /**< \brief Enum for specific state */ + uint8_t raw; /**< \brief Packed 8-bit unsigned integer of bitflags */ +} key_state_t; + /** @} */ /** \brief Maximum number of keys the DC can read simultaneously. This is a hardware constant. The define prevents the magic number '6' from appearing. **/ -#define MAX_PRESSED_KEYS 6 +#define KBD_MAX_PRESSED_KEYS 6 + +/* Short-term compatibility helper. */ +static const int MAX_PRESSED_KEYS __depr("Please use KBD_MAX_PRESSED_KEYS.") = KBD_MAX_PRESSED_KEYS; ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-05-16 23:02:32
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 941c33acdc8d57e139942a12c45408db77607cec (commit) from b780eaad51146fb0c56f66c6f5ddca2f2eb19a88 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 941c33acdc8d57e139942a12c45408db77607cec Author: darc <da...@pr...> Date: Fri May 16 17:45:20 2025 -0500 Restore struct packing to network structs that were removed In commit 02c99c9, the packed attribute was removed from various structs in the network stack. This caused networking to crash. This commit restores the packed attributes to all structs it was applied to previously. ----------------------------------------------------------------------- Summary of changes: include/kos/net.h | 4 ++-- kernel/net/net_arp.c | 2 +- kernel/net/net_dhcp.h | 2 +- kernel/net/net_icmp.h | 2 +- kernel/net/net_icmp6.h | 26 +++++++++++++------------- kernel/net/net_ipv4.h | 4 ++-- kernel/net/net_ipv6.h | 4 ++-- kernel/net/net_tcp.c | 2 +- kernel/net/net_udp.c | 8 ++++---- 9 files changed, 27 insertions(+), 27 deletions(-) diff --git a/include/kos/net.h b/include/kos/net.h index 26abe780..47363535 100644 --- a/include/kos/net.h +++ b/include/kos/net.h @@ -247,7 +247,7 @@ typedef struct ip_hdr_s { uint16 checksum; /**< \brief IP checksum */ uint32 src; /**< \brief Source IP address */ uint32 dest; /**< \brief Destination IP address */ -} ip_hdr_t; +} __packed ip_hdr_t; /** \defgroup networking_ipv6 IPv6 \brief IPv6 Network Stack @@ -269,7 +269,7 @@ typedef struct ipv6_hdr_s { uint8 hop_limit; /**< \brief Hop limit */ struct in6_addr src_addr; /**< \brief Source IP address */ struct in6_addr dst_addr; /**< \brief Destination IP address */ -} ipv6_hdr_t; +} __packed ipv6_hdr_t; /***** net_arp.c **********************************************************/ diff --git a/kernel/net/net_arp.c b/kernel/net/net_arp.c index 3f917354..ecfdb1b9 100644 --- a/kernel/net/net_arp.c +++ b/kernel/net/net_arp.c @@ -33,7 +33,7 @@ typedef struct { uint8 pr_send[4]; uint8 hw_recv[6]; uint8 pr_recv[6]; -} arp_pkt_t; +} __packed arp_pkt_t; /* Structure describing an ARP entry; each entry contains a MAC address, an IP address, and a timestamp from 'jiffies'. The timestamp allows diff --git a/kernel/net/net_dhcp.h b/kernel/net/net_dhcp.h index 64443a0d..0deeba80 100644 --- a/kernel/net/net_dhcp.h +++ b/kernel/net/net_dhcp.h @@ -141,7 +141,7 @@ typedef struct dhcp_pkt { char sname[64]; char file[128]; uint8 options[]; -} dhcp_pkt_t; +} __packed dhcp_pkt_t; int net_dhcp_init(void); diff --git a/kernel/net/net_icmp.h b/kernel/net/net_icmp.h index d996c89b..c676f013 100644 --- a/kernel/net/net_icmp.h +++ b/kernel/net/net_icmp.h @@ -24,7 +24,7 @@ typedef struct { uint16 m16[2]; uint32 m32; } misc; -} icmp_hdr_t; +} __packed icmp_hdr_t; #define ICMP_MESSAGE_ECHO_REPLY 0 #define ICMP_MESSAGE_DEST_UNREACHABLE 3 diff --git a/kernel/net/net_icmp6.h b/kernel/net/net_icmp6.h index 88fa89d2..411ba94b 100644 --- a/kernel/net/net_icmp6.h +++ b/kernel/net/net_icmp6.h @@ -15,7 +15,7 @@ typedef struct icmp6_hdr_s { uint8 type; uint8 code; uint16 checksum; -} icmp6_hdr_t; +} __packed icmp6_hdr_t; /* Header for Destination Unreachable packets (type 1) */ typedef struct icmp6_dest_unreach_s { @@ -23,7 +23,7 @@ typedef struct icmp6_dest_unreach_s { uint8 code; uint16 checksum; uint32 unused; -} icmp6_dest_unreach_t; +} __packed icmp6_dest_unreach_t; /* Header for Packet Too Big packets (type 2) */ typedef struct icmp6_pkt_too_big_s { @@ -31,7 +31,7 @@ typedef struct icmp6_pkt_too_big_s { uint8 code; uint16 checksum; uint32 mtu; -} icmp6_pkt_too_big_t; +} __packed icmp6_pkt_too_big_t; /* Header for Time Exceeded packets (type 3) */ typedef struct icmp6_time_exceeded_s { @@ -39,7 +39,7 @@ typedef struct icmp6_time_exceeded_s { uint8 code; uint16 checksum; uint32 unused; -} icmp6_time_exceeded_t; +} __packed icmp6_time_exceeded_t; /* Header for Parameter Problem packets (type 4) */ typedef struct icmp6_param_problem_s { @@ -47,7 +47,7 @@ typedef struct icmp6_param_problem_s { uint8 code; uint16 checksum; uint32 ptr; -} icmp6_param_problem_t; +} __packed icmp6_param_problem_t; /* Header for Echo/Echo Reply packets (types 128/129) */ typedef struct icmp6_echo_hdr_s { @@ -56,7 +56,7 @@ typedef struct icmp6_echo_hdr_s { uint16 checksum; uint16 ident; uint16 seq; -} icmp6_echo_hdr_t; +} __packed icmp6_echo_hdr_t; /* Format for Router Solicitation packets (type 133) - RFC 4861 */ typedef struct icmp6_router_sol_s { @@ -65,7 +65,7 @@ typedef struct icmp6_router_sol_s { uint16 checksum; uint32 reserved; uint8 options[]; -} icmp6_router_sol_t; +} __packed icmp6_router_sol_t; /* Format for Router Advertisement packets (type 134) - RFC 4861 */ typedef struct icmp6_router_adv_s { @@ -78,7 +78,7 @@ typedef struct icmp6_router_adv_s { uint32 reachable_time; uint32 retrans_timer; uint8 options[]; -} icmp6_router_adv_t; +} __packed icmp6_router_adv_t; /* Format for Neighbor Solicitation packets (type 135) - RFC 4861 */ typedef struct icmp6_neighbor_sol_s { @@ -88,7 +88,7 @@ typedef struct icmp6_neighbor_sol_s { uint32 reserved; struct in6_addr target; uint8 options[]; -} icmp6_neighbor_sol_t; +} __packed icmp6_neighbor_sol_t; /* Format for Neighbor Advertisement packets (type 136) - RFC 4861 */ typedef struct icmp6_neighbor_adv_s { @@ -99,7 +99,7 @@ typedef struct icmp6_neighbor_adv_s { uint8 reserved[3]; struct in6_addr target; uint8 options[]; -} icmp6_neighbor_adv_t; +} __packed icmp6_neighbor_adv_t; /* Link-layer address option for neighbor advertisement/solictation packets for ethernet. */ @@ -107,7 +107,7 @@ typedef struct icmp6_nsol_lladdr_s { uint8 type; uint8 length; uint8 mac[6]; -} icmp6_nsol_lladdr_t; +} __packed icmp6_nsol_lladdr_t; /* Redirect packet (type 137) - RFC 4861 */ typedef struct icmp6_redirect_s { @@ -118,7 +118,7 @@ typedef struct icmp6_redirect_s { struct in6_addr target; struct in6_addr dest; uint8 options[]; -} icmp6_redirect_t; +} __packed icmp6_redirect_t; /* Prefix information for router advertisement packets */ typedef struct icmp6_ndp_prefix_s { @@ -130,7 +130,7 @@ typedef struct icmp6_ndp_prefix_s { uint32 preferred_time; uint32 reserved; struct in6_addr prefix; -} icmp6_ndp_prefix_t; +} __packed icmp6_ndp_prefix_t; /* ICMPv6 Message types */ /* Error messages (type < 127) */ diff --git a/kernel/net/net_ipv4.h b/kernel/net/net_ipv4.h index caf05aa4..5569a2cd 100644 --- a/kernel/net/net_ipv4.h +++ b/kernel/net/net_ipv4.h @@ -15,7 +15,7 @@ typedef struct { uint8 dest[6]; uint8 src[6]; uint8 type[2]; -} eth_hdr_t; +} __packed eth_hdr_t; typedef struct { uint32 src_addr; @@ -23,7 +23,7 @@ typedef struct { uint8 zero; uint8 proto; uint16 length; -} ipv4_pseudo_hdr_t; +} __packed ipv4_pseudo_hdr_t; uint16 net_ipv4_checksum(const uint8 *data, size_t bytes, uint16 start); int net_ipv4_send_packet(netif_t *net, ip_hdr_t *hdr, const uint8 *data, diff --git a/kernel/net/net_ipv6.h b/kernel/net/net_ipv6.h index 5142da06..67e6ef24 100644 --- a/kernel/net/net_ipv6.h +++ b/kernel/net/net_ipv6.h @@ -16,7 +16,7 @@ typedef struct ipv6_ext_hdr_s { uint8 next_header; uint8 ext_length; uint8 data[]; -} ipv6_ext_hdr_t; +} __packed ipv6_ext_hdr_t; typedef struct ipv6_pseudo_hdr_s { struct in6_addr src_addr; @@ -24,7 +24,7 @@ typedef struct ipv6_pseudo_hdr_s { uint32 upper_layer_len; uint8 zero[3]; uint8 next_header; -} ipv6_pseudo_hdr_t; +} __packed ipv6_pseudo_hdr_t; #define IPV6_HDR_EXT_HOP_BY_HOP 0 #define IPV6_HDR_EXT_ROUTING 43 diff --git a/kernel/net/net_tcp.c b/kernel/net/net_tcp.c index 2182c888..0cc6a062 100644 --- a/kernel/net/net_tcp.c +++ b/kernel/net/net_tcp.c @@ -101,7 +101,7 @@ typedef struct tcp_hdr { uint16_t checksum; uint16_t urg; uint8_t options[]; -} tcp_hdr_t; +} __packed tcp_hdr_t; /* Listening socket. Each one of these is an incoming connection from a socket that is in the listen state */ diff --git a/kernel/net/net_udp.c b/kernel/net/net_udp.c index aa16e81a..8cdd4f0a 100644 --- a/kernel/net/net_udp.c +++ b/kernel/net/net_udp.c @@ -34,10 +34,10 @@ #define UDP_DEFAULT_HOPS 64 typedef struct { - uint16 src_port; - uint16 dst_port; - uint16 length; - uint16 checksum; + uint16 src_port __packed; + uint16 dst_port __packed; + uint16 length __packed; + uint16 checksum __packed; } udp_hdr_t; struct udp_pkt { hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-05-16 20:20:19
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via b780eaad51146fb0c56f66c6f5ddca2f2eb19a88 (commit) from d531a815865eae2c1d7794a0d2d09be10836d80d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b780eaad51146fb0c56f66c6f5ddca2f2eb19a88 Author: darc <da...@pr...> Date: Fri May 16 15:14:11 2025 -0500 Remove erroneous Makefile from examples/dreamcast/libpthread ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/pthread/Makefile | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 examples/dreamcast/pthread/Makefile diff --git a/examples/dreamcast/pthread/Makefile b/examples/dreamcast/pthread/Makefile deleted file mode 100644 index 0831b355..00000000 --- a/examples/dreamcast/pthread/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# KallistiOS ##version## -# -# examples/dreamcast/pthread/Makefile -# Copyright (C) 2023 Lawrence Sebald -# - -all: - $(KOS_MAKE) -C general - -clean: - $(KOS_MAKE) -C general clean - -dist: - $(KOS_MAKE) -C general dist hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: quzar <qu...@us...> - 2025-05-16 18:43:49
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A KallistiOS implementation of conio. ". The branch, master has been updated via b9ea5cec481bf04821004ad80f1acb36f4d87d05 (commit) via ae543453d3861d740206638b1aada20cf3fc6d6b (commit) via e6d0d6de44c1e5f9235cbdc2a2512f40333b3201 (commit) from 95323837e6b19ed78a965d24e29a0720105e3967 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b9ea5cec481bf04821004ad80f1acb36f4d87d05 Author: QuzarDC <qu...@co...> Date: Sun May 11 23:32:04 2025 -0400 Clean up minor warnings in conio. Unused param being voided, thd_create was being compared to 0, and input_buffer pos was signed for no good reason. commit ae543453d3861d740206638b1aada20cf3fc6d6b Author: QuzarDC <qu...@co...> Date: Sun May 11 23:27:57 2025 -0400 Voidify functions. commit e6d0d6de44c1e5f9235cbdc2a2512f40333b3201 Author: QuzarDC <qu...@co...> Date: Sun May 11 23:12:43 2025 -0400 Fix missing includes. These had been imported through dbglog via stdio. ----------------------------------------------------------------------- Summary of changes: conio.c | 24 ++++++++++++++---------- draw.c | 6 +++--- include/conio.h | 18 +++++++++--------- include/draw.h | 6 +++--- include/input.h | 6 +++--- input.c | 20 ++++++++++---------- 6 files changed, 42 insertions(+), 38 deletions(-) diff --git a/conio.c b/conio.c index 7a0757c..d2c2395 100644 --- a/conio.c +++ b/conio.c @@ -10,6 +10,8 @@ #include <stdio.h> #include <string.h> #include <assert.h> +#include <unistd.h> +#include <kos/fs.h> #include <kos/thread.h> #include <kos/sem.h> #include <dc/maple/keyboard.h> @@ -34,7 +36,7 @@ static semaphore_t ft_mutex; file_t conio_serial_fd; /* scroll everything up a line */ -void conio_scroll() { +void conio_scroll(void) { int i; switch (conio_ttymode) { @@ -57,7 +59,7 @@ void conio_scroll() { } /* move the cursor back, don't scroll (we can't) */ -void conio_deadvance_cursor() { +void conio_deadvance_cursor(void) { switch (conio_ttymode) { case CONIO_TTY_PVR: conio_cursor.col--; @@ -87,7 +89,7 @@ void conio_deadvance_cursor() { } /* move the cursor ahead, scroll if we need to */ -void conio_advance_cursor() { +void conio_advance_cursor(void) { switch (conio_ttymode) { case CONIO_TTY_PVR: conio_cursor.col++; @@ -139,7 +141,7 @@ void conio_gotoxy(int x, int y) { } /* blocking call for a character */ -int conio_getch() { +int conio_getch(void) { int key = -1; uint8 b; @@ -183,7 +185,7 @@ int conio_getch() { } /* Check to see if a key has been pressed */ -int conio_check_getch() { +int conio_check_getch(void) { int key = -1; uint8 b; @@ -307,7 +309,7 @@ int conio_printf(const char *fmt, ...) { } /* clear the screen */ -void conio_clear() { +void conio_clear(void) { int row, col; switch (conio_ttymode) { @@ -330,12 +332,12 @@ void conio_clear() { } /* conio freeze (for sub-process taking over TA) */ -void conio_freeze() { +void conio_freeze(void) { sem_wait(&ft_mutex); } /* conio thaw */ -void conio_thaw() { +void conio_thaw(void) { sem_signal(&ft_mutex); } @@ -352,6 +354,8 @@ static volatile int conio_exit = 0; /* the drawing/keyboard polling thread */ static void *conio_thread(void *param) { + (void)param; + conio_entered = 1; while (!conio_exit) { sem_wait(&ft_mutex); @@ -406,7 +410,7 @@ int conio_init(int ttymode, int inputmode) { /* create the conio thread */ conio_exit = 0; - if (thd_create(1, conio_thread, 0) < 0) + if (!thd_create(1, conio_thread, 0)) return -1; /* Wait for it to actually start */ @@ -416,7 +420,7 @@ int conio_init(int ttymode, int inputmode) { return 0; } -int conio_shutdown() { +int conio_shutdown(void) { /* shutup our thread */ conio_exit = 1; diff --git a/draw.c b/draw.c index cc7c9b5..7d96e4f 100644 --- a/draw.c +++ b/draw.c @@ -16,7 +16,7 @@ static pvr_ptr_t font_texture = NULL; /* initialize draw stuff: get our texture of the font, etc */ -void conio_draw_init() { +void conio_draw_init(void) { uint16 *vram; int x, y; @@ -32,7 +32,7 @@ void conio_draw_init() { } } -void conio_draw_shutdown() { +void conio_draw_shutdown(void) { assert( font_texture != NULL ); pvr_mem_free(font_texture); } @@ -175,7 +175,7 @@ static void draw_cursor(float r, float g, float b) { } /* our exported drawing function: does a full redraw of everything */ -void conio_draw_frame() { +void conio_draw_frame(void) { pvr_wait_ready(); pvr_scene_begin(); pvr_list_begin(PVR_LIST_TR_POLY); diff --git a/include/conio.h b/include/conio.h index 95d4f35..147c829 100644 --- a/include/conio.h +++ b/include/conio.h @@ -33,19 +33,19 @@ extern char conio_virtscr[CONIO_NUM_ROWS][CONIO_NUM_COLS]; #endif /* functions */ -void conio_scroll(); -void conio_deadvance_cursor(); -void conio_advance_cursor(); +void conio_scroll(void); +void conio_deadvance_cursor(void); +void conio_advance_cursor(void); void conio_gotoxy(int x, int y); -int conio_getch(); -int conio_check_getch(); +int conio_getch(void); +int conio_check_getch(void); void conio_setch(int ch); void conio_putch(int ch); void conio_putstr(char *str); int conio_printf(const char *fmt, ...); -void conio_clear(); -void conio_freeze(); -void conio_thaw(); +void conio_clear(void); +void conio_freeze(void); +void conio_thaw(void); void conio_set_theme(int theme); /* Themes: @@ -74,7 +74,7 @@ void conio_set_theme(int theme); extern int conio_ttymode, conio_inputmode, conio_theme; int conio_init(int ttymode, int inputmode); -int conio_shutdown(); +int conio_shutdown(void); __END_DECLS diff --git a/include/draw.h b/include/draw.h index 05dd7e7..e327d7e 100644 --- a/include/draw.h +++ b/include/draw.h @@ -23,9 +23,9 @@ #define CONIO_SCREEN_LASTCOL (CONIO_SCREEN_WIDTH - CONIO_SCREEN_FIRSTCOL) /* functions */ -void conio_draw_init(); -void conio_draw_shutdown(); -void conio_draw_frame(); +void conio_draw_init(void); +void conio_draw_shutdown(void); +void conio_draw_frame(void); #endif /* __CONIO_DRAW_H */ diff --git a/include/input.h b/include/input.h index aedf700..fdc57d3 100644 --- a/include/input.h +++ b/include/input.h @@ -14,9 +14,9 @@ #define CONIO_INPUT_BUFFSIZE 256 /* functions */ -void conio_input_frame(); -void conio_input_init(); -void conio_input_shutdown(); +void conio_input_frame(void); +void conio_input_init(void); +void conio_input_shutdown(void); typedef void (*conio_input_callback_t)(const char *str); void conio_input_callback(conio_input_callback_t cb); diff --git a/input.c b/input.c index a61a0ae..7602105 100644 --- a/input.c +++ b/input.c @@ -22,7 +22,7 @@ /* the buffer for input */ static struct { char text[CONIO_INPUT_BUFFSIZE]; - int pos; /* pos in the buffer, not the screen */ + unsigned int pos; /* pos in the buffer, not the screen */ } input_buffer; /* the state var */ @@ -44,7 +44,7 @@ static volatile cb_sem_data_t *cb_queue; static semaphore_t cb_sem, cb_mutex; static volatile int cb_dead; -static void input_cb_init() { +static void input_cb_init(void) { sem_init(&cb_sem, 0); sem_init(&cb_mutex, 1); cb_queue = NULL; @@ -64,7 +64,7 @@ static void cb_default(const char *str) { sem_signal(&cb_sem); } -static void input_cb_shutdown() { +static void input_cb_shutdown(void) { cb_sem_data_t *t, *n; int i; @@ -167,7 +167,7 @@ static void input_insertbuff(int ch) { } /* remove the char at input_buffer.pos from the buffer, and reflect the changes on the virtscr */ -static void input_delchar_buff() { +static void input_delchar_buff(void) { int len; len = strlen(input_buffer.text); @@ -186,7 +186,7 @@ static void input_delchar_buff() { } /* print the prompt out, clear input buffer */ -static void input_prompt() { +static void input_prompt(void) { input_buffer.pos = 0; *input_buffer.text = '\0'; /* conio_putstr("> "); */ @@ -194,7 +194,7 @@ static void input_prompt() { } /* reading commands from the prompt */ -static void input_readcomm() { +static void input_readcomm(void) { int key; key = conio_check_getch(); @@ -243,25 +243,25 @@ static void input_readcomm() { } /* read command line, try to execute builtin commands, otherwise externals (this coming soon) */ -static void input_command() { +static void input_command(void) { input_state = INPUT_PROMPT; if (input_cb) input_cb(input_buffer.text); } -void conio_input_init() { +void conio_input_init(void) { input_cb_init(); input_cb = cb_default; } -void conio_input_shutdown() { +void conio_input_shutdown(void) { input_cb = NULL; input_cb_shutdown(); } /* our exported input function, called once per frame. */ -void conio_input_frame() { +void conio_input_frame(void) { switch (input_state) { case INPUT_PROMPT: input_prompt(); break; case INPUT_READCOMM: input_readcomm(); break; hooks/post-receive -- A KallistiOS implementation of conio. |