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
(18) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: kosmirror <kos...@us...> - 2025-07-26 14:01:56
|
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 9d8aabc8413b9cb5934524e77337276dcfa16eae (commit) from 1a93911dd0cd976c39cccb46f9be616417be14f2 (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 9d8aabc8413b9cb5934524e77337276dcfa16eae Author: GPF <tr...@ya...> Date: Fri Jul 25 13:26:50 2025 -0700 CMake: Set default installation directories only if not defined ----------------------------------------------------------------------- Summary of changes: utils/cmake/dreamcast.toolchain.cmake | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/utils/cmake/dreamcast.toolchain.cmake b/utils/cmake/dreamcast.toolchain.cmake index f6389686..4ff699b6 100644 --- a/utils/cmake/dreamcast.toolchain.cmake +++ b/utils/cmake/dreamcast.toolchain.cmake @@ -84,7 +84,10 @@ set(CMAKE_ASM_FLAGS_RELEASE "") # Default CMake installations to install to kos-addons set(CMAKE_INSTALL_BINDIR ${DC_TOOLS_BASE}) -set(CMAKE_INSTALL_INCLUDEDIR ${KOS_ADDONS}/include/${KOS_ARCH}) -set(CMAKE_INSTALL_LIBDIR ${KOS_ADDONS}/lib/${KOS_ARCH}) - +if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR) + set(CMAKE_INSTALL_INCLUDEDIR ${KOS_ADDONS}/include/${KOS_ARCH}) +endif() +if(NOT DEFINED CMAKE_INSTALL_LIBDIR) + set(CMAKE_INSTALL_LIBDIR ${KOS_ADDONS}/lib/${KOS_ARCH}) +endif() include("${KOS_BASE}/utils/cmake/dreamcast.cmake") hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-07-25 03:42: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 1a93911dd0cd976c39cccb46f9be616417be14f2 (commit) from c1cb580581d86fa0ed5cef83706e136bd540617f (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 1a93911dd0cd976c39cccb46f9be616417be14f2 Author: Troy Davis <tr...@ya...> Date: Thu Jul 24 20:41:30 2025 -0700 Fix keyboard LED state handling and add keyrawtest example (#1095) * Fix keyboard LED state handling and add keyrawtest example This change improves keyboard driver behavior by correctly tracking Caps Lock, Num Lock, and Scroll Lock LED states. It also adds a keyrawtest example which captures raw keyboard events using kbd_queue_pop(dev, 0), logs printable and special key inputs, and displays LED state changes in real time. Useful for debugging non-ASCII keys and verifying modifier behavior. ----------------------------------------------------------------------- Summary of changes: .../keyboard/{keytest => keyrawtest}/Makefile | 6 +- .../dreamcast/keyboard/keyrawtest/keyrawtest.c | 210 +++++++++++++++++++++ kernel/arch/dreamcast/hardware/maple/keyboard.c | 112 +++++++++-- 3 files changed, 309 insertions(+), 19 deletions(-) copy examples/dreamcast/keyboard/{keytest => keyrawtest}/Makefile (81%) create mode 100644 examples/dreamcast/keyboard/keyrawtest/keyrawtest.c diff --git a/examples/dreamcast/keyboard/keytest/Makefile b/examples/dreamcast/keyboard/keyrawtest/Makefile similarity index 81% copy from examples/dreamcast/keyboard/keytest/Makefile copy to examples/dreamcast/keyboard/keyrawtest/Makefile index 3806fa68..cdd792ab 100644 --- a/examples/dreamcast/keyboard/keytest/Makefile +++ b/examples/dreamcast/keyboard/keyrawtest/Makefile @@ -1,10 +1,12 @@ # KallistiOS ##version## # +# Copyright (C) 2025 Troy Davis +# # examples/dreamcast/keyboard/keytest/Makefile # -TARGET = keytest.elf -OBJS = keytest.o +TARGET = keyrawtest.elf +OBJS = keyrawtest.o all: rm-elf $(TARGET) diff --git a/examples/dreamcast/keyboard/keyrawtest/keyrawtest.c b/examples/dreamcast/keyboard/keyrawtest/keyrawtest.c new file mode 100644 index 00000000..e1143f8f --- /dev/null +++ b/examples/dreamcast/keyboard/keyrawtest/keyrawtest.c @@ -0,0 +1,210 @@ +/* KallistiOS ##version## + + keyrawtest.c + Copyright (C) 2018 Donald Haase + Copyright (C) 2025 Troy Davis + + This example demonstrates raw keyboard event handling on the Dreamcast, + expanding on the original keytest example. + + Improvements include: + - Uses kbd_queue_pop(dev, 0) to capture all key events, not just ASCII-typed ones. + - Displays the current LED state (Caps Lock, Num Lock, Scroll Lock) for each event. + - Logs raw scancodes and attempts to name special keys for debugging purposes. + - Displays printable ASCII characters on screen, as in the original example. + + This test is useful for: + - Verifying key mappings and modifier behavior. + - Confirming proper LED state toggling and reporting. + - Debugging keyboard driver improvements or hardware compatibility. + + Future enhancements could include: + - Multiple keyboard support. + - Non-US layout testing. + - Enhanced visual feedback or UI. +*/ + +#define WIDTH 640 +#define HEIGHT 480 +#define STARTLINE 20 +#define CHARSPERLINE 40 +#define CHARSPERTEST 120 + +#include <assert.h> +#include <kos.h> + +extern uint16 *vram_s; + +static cont_state_t *first_kbd_state; +static maple_device_t *first_kbd_dev = NULL; + +/* Track how many times we try to find a keyboard before just quitting. */ +static uint8 no_kbd_loop = 0; +/* This is set up to have multiple tests in the future. */ +static uint8 test_phase = 0; + +// Add this helper function above basic_typing() +static const char *kbd_key_name(kbd_key_t key) { + switch (key) { + case KBD_KEY_NONE: return "NONE"; + case KBD_KEY_ERROR: return "ERROR"; + case KBD_KEY_ERR2: return "ERR2"; + case KBD_KEY_ERR3: return "ERR3"; + case KBD_KEY_ENTER: return "ENTER"; + case KBD_KEY_ESCAPE: return "ESC"; + case KBD_KEY_BACKSPACE: return "BACKSPACE"; + case KBD_KEY_TAB: return "TAB"; + case KBD_KEY_SPACE: return "SPACE"; + case KBD_KEY_CAPSLOCK: return "CAPSLOCK"; + case KBD_KEY_INSERT: return "INSERT"; + case KBD_KEY_HOME: return "HOME"; + case KBD_KEY_PGUP: return "PGUP"; + case KBD_KEY_DEL: return "DEL"; + case KBD_KEY_END: return "END"; + case KBD_KEY_PGDOWN: return "PGDOWN"; + case KBD_KEY_RIGHT: return "RIGHT"; + case KBD_KEY_LEFT: return "LEFT"; + case KBD_KEY_DOWN: return "DOWN"; + case KBD_KEY_UP: return "UP"; + case KBD_KEY_PRINT: return "PRINT"; + case KBD_KEY_SCRLOCK: return "SCRLOCK"; + case KBD_KEY_PAUSE: return "PAUSE"; + case KBD_KEY_F1: return "F1"; + case KBD_KEY_F2: return "F2"; + case KBD_KEY_F3: return "F3"; + case KBD_KEY_F4: return "F4"; + case KBD_KEY_F5: return "F5"; + case KBD_KEY_F6: return "F6"; + case KBD_KEY_F7: return "F7"; + case KBD_KEY_F8: return "F8"; + case KBD_KEY_F9: return "F9"; + case KBD_KEY_F10: return "F10"; + case KBD_KEY_F11: return "F11"; + case KBD_KEY_F12: return "F12"; + case KBD_KEY_PAD_NUMLOCK: return "PAD_NUMLOCK"; + case KBD_KEY_PAD_DIVIDE: return "PAD_DIVIDE"; + case KBD_KEY_PAD_MULTIPLY: return "PAD_MULTIPLY"; + case KBD_KEY_PAD_MINUS: return "PAD_MINUS"; + case KBD_KEY_PAD_PLUS: return "PAD_PLUS"; + case KBD_KEY_PAD_ENTER: return "PAD_ENTER"; + case KBD_KEY_PAD_0: return "PAD_0"; + case KBD_KEY_PAD_1: return "PAD_1"; + case KBD_KEY_PAD_2: return "PAD_2"; + case KBD_KEY_PAD_3: return "PAD_3"; + case KBD_KEY_PAD_4: return "PAD_4"; + case KBD_KEY_PAD_5: return "PAD_5"; + case KBD_KEY_PAD_6: return "PAD_6"; + case KBD_KEY_PAD_7: return "PAD_7"; + case KBD_KEY_PAD_8: return "PAD_8"; + case KBD_KEY_PAD_9: return "PAD_9"; + case KBD_KEY_PAD_PERIOD: return "PAD_PERIOD"; + case KBD_KEY_S3: return "S3"; + default: return NULL; + } +} + +static void basic_typing(void) +{ + int charcount = 0; + int lines = 0; + uint32_t offset = ((STARTLINE + (lines * BFONT_HEIGHT)) * WIDTH); + bfont_draw_str(vram_s + offset, WIDTH, 1, "Test of raw typing. Enter 120 keys: "); + offset = ((STARTLINE + ((++lines) * BFONT_HEIGHT)) * WIDTH); + + while (charcount < CHARSPERTEST) { + int raw = kbd_queue_pop(first_kbd_dev, 0); + if(raw == KBD_QUEUE_END) continue; + + // Decode raw: 0x00FF = key, 0xFF00 = modifiers, 0xFF0000 = LEDs + kbd_key_t key = (kbd_key_t)(raw & 0xFF); + kbd_mods_t mods = { .raw = (raw >> 8) & 0xFF }; + kbd_leds_t leds = { .raw = (raw >> 16) & 0xFF }; + + kbd_state_t *kbd = maple_dev_status(first_kbd_dev); + if(!kbd) continue; + + char ascii = kbd_key_to_ascii(key, kbd->region, mods, leds); + + printf("LEDs: caps=%d num=%d scroll=%d\n", leds.caps_lock, leds.num_lock, leds.scroll_lock); + + // Show printable ASCII characters on screen + if(ascii >= 32 && ascii <= 126) { + bfont_draw(vram_s + offset, WIDTH, 1, ascii); + offset += BFONT_THIN_WIDTH; + charcount++; + if(!(charcount % CHARSPERLINE)) { + offset = ((STARTLINE + ((++lines) * BFONT_HEIGHT)) * WIDTH); + } + } + + // Log everything + char debug[128]; + const char *keyname = kbd_key_name(key); + + if(ascii >= 32 && ascii <= 126) { + snprintf(debug, sizeof(debug), + "RAW 0x%02X | ascii: %c | shift:%d caps:%d ctrl:%d alt:%d s1:%d s2:%d", + key, ascii, + mods.lshift || mods.rshift, + leds.caps_lock, + mods.lctrl || mods.rctrl, + mods.lalt || mods.ralt, + mods.s1, + mods.s2 + ); + } else if(keyname) { + snprintf(debug, sizeof(debug), + "RAW 0x%02X | key: %s | shift:%d caps:%d ctrl:%d alt:%d s1:%d s2:%d", + key, keyname, + mods.lshift || mods.rshift, + leds.caps_lock, + mods.lctrl || mods.rctrl, + mods.lalt || mods.ralt, + mods.s1, + mods.s2 + ); + } else { + snprintf(debug, sizeof(debug), + "RAW 0x%02X | key: 0x%02X | shift:%d caps:%d ctrl:%d alt:%d s1:%d s2:%d", + key, key, + mods.lshift || mods.rshift, + leds.caps_lock, + mods.lctrl || mods.rctrl, + mods.lalt || mods.ralt, + mods.s1, + mods.s2 + ); + } + + printf("%s\n", debug); + } +} + +int main(int argc, char **argv) +{ + for(;;) { + /* If the dev is null, refresh it. */ + while(first_kbd_dev == NULL) { + first_kbd_dev = maple_enum_type(0, MAPLE_FUNC_KEYBOARD); + /* If it's *still* null, wait a bit and check again. */ + if(first_kbd_dev == NULL) { + timer_spin_sleep(500); + no_kbd_loop++; + } + if( no_kbd_loop >= 25 ) return -1; + } + /* Reset the timeout counter */ + no_kbd_loop = 0; + + first_kbd_state = (cont_state_t *) maple_dev_status(first_kbd_dev); + if(first_kbd_state == NULL) assert_msg(0, "Invalid Keyboard state returned"); + + if(test_phase == 0) + basic_typing(); + else + break; + + test_phase++; + } + return 0; +} \ No newline at end of file diff --git a/kernel/arch/dreamcast/hardware/maple/keyboard.c b/kernel/arch/dreamcast/hardware/maple/keyboard.c index cfa087ef..13d3d409 100644 --- a/kernel/arch/dreamcast/hardware/maple/keyboard.c +++ b/kernel/arch/dreamcast/hardware/maple/keyboard.c @@ -6,6 +6,7 @@ Copyright (C) 2018, 2025 Donald Haase Copyright (C) 2024 Paul Cercueil Copyright (C) 2025 Falco Girgis + Copyright (C) 2025 Troy Davis */ #include <assert.h> @@ -45,12 +46,15 @@ typedef struct kbd_state_private { size_t queue_head; /**< \brief Key queue head. */ volatile size_t queue_len; /**< \brief Current length of queue. */ + kbd_leds_t leds; /**< \brief Persistent LED state for toggles */ + 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 them in the state, but I don't see a reason to. It seems unreasonable that one might want different repeat @@ -429,15 +433,31 @@ 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) { + // Only apply Caps Lock logic to AâZ keys + bool is_letter = (key >= KBD_KEY_A && key <= KBD_KEY_Z); + bool shift_effect = (mods.raw & KBD_MOD_SHIFT); + + if(is_letter && leds.caps_lock) { + shift_effect = !shift_effect; // Caps Lock toggles Shift effect + } + + // Handle keypad keys when Num Lock is involved + if(key >= KBD_KEY_PAD_1 && key <= KBD_KEY_PAD_PERIOD) { + if(leds.num_lock) { + return keymaps[region - 1].base[key]; // Treat like number/punctuation + } else { + return 0; // No ASCII when Num Lock is off (acts as navigation) + } + } - if(mods.ralt || (mods.lctrl && mods.lalt)) + if(mods.ralt || (mods.lctrl && mods.lalt)) { return keymaps[region - 1].alt[key]; - else if((mods.raw & KBD_MOD_SHIFT) || leds.caps_lock) + } else if(shift_effect) { return keymaps[region - 1].shifted[key]; - else + } 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; @@ -482,7 +502,7 @@ static int kbd_enqueue(kbd_state_private_t *state, kbd_key_t 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); + state->base.cond.modifiers, state->leds); if(ascii == 0) ascii = ((uint16_t)keycode) << 8; @@ -545,12 +565,13 @@ int kbd_queue_pop(maple_device_t *dev, bool xlat) { irq_restore(irqs); if(!xlat) - return (int)(rv.key & (rv.mods.raw << 8) & (rv.leds.raw << 16)); + return (int)(rv.key | (rv.mods.raw << 8) | (rv.leds.raw << 16)); - if((ascii = kbd_key_to_ascii(rv.key, state->base.region, rv.mods, rv.leds))) + ascii = kbd_key_to_ascii(rv.key, state->base.region, rv.mods, rv.leds); + if(ascii != 0) return (int)ascii; else - return (int)(rv.key << 8); + return (int)(rv.key | (rv.mods.raw << 8) | (rv.leds.raw << 16)); } /* Update the keyboard status; this will handle debounce handling as well as @@ -558,8 +579,9 @@ int kbd_queue_pop(maple_device_t *dev, bool xlat) { words so that we can store "special" keys as such. */ 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; + kbd_leds_t *leds = &pstate->leds; // persistent LED state + kbd_state_t *state = &pstate->base; + kbd_cond_t *cond = (kbd_cond_t *)&state->cond; size_t i; /* If the modifier keys have changed, end the key repeating. */ @@ -596,27 +618,83 @@ static void kbd_check_poll(maple_frame_t *frm) { else { /* Update key state */ state->key_states[cond->keys[i]].is_down = true; + kbd_key_t key = cond->keys[i]; + + // Handle toggle keys by modifying persistent LED state + if(key == KBD_KEY_CAPSLOCK && state->key_states[key].value == KEY_STATE_CHANGED_DOWN) { + leds->caps_lock ^= 1; + } else if(key == KBD_KEY_PAD_NUMLOCK && state->key_states[key].value == KEY_STATE_CHANGED_DOWN) { + leds->num_lock ^= 1; + } else if(key == KBD_KEY_SCRLOCK && state->key_states[key].value == KEY_STATE_CHANGED_DOWN) { + leds->scroll_lock ^= 1; + } + // Sync persistent LEDs into the state used by enqueue and event handlers + pstate->leds = *leds; + + // Substitute navigation keys if Num Lock is OFF + if(!leds->num_lock) { + switch (key) { + case KBD_KEY_PAD_8: key = KBD_KEY_UP; break; + case KBD_KEY_PAD_2: key = KBD_KEY_DOWN; break; + case KBD_KEY_PAD_4: key = KBD_KEY_LEFT; break; + case KBD_KEY_PAD_6: key = KBD_KEY_RIGHT; break; + case KBD_KEY_PAD_7: key = KBD_KEY_HOME; break; + case KBD_KEY_PAD_1: key = KBD_KEY_END; break; + case KBD_KEY_PAD_9: key = KBD_KEY_PGUP; break; + case KBD_KEY_PAD_3: key = KBD_KEY_PGDOWN; break; + case KBD_KEY_PAD_5: key = KBD_KEY_NONE; break; + case KBD_KEY_PAD_0: key = KBD_KEY_INSERT; break; + case KBD_KEY_PAD_PERIOD: key = KBD_KEY_DEL; break; + default: break; + } + } + + // Sync persistent LED state to cond + state->cond.leds = pstate->leds; /* If the key hadn't been pressed. */ if(state->key_states[cond->keys[i]].value == KEY_STATE_CHANGED_DOWN) { - kbd_enqueue(pstate, cond->keys[i]); - pstate->repeater.key = cond->keys[i]; - if(repeat_timing.start) - pstate->repeater.timeout = timer_ms_gettime64() + repeat_timing.start; + if(key != KBD_KEY_NONE) { + kbd_enqueue(pstate, key); + pstate->repeater.key = cond->keys[i]; + if(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->key_states[cond->keys[i]].value == KEY_STATE_HELD_DOWN) { + kbd_key_t held_key = cond->keys[i]; + + // Apply the same substitution again for held keys + if(!leds->num_lock) { + switch (held_key) { + case KBD_KEY_PAD_8: held_key = KBD_KEY_UP; break; + case KBD_KEY_PAD_2: held_key = KBD_KEY_DOWN; break; + case KBD_KEY_PAD_4: held_key = KBD_KEY_LEFT; break; + case KBD_KEY_PAD_6: held_key = KBD_KEY_RIGHT; break; + case KBD_KEY_PAD_7: held_key = KBD_KEY_HOME; break; + case KBD_KEY_PAD_1: held_key = KBD_KEY_END; break; + case KBD_KEY_PAD_9: held_key = KBD_KEY_PGUP; break; + case KBD_KEY_PAD_3: held_key = KBD_KEY_PGDOWN; break; + case KBD_KEY_PAD_5: held_key = KBD_KEY_NONE; break; + case KBD_KEY_PAD_0: held_key = KBD_KEY_INSERT; break; + case KBD_KEY_PAD_PERIOD: held_key = KBD_KEY_DEL; break; + default: break; + } + } + 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->repeater.timeout)) + if(time >= pstate->repeater.timeout) pstate->repeater.timeout = time + repeat_timing.interval; else continue; } - kbd_enqueue(pstate, cond->keys[i]); + if(held_key != KBD_KEY_NONE) { + kbd_enqueue(pstate, held_key); + } } } else assert_msg(0, "invalid key_states array detected"); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-07-23 13:54:20
|
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 c1cb580581d86fa0ed5cef83706e136bd540617f (commit) via d0aa287d71c37a265f0c4a49496aef07bc77f424 (commit) from f90f0f4b4df1828d16bf558799a627cb126d92a6 (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 c1cb580581d86fa0ed5cef83706e136bd540617f Author: Paul Cercueil <pa...@cr...> Date: Tue Jul 22 22:23:27 2025 +0200 pvr: Use to_pvr_txr_ptr() to factorize code Use to_pvr_txr_ptr() where it makes sense to factorize code. Signed-off-by: Paul Cercueil <pa...@cr...> commit d0aa287d71c37a265f0c4a49496aef07bc77f424 Author: Paul Cercueil <pa...@cr...> Date: Tue Jul 22 22:21:49 2025 +0200 pvr: Limit texture address to VRAM size in to_pvr_txr_ptr() The previous commit f2513c1e1 ("pvr: Limit texture address to VRAM size") missed one instance, the one in to_pvr_txr_ptr(). Signed-off-by: Paul Cercueil <pa...@cr...> ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/hardware/pvr/pvr_prim.c | 30 +++++++++++------------ kernel/arch/dreamcast/include/dc/pvr/pvr_header.h | 4 ++- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c b/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c index 3af1f0a3..a7460a4e 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c @@ -22,7 +22,8 @@ /* Compile a polygon context into a polygon header */ void pvr_poly_compile(pvr_poly_hdr_t *dst, const pvr_poly_cxt_t *src) { - uint32_t txr_base, cmd; + pvr_txr_ptr_t txr_base; + uint32_t cmd; /* Temporary variables we can read-write-modify, since we cannot do so from within the SQs, and we want to be able to compile this header from a PVR DR API submission target. */ @@ -81,13 +82,12 @@ void pvr_poly_compile(pvr_poly_hdr_t *dst, const pvr_poly_cxt_t *src) { | FIELD_PREP(PVR_TA_PM2_VSIZE, __builtin_ctz(src->txr.height) - 3); /* Convert the texture address */ - txr_base = (uint32_t)src->txr.base; - txr_base = (txr_base & (PVR_RAM_SIZE - 1)) >> 3; + txr_base = to_pvr_txr_ptr(src->txr.base); /* Polygon mode 3 */ mode3 = FIELD_PREP(PVR_TA_PM3_MIPMAP, src->txr.mipmap) | src->txr.format - | txr_base; + | (uint32_t)txr_base; } dst->mode2 = mode2; @@ -266,7 +266,8 @@ void pvr_sprite_cxt_txr(pvr_sprite_cxt_t *dst, pvr_list_t list, } void pvr_sprite_compile(pvr_sprite_hdr_t *dst, const pvr_sprite_cxt_t *src) { - uint32_t txr_base, cmd, mode2, mode3; + uint32_t cmd, mode2, mode3; + pvr_txr_ptr_t txr_base; /* Basically we just take each parameter, clip it, shift it into place, and OR it into the final result. */ @@ -317,13 +318,12 @@ void pvr_sprite_compile(pvr_sprite_hdr_t *dst, const pvr_sprite_cxt_t *src) { | FIELD_PREP(PVR_TA_PM2_VSIZE, __builtin_ctz(src->txr.height) - 3); /* Convert the texture address */ - txr_base = (uint32_t)src->txr.base; - txr_base = (txr_base & (PVR_RAM_SIZE - 1)) >> 3; + txr_base = to_pvr_txr_ptr(src->txr.base); /* Polygon mode 3 */ mode3 = FIELD_PREP(PVR_TA_PM3_MIPMAP, src->txr.mipmap) | src->txr.format - | txr_base; + | (uint32_t)txr_base; } dst->mode2 = mode2; @@ -351,8 +351,8 @@ void pvr_mod_compile(pvr_mod_hdr_t *dst, pvr_list_t list, uint32 mode, /* Compile a polygon context into a polygon header that is affected by modifier volumes */ void pvr_poly_mod_compile(pvr_poly_mod_hdr_t *dst, const pvr_poly_cxt_t *src) { - uint32_t txr_base, cmd; - uint32_t mode2, mode3; + uint32_t mode2, mode3, cmd; + pvr_txr_ptr_t txr_base; /* Basically we just take each parameter, clip it, shift it into place, and OR it into the final result. */ @@ -407,13 +407,12 @@ void pvr_poly_mod_compile(pvr_poly_mod_hdr_t *dst, const pvr_poly_cxt_t *src) { | FIELD_PREP(PVR_TA_PM2_VSIZE, __builtin_ctz(src->txr.height) - 3); /* Convert the texture address */ - txr_base = (uint32_t)src->txr.base; - txr_base = (txr_base & (PVR_RAM_SIZE - 1)) >> 3; + txr_base = to_pvr_txr_ptr(src->txr.base); /* Polygon mode 3 */ mode3 = FIELD_PREP(PVR_TA_PM3_MIPMAP, src->txr.mipmap) | src->txr.format - | txr_base; + | (uint32_t)txr_base; } dst->mode2_0 = mode2; @@ -447,13 +446,12 @@ void pvr_poly_mod_compile(pvr_poly_mod_hdr_t *dst, const pvr_poly_cxt_t *src) { | FIELD_PREP(PVR_TA_PM2_VSIZE, __builtin_ctz(src->txr2.height) - 3); /* Convert the texture address */ - txr_base = (uint32_t)src->txr2.base; - txr_base = (txr_base & (PVR_RAM_SIZE - 1)) >> 3; + txr_base = to_pvr_txr_ptr(src->txr.base); /* Polygon mode 3 */ mode3 = FIELD_PREP(PVR_TA_PM3_MIPMAP, src->txr2.mipmap) | src->txr2.format - | txr_base; + | (uint32_t)txr_base; } dst->mode2_1 = mode2; diff --git a/kernel/arch/dreamcast/include/dc/pvr/pvr_header.h b/kernel/arch/dreamcast/include/dc/pvr/pvr_header.h index f0cc12b6..860b3ea8 100644 --- a/kernel/arch/dreamcast/include/dc/pvr/pvr_header.h +++ b/kernel/arch/dreamcast/include/dc/pvr/pvr_header.h @@ -21,6 +21,8 @@ #include <sys/cdefs.h> __BEGIN_DECLS +#include <dc/pvr/pvr_regs.h> + /** \defgroup pvr_primitives_headers Headers \brief Structs relative to PVR headers \ingroup pvr_primitives @@ -214,7 +216,7 @@ typedef uint32_t pvr_txr_ptr_t; \return The pre-processed texture address */ static inline pvr_txr_ptr_t to_pvr_txr_ptr(pvr_ptr_t addr) { - return ((uint32_t)addr & 0x00fffff8) >> 3; + return ((uint32_t)addr & (PVR_RAM_SIZE - 1)) >> 3; } /** \brief Get texture address form VRAM address hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-07-23 03:02:02
|
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 f90f0f4b4df1828d16bf558799a627cb126d92a6 (commit) from 56c843d6eb9f48e8b90ed1d86f381508a3f00796 (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 f90f0f4b4df1828d16bf558799a627cb126d92a6 Author: Paul Cercueil <pa...@cr...> Date: Tue Jul 22 22:13:25 2025 +0200 CMake: Use absolute path for KOS variables The CMAKE_INSTALL_BINDIR and CMAKE_INSTALL_LIBDIR require absolute paths. Address this issue by using absolute paths for all KOS variables that contain paths. Signed-off-by: Paul Cercueil <pa...@cr...> ----------------------------------------------------------------------- Summary of changes: utils/cmake/dreamcast.toolchain.cmake | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/utils/cmake/dreamcast.toolchain.cmake b/utils/cmake/dreamcast.toolchain.cmake index 67f4f92e..f6389686 100644 --- a/utils/cmake/dreamcast.toolchain.cmake +++ b/utils/cmake/dreamcast.toolchain.cmake @@ -34,16 +34,16 @@ if(NOT DEFINED ENV{KOS_BASE} OR NOT DEFINED ENV{KOS_PORTS} OR NOT DEFINED ENV{DC_TOOLS_BASE}) message(FATAL_ERROR "KallistiOS environment variables not found") -else() - set(KOS_BASE $ENV{KOS_BASE}) - set(KOS_CC_BASE $ENV{KOS_CC_BASE}) - set(KOS_ARCH $ENV{KOS_ARCH}) - set(KOS_SUBARCH $ENV{KOS_SUBARCH}) - set(KOS_PORTS $ENV{KOS_PORTS}) - set(DC_TOOLS_BASE $ENV{DC_TOOLS_BASE}) - set(KOS_ADDONS ${KOS_BASE}/addons) endif() +file(REAL_PATH $ENV{KOS_BASE} KOS_BASE EXPAND_TILDE) +file(REAL_PATH $ENV{KOS_CC_BASE} KOS_CC_BASE EXPAND_TILDE) +file(REAL_PATH $ENV{KOS_PORTS} KOS_PORTS EXPAND_TILDE) +file(REAL_PATH $ENV{DC_TOOLS_BASE} DC_TOOLS_BASE EXPAND_TILDE) +set(KOS_ARCH $ENV{KOS_ARCH}) +set(KOS_SUBARCH $ENV{KOS_SUBARCH}) +set(KOS_ADDONS ${KOS_BASE}/addons) + list(APPEND CMAKE_MODULE_PATH $ENV{KOS_BASE}/utils/cmake) ##### Configure CMake System ##### hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-07-22 17:39:20
|
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 56c843d6eb9f48e8b90ed1d86f381508a3f00796 (commit) via 9a8fd7ae344366f5a7a3e8f316904a4ad53982e6 (commit) via 249068780cd97748249b97206eb8ed854a405da7 (commit) from aa71e4bf968432dd95d8b1bc083e50d7fac9adda (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 56c843d6eb9f48e8b90ed1d86f381508a3f00796 Author: Falco Girgis <gyr...@gm...> Date: Thu May 22 11:53:17 2025 -0500 CMAKE_INSTALL_BINDIR => DC_TOOLS_BASE. commit 9a8fd7ae344366f5a7a3e8f316904a4ad53982e6 Author: Falco Girgis <gyr...@gm...> Date: Thu May 22 11:40:28 2025 -0500 Addressed review feedback (kinda). commit 249068780cd97748249b97206eb8ed854a405da7 Author: Falco Girgis <gyr...@gm...> Date: Wed May 21 19:06:42 2025 -0500 Added CMake installation include and lib dirs. Modified dreamcast.toolchain.cmake to automatically configure CMake's two environment variables controlling where files get copied to when installing (CMAKE_INSTALL_INCLUDEDIR, CMAKE_INSTALL_LIBDIR) to automatically point to the proper locations within kos-ports. ----------------------------------------------------------------------- Summary of changes: utils/cmake/dreamcast.toolchain.cmake | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/utils/cmake/dreamcast.toolchain.cmake b/utils/cmake/dreamcast.toolchain.cmake index beb3696a..67f4f92e 100644 --- a/utils/cmake/dreamcast.toolchain.cmake +++ b/utils/cmake/dreamcast.toolchain.cmake @@ -1,6 +1,6 @@ # CMake Toolchain file for targeting the Dreamcast or NAOMI with CMake. # Copyright (C) 2023 Luke Benstead -# Copyright (C) 2023, 2024 Falco Girgis +# Copyright (C) 2023, 2024, 2025 Falco Girgis # Copyright (C) 2024 Donald Haase # Copyright (C) 2024 Paul Cercueil # @@ -29,14 +29,19 @@ cmake_minimum_required(VERSION 3.13) #### Set Configuration Variables From Environment #### if(NOT DEFINED ENV{KOS_BASE} OR NOT DEFINED ENV{KOS_CC_BASE} + OR NOT DEFINED ENV{KOS_ARCH} OR NOT DEFINED ENV{KOS_SUBARCH} - OR NOT DEFINED ENV{KOS_PORTS}) + OR NOT DEFINED ENV{KOS_PORTS} + OR NOT DEFINED ENV{DC_TOOLS_BASE}) message(FATAL_ERROR "KallistiOS environment variables not found") else() - set(KOS_BASE $ENV{KOS_BASE}) - set(KOS_CC_BASE $ENV{KOS_CC_BASE}) - set(KOS_SUBARCH $ENV{KOS_SUBARCH}) - set(KOS_PORTS $ENV{KOS_PORTS}) + set(KOS_BASE $ENV{KOS_BASE}) + set(KOS_CC_BASE $ENV{KOS_CC_BASE}) + set(KOS_ARCH $ENV{KOS_ARCH}) + set(KOS_SUBARCH $ENV{KOS_SUBARCH}) + set(KOS_PORTS $ENV{KOS_PORTS}) + set(DC_TOOLS_BASE $ENV{DC_TOOLS_BASE}) + set(KOS_ADDONS ${KOS_BASE}/addons) endif() list(APPEND CMAKE_MODULE_PATH $ENV{KOS_BASE}/utils/cmake) @@ -77,4 +82,9 @@ add_compile_options( set(CMAKE_ASM_FLAGS "") set(CMAKE_ASM_FLAGS_RELEASE "") +# Default CMake installations to install to kos-addons +set(CMAKE_INSTALL_BINDIR ${DC_TOOLS_BASE}) +set(CMAKE_INSTALL_INCLUDEDIR ${KOS_ADDONS}/include/${KOS_ARCH}) +set(CMAKE_INSTALL_LIBDIR ${KOS_ADDONS}/lib/${KOS_ARCH}) + include("${KOS_BASE}/utils/cmake/dreamcast.cmake") hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-07-22 14:32: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 aa71e4bf968432dd95d8b1bc083e50d7fac9adda (commit) from 4fbcde321da028f4d98ceb51839a53d6cf60917e (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 aa71e4bf968432dd95d8b1bc083e50d7fac9adda Author: QuzarDC <qu...@co...> Date: Fri Jul 18 23:16:58 2025 -0400 net: Replace `arch/types.h` types with stdint. ----------------------------------------------------------------------- Summary of changes: include/kos/net.h | 178 ++++++++++++++++++++++----------------------- kernel/net/net_arp.c | 49 +++++++------ kernel/net/net_core.c | 3 +- kernel/net/net_crc.c | 12 +-- kernel/net/net_dhcp.c | 45 ++++++------ kernel/net/net_dhcp.h | 34 ++++----- kernel/net/net_icmp.c | 47 ++++++------ kernel/net/net_icmp.h | 14 ++-- kernel/net/net_icmp6.c | 87 +++++++++++----------- kernel/net/net_icmp6.h | 140 +++++++++++++++++------------------ kernel/net/net_input.c | 7 +- kernel/net/net_ipv4.c | 61 ++++++++-------- kernel/net/net_ipv4.h | 36 ++++----- kernel/net/net_ipv4_frag.c | 34 ++++----- kernel/net/net_ipv6.c | 25 ++++--- kernel/net/net_ipv6.h | 20 ++--- kernel/net/net_multicast.c | 11 +-- kernel/net/net_ndp.c | 19 ++--- kernel/net/net_tcp.c | 18 ++--- kernel/net/net_thd.c | 9 ++- kernel/net/net_thd.h | 5 +- kernel/net/net_udp.c | 42 +++++------ 22 files changed, 452 insertions(+), 444 deletions(-) diff --git a/include/kos/net.h b/include/kos/net.h index 47363535..a23929af 100644 --- a/include/kos/net.h +++ b/include/kos/net.h @@ -21,9 +21,9 @@ #define __KOS_NET_H #include <sys/cdefs.h> +#include <stdint.h> __BEGIN_DECLS -#include <arch/types.h> #include <sys/queue.h> #include <netinet/in.h> @@ -65,28 +65,28 @@ typedef struct knetif { int index; /** \brief Internal device ID (for whatever the driver wants) */ - uint32 dev_id; + uint32_t dev_id; /** \brief Interface flags */ - uint32 flags; + uint32_t flags; /** \brief The device's MAC address */ - uint8 mac_addr[6]; + uint8_t mac_addr[6]; /** \brief The device's IP address (if any) */ - uint8 ip_addr[4]; + uint8_t ip_addr[4]; /** \brief The device's netmask */ - uint8 netmask[4]; + uint8_t netmask[4]; /** \brief The device's gateway's IP address */ - uint8 gateway[4]; + uint8_t gateway[4]; /** \brief The device's broadcast address */ - uint8 broadcast[4]; + uint8_t broadcast[4]; /** \brief The device's DNS server address */ - uint8 dns[4]; + uint8_t dns[4]; /** \brief The device's MTU */ int mtu; @@ -104,7 +104,7 @@ typedef struct knetif { struct in6_addr ip6_gateway; /** \brief Default MTU over IPv6 */ - uint32 mtu6; + uint32_t mtu6; /** \brief Default hop limit over IPv6 */ int hop_limit; @@ -117,31 +117,31 @@ typedef struct knetif { \param self The network device in question. \return 0 on success, <0 on failure. */ - int (*if_detect)(struct knetif * self); + int (*if_detect)(struct knetif *self); /** \brief Initialize the device. \param self The network device in question. \return 0 on success, <0 on failure. */ - int (*if_init)(struct knetif * self); + int (*if_init)(struct knetif *self); /** \brief Shutdown the device. \param self The network device in question. \return 0 on success, <0 on failure. */ - int (*if_shutdown)(struct knetif * self); + int (*if_shutdown)(struct knetif *self); /** \brief Start the device (after init or stop). \param self The network device in question. \return 0 on success, <0 on failure. */ - int (*if_start)(struct knetif * self); + int (*if_start)(struct knetif *self); /** \brief Stop (hibernate) the device. \param self The network device in question. \return 0 on success, <0 on failure */ - int (*if_stop)(struct knetif * self); + int (*if_stop)(struct knetif *self); /** \brief Queue a packet for transmission. \param self The network device in question. @@ -152,20 +152,20 @@ typedef struct knetif { \retval NETIF_TX_ERROR On general failure. \retval NETIF_TX_AGAIN If non-blocking and we must block to send. */ - int (*if_tx)(struct knetif * self, const uint8 * data, int len, + int (*if_tx)(struct knetif *self, const uint8_t *data, int len, int blocking); /** \brief Commit any queued output packets. \param self The network device in question. \return 0 on success, <0 on failure. */ - int (*if_tx_commit)(struct knetif * self); + int (*if_tx_commit)(struct knetif *self); /** \brief Poll for queued receive packets, if necessary. \param self The network device in question. \return 0 on success, <0 on failure. */ - int (*if_rx_poll)(struct knetif * self); + int (*if_rx_poll)(struct knetif *self); /** \brief Set flags; you should generally manipulate flags through here so that the driver gets a chance to act on the info. @@ -173,14 +173,14 @@ typedef struct knetif { \param flags_and Bitmask to and with the flags. \param flags_or Bitmask to or with the flags. */ - int (*if_set_flags)(struct knetif * self, uint32 flags_and, uint32 flags_or); + int (*if_set_flags)(struct knetif *self, uint32_t flags_and, uint32_t flags_or); /** \brief Set the device's multicast list. \param self The network device in question. \param list The list of MAC addresses (6 * count bytes). \param count The number of addresses in list. */ - int (*if_set_mc)(struct knetif *self, const uint8 *list, int count); + int (*if_set_mc)(struct knetif *self, const uint8_t *list, int count); } netif_t; /** \defgroup net_drivers_flags netif_t Flags @@ -237,16 +237,16 @@ LIST_HEAD(netif_list, knetif); \ingroup networking_ipv4 */ typedef struct ip_hdr_s { - uint8 version_ihl; /**< \brief IP version and header length */ - uint8 tos; /**< \brief Type of Service */ - uint16 length; /**< \brief Length */ - uint16 packet_id; /**< \brief Packet ID */ - uint16 flags_frag_offs; /**< \brief Flags and fragment offset */ - uint8 ttl; /**< \brief Time to live */ - uint8 protocol; /**< \brief IP protocol */ - uint16 checksum; /**< \brief IP checksum */ - uint32 src; /**< \brief Source IP address */ - uint32 dest; /**< \brief Destination IP address */ + uint8_t version_ihl; /**< \brief IP version and header length */ + uint8_t tos; /**< \brief Type of Service */ + uint16_t length; /**< \brief Length */ + uint16_t packet_id; /**< \brief Packet ID */ + uint16_t flags_frag_offs; /**< \brief Flags and fragment offset */ + uint8_t ttl; /**< \brief Time to live */ + uint8_t protocol; /**< \brief IP protocol */ + uint16_t checksum; /**< \brief IP checksum */ + uint32_t src; /**< \brief Source IP address */ + uint32_t dest; /**< \brief Destination IP address */ } __packed ip_hdr_t; /** \defgroup networking_ipv6 IPv6 @@ -259,14 +259,14 @@ typedef struct ip_hdr_s { \ingroup networking_ipv6 */ typedef struct ipv6_hdr_s { - uint8 version_lclass; /**< \brief Version and low-order class + uint8_t version_lclass; /**< \brief Version and low-order class byte */ - uint8 hclass_lflow; /**< \brief High-order class byte, low-order + uint8_t hclass_lflow; /**< \brief High-order class byte, low-order flow byte */ - uint16 lclass; /**< \brief Low-order class byte */ - uint16 length; /**< \brief Length */ - uint8 next_header; /**< \brief Next header type */ - uint8 hop_limit; /**< \brief Hop limit */ + uint16_t lclass; /**< \brief Low-order class byte */ + uint16_t length; /**< \brief Length */ + uint8_t next_header; /**< \brief Next header type */ + uint8_t hop_limit; /**< \brief Hop limit */ struct in6_addr src_addr; /**< \brief Source IP address */ struct in6_addr dst_addr; /**< \brief Destination IP address */ } __packed ipv6_hdr_t; @@ -303,8 +303,8 @@ void net_arp_shutdown(void); \retval 0 On success. \retval -1 Error allocating memory. */ -int net_arp_insert(netif_t *nif, const uint8 mac[6], const uint8 ip[4], - uint64 timestamp); +int net_arp_insert(netif_t *nif, const uint8_t mac[6], const uint8_t ip[4], + uint64_t timestamp); /** \brief Look up an entry from the ARP cache. \ingroup networking_arp @@ -326,8 +326,8 @@ int net_arp_insert(netif_t *nif, const uint8 mac[6], const uint8 ip[4], \retval -2 Address not found, query generated. \retval -3 Error allocating memory. */ -int net_arp_lookup(netif_t *nif, const uint8 ip_in[4], uint8 mac_out[6], - const ip_hdr_t *pkt, const uint8 *data, int data_size); +int net_arp_lookup(netif_t *nif, const uint8_t ip_in[4], uint8_t mac_out[6], + const ip_hdr_t *pkt, const uint8_t *data, int data_size); /** \brief Do a reverse ARP lookup. \ingroup networking_arp @@ -342,7 +342,7 @@ int net_arp_lookup(netif_t *nif, const uint8 ip_in[4], uint8 mac_out[6], \retval 0 On success. \retval -1 On failure. */ -int net_arp_revlookup(netif_t *nif, uint8 ip_out[4], const uint8 mac_in[6]); +int net_arp_revlookup(netif_t *nif, uint8_t ip_out[4], const uint8_t mac_in[6]); /** \brief Receive an ARP packet and process it (called by net_input). \ingroup networking_arp @@ -353,7 +353,7 @@ int net_arp_revlookup(netif_t *nif, uint8 ip_out[4], const uint8 mac_in[6]); \retval 0 On success (no error conditions defined). */ -int net_arp_input(netif_t *nif, const uint8 *pkt, int len); +int net_arp_input(netif_t *nif, const uint8_t *pkt, int len); /** \brief Generate an ARP who-has query on the given device. \ingroup networking_arp @@ -363,7 +363,7 @@ int net_arp_input(netif_t *nif, const uint8 *pkt, int len); \retval 0 On success (no error conditions defined). */ -int net_arp_query(netif_t *nif, const uint8 ip[4]); +int net_arp_query(netif_t *nif, const uint8_t ip[4]); /***** net_input.c *********************************************************/ @@ -377,7 +377,7 @@ int net_arp_query(netif_t *nif, const uint8 ip[4]); \return 0 on success, <0 on failure. */ -typedef int (*net_input_func)(netif_t *nif, const uint8 *pkt, int len); +typedef int (*net_input_func)(netif_t *nif, const uint8_t *pkt, int len); /** \brief Where will input packets be routed? \ingroup networking_drivers @@ -397,7 +397,7 @@ extern net_input_func net_input_target; \return 0 on success, <0 on failure. */ -int net_input(netif_t *device, const uint8 *data, int len); +int net_input(netif_t *device, const uint8_t *data, int len); /** \brief Setup a network input target. \ingroup networking_drivers @@ -431,8 +431,8 @@ net_input_func net_input_set_target(net_input_func t); \param data Any data in the packet. \param len The length of the data, in bytes. */ -typedef void (*net_echo_cb)(const uint8 *ip, uint16 seq, uint64 delta_us, - uint8 ttl, const uint8 *data, size_t len); +typedef void (*net_echo_cb)(const uint8_t *ip, uint16_t seq, uint64_t delta_us, + uint8_t ttl, const uint8_t *data, size_t len); /** \brief Where will we handle possibly notifying the user of ping replies? \ingroup networking_icmp @@ -451,8 +451,8 @@ extern net_echo_cb net_icmp_echo_cb; \return 0 on success, <0 on failure. */ -int net_icmp_send_echo(netif_t *net, const uint8 ipaddr[4], uint16 ident, - uint16 seq, const uint8 *data, size_t size); +int net_icmp_send_echo(netif_t *net, const uint8_t ipaddr[4], uint16_t ident, + uint16_t seq, const uint8_t *data, size_t size); /** \defgroup networking_icmp_unreach Unreachable Values \brief Valid values for net_icmp_send_dest_unreach(). @@ -473,7 +473,7 @@ int net_icmp_send_echo(netif_t *net, const uint8 ipaddr[4], uint16 ident, \return 0 on success, <0 on failure. */ -int net_icmp_send_dest_unreach(netif_t *net, uint8 code, const uint8 *msg); +int net_icmp_send_dest_unreach(netif_t *net, uint8_t code, const uint8_t *msg); /** \brief Valid values for the code in the net_icmp_send_time_exceeded() function. @@ -490,7 +490,7 @@ int net_icmp_send_dest_unreach(netif_t *net, uint8 code, const uint8 *msg); \return 0 on success, <0 on failure. */ -int net_icmp_send_time_exceeded(netif_t *net, uint8 code, const uint8 *msg); +int net_icmp_send_time_exceeded(netif_t *net, uint8_t code, const uint8_t *msg); /***** net_ipv4.c *********************************************************/ @@ -503,12 +503,12 @@ int net_icmp_send_time_exceeded(netif_t *net, uint8 code, const uint8 *msg); \headerfile kos/net.h */ typedef struct net_ipv4_stats { - uint32 pkt_sent; /** \brief Packets sent out successfully */ - uint32 pkt_send_failed; /** \brief Packets that failed to send */ - uint32 pkt_recv; /** \brief Packets received successfully */ - uint32 pkt_recv_bad_size; /** \brief Packets of a bad size */ - uint32 pkt_recv_bad_chksum; /** \brief Packets with a bad checksum */ - uint32 pkt_recv_bad_proto; /** \brief Packets with an unknown proto */ + uint32_t pkt_sent; /** \brief Packets sent out successfully */ + uint32_t pkt_send_failed; /** \brief Packets that failed to send */ + uint32_t pkt_recv; /** \brief Packets received successfully */ + uint32_t pkt_recv_bad_size; /** \brief Packets of a bad size */ + uint32_t pkt_recv_bad_chksum; /** \brief Packets with a bad checksum */ + uint32_t pkt_recv_bad_proto; /** \brief Packets with an unknown proto */ } net_ipv4_stats_t; /** \brief Retrieve statistics from the IPv4 layer. @@ -526,7 +526,7 @@ net_ipv4_stats_t net_ipv4_get_stats(void); \return The address, in host byte order. */ -uint32 net_ipv4_address(const uint8 addr[4]); +uint32_t net_ipv4_address(const uint8_t addr[4]); /** \brief Parse an IP address that is packet into a uint32 into an array of the individual bytes. @@ -535,7 +535,7 @@ uint32 net_ipv4_address(const uint8 addr[4]); \param addr The full address, in host byte order. \param out The output buffer. */ -void net_ipv4_parse_address(uint32 addr, uint8 out[4]); +void net_ipv4_parse_address(uint32_t addr, uint8_t out[4]); /***** net_icmp6.c ********************************************************/ @@ -555,8 +555,8 @@ void net_ipv4_parse_address(uint32 addr, uint8 out[4]); \param data Any data in the packet. \param len The length of the data, in bytes. */ -typedef void (*net6_echo_cb)(const struct in6_addr *ip, uint16 seq, - uint64 delta_us, uint8 hlim, const uint8 *data, +typedef void (*net6_echo_cb)(const struct in6_addr *ip, uint16_t seq, + uint64_t delta_us, uint8_t hlim, const uint8_t *data, size_t len); /** \brief Where will we handle possibly notifying the user of ping replies? @@ -576,8 +576,8 @@ extern net6_echo_cb net_icmp6_echo_cb; \return 0 on success, <0 on failure. */ -int net_icmp6_send_echo(netif_t *net, const struct in6_addr *dst, uint16 ident, - uint16 seq, const uint8 *data, size_t size); +int net_icmp6_send_echo(netif_t *net, const struct in6_addr *dst, uint16_t ident, + uint16_t seq, const uint8_t *data, size_t size); /** \brief Send a Neighbor Solicitation packet on the specified device. \ingroup networking_icmpv6 @@ -641,7 +641,7 @@ int net_icmp6_send_rsol(netif_t *net); \return 0 on success, <0 on failure. */ -int net_icmp6_send_dest_unreach(netif_t *net, uint8 code, const uint8 *ppkt, +int net_icmp6_send_dest_unreach(netif_t *net, uint8_t code, const uint8_t *ppkt, size_t psz); /** \defgroup networking_icmpv6_time_exceeded Time Exceeded Codes @@ -666,7 +666,7 @@ int net_icmp6_send_dest_unreach(netif_t *net, uint8 code, const uint8 *ppkt, \return 0 on success, <0 on failure. */ -int net_icmp6_send_time_exceeded(netif_t *net, uint8 code, const uint8 *ppkt, +int net_icmp6_send_time_exceeded(netif_t *net, uint8_t code, const uint8_t *ppkt, size_t psz); /** \defgroup networking_icmpv6_param_problem Parameter Problem Codes @@ -690,8 +690,8 @@ int net_icmp6_send_time_exceeded(netif_t *net, uint8 code, const uint8 *ppkt, \return 0 on success, <0 on failure. */ -int net_icmp6_send_param_prob(netif_t *net, uint8 code, uint32 ptr, - const uint8 *ppkt, size_t psz); +int net_icmp6_send_param_prob(netif_t *net, uint8_t code, uint32_t ptr, + const uint8_t *ppkt, size_t psz); /***** net_ipv6.c *********************************************************/ @@ -704,12 +704,12 @@ int net_icmp6_send_param_prob(netif_t *net, uint8 code, uint32 ptr, \headerfile kos/net.h */ typedef struct net_ipv6_stats { - uint32 pkt_sent; /**< \brief Packets sent out successfully */ - uint32 pkt_send_failed; /**< \brief Packets that failed to send */ - uint32 pkt_recv; /**< \brief Packets received successfully */ - uint32 pkt_recv_bad_size; /**< \brief Packets of a bad size */ - uint32 pkt_recv_bad_proto; /**< \brief Packets with an unknown proto */ - uint32 pkt_recv_bad_ext; /**< \brief Packets with an unknown hdr */ + uint32_t pkt_sent; /**< \brief Packets sent out successfully */ + uint32_t pkt_send_failed; /**< \brief Packets that failed to send */ + uint32_t pkt_recv; /**< \brief Packets received successfully */ + uint32_t pkt_recv_bad_size; /**< \brief Packets of a bad size */ + uint32_t pkt_recv_bad_proto; /**< \brief Packets with an unknown proto */ + uint32_t pkt_recv_bad_ext; /**< \brief Packets with an unknown hdr */ } net_ipv6_stats_t; /** \brief Retrieve statistics from the IPv6 layer. @@ -747,7 +747,7 @@ void net_ndp_gc(void); \param unsol Was this unsolicited? \return 0 on success, <0 on failure. */ -int net_ndp_insert(netif_t *nif, const uint8 mac[6], const struct in6_addr *ip, +int net_ndp_insert(netif_t *nif, const uint8_t mac[6], const struct in6_addr *ip, int unsol); /** \brief Look up an entry from the NDP cache. @@ -765,8 +765,8 @@ int net_ndp_insert(netif_t *nif, const uint8 mac[6], const struct in6_addr *ip, \param data_size The size of data. \return 0 on success, <0 on failure. */ -int net_ndp_lookup(netif_t *net, const struct in6_addr *ip, uint8 mac_out[6], - const ipv6_hdr_t *pkt, const uint8 *data, int data_size); +int net_ndp_lookup(netif_t *net, const struct in6_addr *ip, uint8_t mac_out[6], + const ipv6_hdr_t *pkt, const uint8_t *data, int data_size); /** @} */ @@ -786,12 +786,12 @@ int net_ndp_lookup(netif_t *net, const struct in6_addr *ip, uint8 mac_out[6], \headerfile kos/net.h */ typedef struct net_udp_stats { - uint32 pkt_sent; /**< \brief Packets sent out successfully */ - uint32 pkt_send_failed; /**< \brief Packets that failed to send */ - uint32 pkt_recv; /**< \brief Packets received successfully */ - uint32 pkt_recv_bad_size; /**< \brief Packets of a bad size */ - uint32 pkt_recv_bad_chksum; /**< \brief Packets with a bad checksum */ - uint32 pkt_recv_no_sock; /**< \brief Packets with to a closed port */ + uint32_t pkt_sent; /**< \brief Packets sent out successfully */ + uint32_t pkt_send_failed; /**< \brief Packets that failed to send */ + uint32_t pkt_recv; /**< \brief Packets received successfully */ + uint32_t pkt_recv_bad_size; /**< \brief Packets of a bad size */ + uint32_t pkt_recv_bad_chksum; /**< \brief Packets with a bad checksum */ + uint32_t pkt_recv_no_sock; /**< \brief Packets with to a closed port */ } net_udp_stats_t; /** \brief Retrieve statistics from the UDP layer. @@ -844,7 +844,7 @@ void net_tcp_shutdown(void); \return The calculated CRC-32. */ -uint32 net_crc32le(const uint8 *data, int size); +uint32_t net_crc32le(const uint8_t *data, int size); /** \brief Calculate a "big-endian" CRC-32 over a block of data. @@ -853,7 +853,7 @@ uint32 net_crc32le(const uint8 *data, int size); \return The calculated CRC-32. */ -uint32 net_crc32be(const uint8 *data, int size); +uint32_t net_crc32be(const uint8_t *data, int size); /** \brief Calculate a CRC16-CCITT over a block of data. @@ -869,7 +869,7 @@ uint32 net_crc32be(const uint8 *data, int size); \return The calculated CRC16-CCITT. */ -uint16 net_crc16ccitt(const uint8 *data, int size, uint16 start); +uint16_t net_crc16ccitt(const uint8_t *data, int size, uint16_t start); /** @} */ @@ -889,7 +889,7 @@ uint16 net_crc16ccitt(const uint8 *data, int size, uint16 start); \param mac The MAC address to add. \return 0 on success, <0 on failure. */ -int net_multicast_add(const uint8 mac[6]); +int net_multicast_add(const uint8_t mac[6]); /** \brief Delete a entry from our multicast list. @@ -899,7 +899,7 @@ int net_multicast_add(const uint8 mac[6]); \param mac The MAC address to add. \return 0 on success, <0 on failure. */ -int net_multicast_del(const uint8 mac[6]); +int net_multicast_del(const uint8_t mac[6]); /** \brief Check if an address is on the multicast list. \param mac The MAC address to check for. @@ -907,7 +907,7 @@ int net_multicast_del(const uint8 mac[6]); \retval 1 The address is in the list. \retval -1 On error. ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-07-22 14:31:48
|
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 4fbcde321da028f4d98ceb51839a53d6cf60917e (commit) from 3584da22a17238fda26cc32ccffe9cfac16d68b7 (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 4fbcde321da028f4d98ceb51839a53d6cf60917e Author: QuzarDC <qu...@co...> Date: Fri Jul 18 11:48:07 2025 -0400 vmulcd: Correct data type of vmu fb. There was, for some reason, a mix of the signed `char` and unsigned `uint8_t` as the types for the vmu fb. This caused possible unsigned conversion warning/errors when manipulating the data. Switched to `uint8_t` universally as the usage is for data we need to have specified by the width of it. ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/vmu/vmu_lcd/lcd.c | 2 +- kernel/arch/dreamcast/include/dc/vmu_fb.h | 12 ++++++------ kernel/arch/dreamcast/util/vmu_fb.c | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/dreamcast/vmu/vmu_lcd/lcd.c b/examples/dreamcast/vmu/vmu_lcd/lcd.c index 904a7e27..7cb4ba68 100644 --- a/examples/dreamcast/vmu/vmu_lcd/lcd.c +++ b/examples/dreamcast/vmu/vmu_lcd/lcd.c @@ -30,7 +30,7 @@ #include <arch/arch.h> -static const char smiley[] = { +static const uint8_t smiley[] = { 0b00111100, 0b01000010, 0b10100101, diff --git a/kernel/arch/dreamcast/include/dc/vmu_fb.h b/kernel/arch/dreamcast/include/dc/vmu_fb.h index be72c8db..fab2ab53 100644 --- a/kernel/arch/dreamcast/include/dc/vmu_fb.h +++ b/kernel/arch/dreamcast/include/dc/vmu_fb.h @@ -50,11 +50,11 @@ typedef struct vmufb { layout, and a pointer to the raw font data. */ typedef struct vmufb_font { - unsigned int id; /**< Font id */ - unsigned int w; /**< Character width in pixels */ - unsigned int h; /**< Character height in pixels */ - size_t stride; /**< Size of one character in bytes */ - const char *fontdata; /**< Pointer to the font data */ + unsigned int id; /**< Font id */ + unsigned int w; /**< Character width in pixels */ + unsigned int h; /**< Character height in pixels */ + size_t stride; /**< Size of one character in bytes */ + const uint8_t *fontdata; /**< Pointer to the font data */ } vmufb_font_t; /** \brief Render into the VMU framebuffer @@ -75,7 +75,7 @@ typedef struct vmufb_font { void vmufb_paint_area(vmufb_t *fb, unsigned int x, unsigned int y, unsigned int w, unsigned int h, - const char *data); + const uint8_t *data); /** \brief Clear a specific area of the VMU framebuffer diff --git a/kernel/arch/dreamcast/util/vmu_fb.c b/kernel/arch/dreamcast/util/vmu_fb.c index f3a8f3ca..ca3b50d0 100644 --- a/kernel/arch/dreamcast/util/vmu_fb.c +++ b/kernel/arch/dreamcast/util/vmu_fb.c @@ -21,7 +21,7 @@ * Created by Kenneth Albanowski. * No rights reserved, released to the public domain. */ -static const char fontdata_4x6[] = { +static const uint8_t fontdata_4x6[] = { 0xee, 0xee, 0xe0, 0xee, 0xee, 0xe0, 0xee, 0xee, 0xe0, 0xee, 0xee, 0xe0, 0xee, 0xee, 0xe0, 0xee, 0xee, 0xe0, 0xee, 0xee, 0xe0, 0xee, 0xee, 0xe0, @@ -204,8 +204,8 @@ static void vmufb_paint_area_strided(vmufb_t *fb, void vmufb_paint_area(vmufb_t *fb, unsigned int x, unsigned int y, unsigned int w, unsigned int h, - const char *data) { - vmufb_paint_area_strided(fb, x, y, w, h, w, (const uint8_t *)data); + const uint8_t *data) { + vmufb_paint_area_strided(fb, x, y, w, h, w, data); } void vmufb_paint_xbm(vmufb_t *fb, @@ -230,7 +230,7 @@ void vmufb_clear_area(vmufb_t *fb, unsigned int w, unsigned int h) { uint32_t tmp[VMU_SCREEN_WIDTH] = {}; - vmufb_paint_area(fb, x, y, w, h, (const char *) tmp); + vmufb_paint_area(fb, x, y, w, h, (const uint8_t *) tmp); } void vmufb_present(const vmufb_t *fb, maple_device_t *dev) { hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-07-22 14:31: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 3584da22a17238fda26cc32ccffe9cfac16d68b7 (commit) from a543e28f6aa7273d4426e6c6b117bb696f3a5d7d (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 3584da22a17238fda26cc32ccffe9cfac16d68b7 Author: QuzarDC <qu...@co...> Date: Fri Jul 18 09:54:17 2025 -0400 Update version number for current master. Moving forward I believe this should be the way we operate. After a version is cut, we set master to the next version patch version. This should allow for more consistent ability to test with the presumption that master is a higher version than the most recent one. ----------------------------------------------------------------------- Summary of changes: include/kos/version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/kos/version.h b/include/kos/version.h index 572692b2..19f28f34 100644 --- a/include/kos/version.h +++ b/include/kos/version.h @@ -72,7 +72,7 @@ ## App Versioning The same \ref version_utils used to implement the KOS versioning - API are available as part of the public API so that they may be used to + API are available as part of the public API so that they may be used to implement your own similar versioning scheme at the app-level. @{ @@ -99,7 +99,7 @@ #define KOS_VERSION_MAJOR 2 /**< KOS's current major revision number. */ #define KOS_VERSION_MINOR 2 /**< KOS's current minor revision number. */ -#define KOS_VERSION_PATCH 0 /**< KOS's current patch revision number. */ +#define KOS_VERSION_PATCH 1 /**< KOS's current patch revision number. */ /** KOS's current version as an integer ID. */ #define KOS_VERSION \ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-07-18 00:55: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 pseudo Operating System for the Dreamcast.". The branch, master has been updated via a543e28f6aa7273d4426e6c6b117bb696f3a5d7d (commit) via 33fd131d59ae2d6849dc079f60beb9959f48892c (commit) via f2513c1e1108aef3c59663c66cfb5de32b94f54d (commit) via 037b33521fb4886859d325f933fdeeeb9c324ba6 (commit) from b506f90239ec1e3383d8830225494d547042aaf4 (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 a543e28f6aa7273d4426e6c6b117bb696f3a5d7d Author: Paul Cercueil <pa...@cr...> Date: Fri Jul 4 22:30:47 2025 +0200 examples: Add fb_tex example This example demonstrates a trick that allows the framebuffer to be used as a texture. Signed-off-by: Paul Cercueil <pa...@cr...> commit 33fd131d59ae2d6849dc079f60beb9959f48892c Author: Paul Cercueil <pa...@cr...> Date: Tue Jul 8 23:12:28 2025 +0200 pvr: Update pvr_get_front_buffer() Previously, the VRAM offset of the front buffer was doubled, and then masked to the VRAM size. This effectively meant that for a front buffer at VRAM address 0x400000, we would get VRAM address 0x0. This actually works, as the front buffer lies in 32-bit space while textures lie in 64-bit space; the framebuffer at that address could then be used as a texture from VRAM address 0x0 with specifically crafted U/V values. The problem with the previous implementation is that due to the masking, the calling code has no way to know if the front buffer resides in the lower 4 MiB of VRAM, or the upper 4 MiB of VRAM - and this information is needed for using the front buffer as a texture. Update the function so that it does clamp the front buffer address to the VRAM size before the doubling, and not after. With the example above, the address computed for the front buffer would be 0x800000, which is bigger than the VRAM size. This does not matter, as the poly compile functions will clamp the texture address to the VRAM size. But it will allow the calling code to know if the front buffer is in the low or high VRAM. Signed-off-by: Paul Cercueil <pa...@cr...> commit f2513c1e1108aef3c59663c66cfb5de32b94f54d Author: Paul Cercueil <pa...@cr...> Date: Tue Jul 8 23:08:55 2025 +0200 pvr: Limit texture addresses to VRAM size Previously, the various compile functions would apply a 0x00fffff8 mask to the texture address. This is strange as it limits the address space to 16 MiB while the Dreamcast has only 8 MiB of video RAM. Use a new mask of (PVR_RAM_SIZE - 1) to address this issue, and make it more obvious what the mask is for. Note that the low 3 bits don't need to be cleared as the address is shifted right by 3 later. Signed-off-by: Paul Cercueil <pa...@cr...> commit 037b33521fb4886859d325f933fdeeeb9c324ba6 Author: Paul Cercueil <pa...@cr...> Date: Tue Jul 8 22:50:49 2025 +0200 video: Add vid_set_dithering() This function can be used to enable or disable dithering. Signed-off-by: Paul Cercueil <pa...@cr...> ----------------------------------------------------------------------- Summary of changes: .../pvr/{cheap_shadow => fb_tex}/Makefile | 10 +- examples/dreamcast/pvr/fb_tex/fb_tex.c | 304 +++++++++++++++++++++ kernel/arch/dreamcast/hardware/pvr/pvr_misc.c | 4 +- kernel/arch/dreamcast/hardware/pvr/pvr_prim.c | 8 +- kernel/arch/dreamcast/hardware/video.c | 11 + kernel/arch/dreamcast/include/dc/video.h | 10 + 6 files changed, 338 insertions(+), 9 deletions(-) copy examples/dreamcast/pvr/{cheap_shadow => fb_tex}/Makefile (75%) create mode 100644 examples/dreamcast/pvr/fb_tex/fb_tex.c diff --git a/examples/dreamcast/pvr/cheap_shadow/Makefile b/examples/dreamcast/pvr/fb_tex/Makefile similarity index 75% copy from examples/dreamcast/pvr/cheap_shadow/Makefile copy to examples/dreamcast/pvr/fb_tex/Makefile index 86db68bd..f5d419bb 100644 --- a/examples/dreamcast/pvr/cheap_shadow/Makefile +++ b/examples/dreamcast/pvr/fb_tex/Makefile @@ -1,5 +1,10 @@ -TARGET = shadow.elf -OBJS = shadow.o +# +# FB texture render +# (C) 2025 Paul Cercueil +# + +TARGET = fb_tex.elf +OBJS = fb_tex.o all: rm-elf $(TARGET) @@ -20,4 +25,3 @@ run: $(TARGET) dist: $(TARGET) -rm -f $(OBJS) $(KOS_STRIP) $(TARGET) - diff --git a/examples/dreamcast/pvr/fb_tex/fb_tex.c b/examples/dreamcast/pvr/fb_tex/fb_tex.c new file mode 100644 index 00000000..db457e02 --- /dev/null +++ b/examples/dreamcast/pvr/fb_tex/fb_tex.c @@ -0,0 +1,304 @@ +/* Simple program that shows how the back buffer (the one being currently + * presented to the screen) can be used as a texture when rendering to the + * front buffer. */ +/* Copyright (C) 2025 Paul Cercueil */ + +#include <kos.h> +#include <stdio.h> +#include <stdbool.h> + +/* XXX: KallistiOS has the wrong value for the stride bit. */ +#undef PVR_TXRFMT_STRIDE +#define PVR_TXRFMT_STRIDE BIT(25) + +#define SQUARE_SIZE 64 + +struct square_fcoords { + float x[4]; + float y[4]; + float u[4]; + float v[4]; +}; + +static bool done; + +static uint32_t dr_state; +static uint32_t fbuf_color = 0xffffffff; + +static void change_color(uint8_t, uint32_t btns) { + if(btns & CONT_A) + fbuf_color = 0xfff8f8f8; + else + fbuf_color = 0xffffffff; +} + +static void do_exit(uint8_t, uint32_t) { + done = 1; +} + +alignas(4) static const uint16_t fake_tex_data[] = { + /* Alternating 0x8000 / 0x0000 but pre-twiddled */ + 0x8000, 0x8000, 0x0000, 0x0000, 0x8000, 0x8000, 0x0000, 0x0000, + 0x8000, 0x8000, 0x0000, 0x0000, 0x8000, 0x8000, 0x0000, 0x0000, + 0x8000, 0x8000, 0x0000, 0x0000, 0x8000, 0x8000, 0x0000, 0x0000, + 0x8000, 0x8000, 0x0000, 0x0000, 0x8000, 0x8000, 0x0000, 0x0000, + 0x8000, 0x8000, 0x0000, 0x0000, 0x8000, 0x8000, 0x0000, 0x0000, + 0x8000, 0x8000, 0x0000, 0x0000, 0x8000, 0x8000, 0x0000, 0x0000, + 0x8000, 0x8000, 0x0000, 0x0000, 0x8000, 0x8000, 0x0000, 0x0000, + 0x8000, 0x8000, 0x0000, 0x0000, 0x8000, 0x8000, 0x0000, 0x0000, +}; + +static const struct square_fcoords fb_render_coords_mask = { + .x = { 0.0f, 640.0f, 0.0f, 640.0f }, + .y = { 0.0f, 0.0f, 480.0f, 480.0f }, + .u = { 0.0f, 640.0f / 8.0f, 0.0f, 640.0f / 8.0f }, + .v = { 0.0f, 0.0f, 480.0f / 8.0f, 480.0f / 8.0f }, +}; + +static const struct square_fcoords fb_render_fcoords_left = { + .x = { 0.0f, 320.0f, 0.0f, 320.0f }, + .y = { 0.0f, 0.0f, 480.0f, 480.0f }, + .u = { 0.0f, 640.0f / 1024.0f, 0.0f, 640.0f / 1024.0f }, + .v = { 0.0f, 0.0f, 960.0f / 1024.0f, 960.0f / 1024.0f }, +}; + +static const struct square_fcoords fb_render_fcoords_right = { + .x = { 320.0f, 640.0f, 320.0f, 640.0f }, + .y = { 0.0f, 0.0f, 480.0f, 480.0f }, + .u = { 0.0f, 640.0f / 1024.0f, 0.0f, 640.0f / 1024.0f }, + .v = { 1.0f / 1024.0f, 1.0f / 1024.0f, 961.0f / 1024.0f, 961.0f / 1024.0f }, +}; + +static void render_coords(const struct square_fcoords *coords, float z, + uint32_t argb, float uoffset) { + pvr_vertex_t *vert; + unsigned int i; + + for(i = 0; i < 4; i++) { + vert = pvr_dr_target(dr_state); + *vert = (pvr_vertex_t){ + .flags = i == 3 ? PVR_CMD_VERTEX_EOL : PVR_CMD_VERTEX, + .x = coords->x[i], + .y = coords->y[i], + .z = z, + .u = coords->u[i] + uoffset, + .v = coords->v[i], + .argb = argb, + }; + pvr_dr_commit(vert); + } +} + +static void render_bouncing_cube(uint16_t x, uint16_t y) { + pvr_poly_hdr_t *hdr_sq; + pvr_poly_cxt_t cxt; + const struct square_fcoords coords = { + .x = { x, x + SQUARE_SIZE, x, x + SQUARE_SIZE }, + .y = { y, y, y + SQUARE_SIZE, y + SQUARE_SIZE }, + }; + static uint32_t color = 0xffff0000; + static uint32_t cnt = 0; + + pvr_poly_cxt_col(&cxt, PVR_LIST_OP_POLY); + + hdr_sq = (void *)pvr_dr_target(dr_state); + pvr_poly_compile(hdr_sq, &cxt); + pvr_dr_commit(hdr_sq); + + if (cnt % 256) { + switch (cnt / 256) { + case 0: + color += 1 << 8; + break; + case 1: + color -= 1 << 16; + break; + case 2: + color += 1; + break; + case 3: + color -= 1 << 8; + break; + case 4: + color += 1 << 16; + break; + case 5: + color -= 1; + break; + } + } + + render_coords(&coords, 4.0f, color, 0.0f); + + cnt++; + if (cnt == 6 * 256) + cnt = 0; +} + +static void render_back_buffer_step1(pvr_ptr_t fake_tex) { + pvr_poly_hdr_t *hdr_sq; + pvr_poly_cxt_t cxt; + + pvr_poly_cxt_txr(&cxt, PVR_LIST_OP_POLY, PVR_TXRFMT_ARGB1555, + 8, 8, fake_tex, PVR_FILTER_NEAREST); + + cxt.txr.alpha = PVR_TXRALPHA_ENABLE; + + hdr_sq = (void *)pvr_dr_target(dr_state); + pvr_poly_compile(hdr_sq, &cxt); + pvr_dr_commit(hdr_sq); + + render_coords(&fb_render_coords_mask, 1.0f, 0xffffffff, 0.0f); +} + +static void render_back_buffer_step2(pvr_ptr_t frontbuf, bool hi_chip) { + pvr_poly_hdr_t *hdr_sq; + pvr_poly_cxt_t cxt; + float uoffset; + + pvr_poly_cxt_txr(&cxt, PVR_LIST_TR_POLY, + PVR_TXRFMT_RGB565 | PVR_TXRFMT_NONTWIDDLED | PVR_TXRFMT_STRIDE, + 1024, 1024, frontbuf, PVR_FILTER_NEAREST); + + if(fbuf_color == 0xffffffff) { + /* If we want to display the FB texture as-is, we need to use + * PVR_TXRENV_REPLACE to disable vertex colors. This is because + * combining a texture pixel with vertex color 0xffffffff multiplies + * its color components by a ratio of 255/256, and this small error + * snowballs into bigger graphical glitches. */ + cxt.txr.env = PVR_TXRENV_REPLACE; + } + + cxt.txr.alpha = PVR_TXRALPHA_DISABLE; + cxt.blend.dst = PVR_BLEND_ZERO; + cxt.blend.src = PVR_BLEND_DESTALPHA; + + hdr_sq = (void *)pvr_dr_target(dr_state); + pvr_poly_compile(hdr_sq, &cxt); + pvr_dr_commit(hdr_sq); + + uoffset = hi_chip ? 2.0f / 1024.0f : 0.0f; + render_coords(&fb_render_fcoords_left, 2.0f, fbuf_color, uoffset); + render_coords(&fb_render_fcoords_right, 2.0f, fbuf_color, uoffset); + + cxt.blend.dst = PVR_BLEND_ONE; + cxt.blend.src = PVR_BLEND_INVDESTALPHA; + + hdr_sq = (void *)pvr_dr_target(dr_state); + pvr_poly_compile(hdr_sq, &cxt); + pvr_dr_commit(hdr_sq); + + uoffset = hi_chip ? 1.0f / 1024.0f : -1.0f / 1024.0f; + render_coords(&fb_render_fcoords_left, 3.0f, fbuf_color, uoffset); + render_coords(&fb_render_fcoords_right, 3.0f, fbuf_color, uoffset); +} + +int main(int argc, char **argv) { + unsigned int x = 0, y = 0; + bool hi_chip, xneg = false, yneg = false; + pvr_ptr_t fake_tex, frontbuf; + + vid_set_mode(DM_640x480, PM_RGB565); + + vid_set_dithering(false); + + pvr_init_defaults(); + + /* Set the stride length for strided textures. + * Unit is a set of 32 pixels, hence the /32. */ + PVR_SET(PVR_TEXTURE_MODULO, 640 / 32); + + fake_tex = pvr_mem_malloc(sizeof(fake_tex_data)); + pvr_txr_load(fake_tex_data, fake_tex, sizeof(fake_tex_data)); + + cont_btn_callback(0, CONT_A, change_color); + cont_btn_callback(0, CONT_B, change_color); + cont_btn_callback(0, CONT_START, do_exit); + + while(!done) { + pvr_scene_begin(); + + frontbuf = pvr_get_front_buffer(); + hi_chip = (uint32_t)frontbuf & PVR_RAM_SIZE; + + pvr_list_begin(PVR_LIST_OP_POLY); + + /* In the background, render a argb1555 texture on the whole screen, + * with pixels alternating between full-alpha black (0x8000), and + * zero-alpha black (0x0000). This mask will permit to extract the + * framebuffer texture properly. + * + * Note that we are rendering an opaque quad here, which means anything + * behind the mask texture will be discarded. If that's not wanted + * (e.g. when doing a "blur" effect where the framebuffer is applied on + * top of the scene), it is possible to use full-alpha white (0xffff) + * and zero-alpha white (0x7fff) instead, and blend it on top of the + * scene with (blend_src = invdestcolor, blend_dst = zero). The quad + * then obviously should go through the transparent list. + * + * Using the latter may be a good idea also when the goal is to re-use + * the previous framebuffer as the background for the new scene, in + * the case where the background is unlikely to be shown (or only + * small parts are shown). As transparent geometry is rendered last, + * if opaque geometry has already be rendered at higher Z values, + * the PVR won't spend time rendering the mask texture. + */ + render_back_buffer_step1(fake_tex); + + /* Render a bouncing cube in the foreground, with circling colors. */ + render_bouncing_cube(x, y); + pvr_list_finish(); + + pvr_list_begin(PVR_LIST_TR_POLY); + + /* The front buffer is in 32-bit memory, while textures are read from + * 64-bit memory. Therefore if we try to use the front buffer as a + * regular texture, we'll have two correct pixels followed by two + * garbage pixels. + * + * To work around that, we squash the texture horizontally so that + * every second pixel is skipped. Then, by crafting specific U/V values, + * we can retrieve the odd pixels separated by garbage pixels. Using + * different U/V values, we can retrieve the even pixels separated by + * garbage pixels. + * + * To discard the garbage pixels, we first blend the odd pixels on top + * of the mask texture, with blend_src = destalpha. Then, we blend the + * even pixels on top of that, with blend_src = invdestalpha. + * + * Note that this trick only works because we render to a square that's + * the size of the screen. This trick would not work if the texture had + * to be scaled, or rotated. + * + * Also note that the blend for those two steps can be done with a + * non-white color (as it is the case here, with fbuf_color). + * This is useful for instance when emulating blur. However, it should + * be noted that when dithering is enabled, some unwanted artifacts + * can appear, as the frame will never fully fade to black. + * For that reason, we disabled dithering after setting the video mode. + */ + render_back_buffer_step2(frontbuf, hi_chip); + + pvr_list_finish(); + pvr_scene_finish(); + + /* Handle the square bouncing around */ + if(xneg) + x--; + else + x++; + if(yneg) + y--; + else + y++; + + if(x == 0 || x == 640 - SQUARE_SIZE) + xneg = !xneg; + if(y == 0 || y == 480 - SQUARE_SIZE) + yneg = !yneg; + } + + pvr_mem_free(fake_tex); + + return 0; +} diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c b/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c index 00937aca..8e814195 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c @@ -277,9 +277,9 @@ pvr_ptr_t pvr_get_front_buffer(void) { view target, aka. the one not currently being displayed. */ idx = pvr_state.view_target ^ pvr_state.render_completed; - addr = pvr_state.frame_buffers[idx].frame; + addr = pvr_state.frame_buffers[idx].frame & (PVR_RAM_SIZE - 1); /* The front buffer is in 32-bit memory, convert its address to make it addressable from the 64-bit memory */ - return (pvr_ptr_t)(((addr << 1) & (PVR_RAM_SIZE - 1)) + PVR_RAM_BASE); + return (pvr_ptr_t)(addr * 2 + PVR_RAM_BASE); } diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c b/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c index 45da95f2..3af1f0a3 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c @@ -82,7 +82,7 @@ void pvr_poly_compile(pvr_poly_hdr_t *dst, const pvr_poly_cxt_t *src) { /* Convert the texture address */ txr_base = (uint32_t)src->txr.base; - txr_base = (txr_base & 0x00fffff8) >> 3; + txr_base = (txr_base & (PVR_RAM_SIZE - 1)) >> 3; /* Polygon mode 3 */ mode3 = FIELD_PREP(PVR_TA_PM3_MIPMAP, src->txr.mipmap) @@ -318,7 +318,7 @@ void pvr_sprite_compile(pvr_sprite_hdr_t *dst, const pvr_sprite_cxt_t *src) { /* Convert the texture address */ txr_base = (uint32_t)src->txr.base; - txr_base = (txr_base & 0x00fffff8) >> 3; + txr_base = (txr_base & (PVR_RAM_SIZE - 1)) >> 3; /* Polygon mode 3 */ mode3 = FIELD_PREP(PVR_TA_PM3_MIPMAP, src->txr.mipmap) @@ -408,7 +408,7 @@ void pvr_poly_mod_compile(pvr_poly_mod_hdr_t *dst, const pvr_poly_cxt_t *src) { /* Convert the texture address */ txr_base = (uint32_t)src->txr.base; - txr_base = (txr_base & 0x00fffff8) >> 3; + txr_base = (txr_base & (PVR_RAM_SIZE - 1)) >> 3; /* Polygon mode 3 */ mode3 = FIELD_PREP(PVR_TA_PM3_MIPMAP, src->txr.mipmap) @@ -448,7 +448,7 @@ void pvr_poly_mod_compile(pvr_poly_mod_hdr_t *dst, const pvr_poly_cxt_t *src) { /* Convert the texture address */ txr_base = (uint32_t)src->txr2.base; - txr_base = (txr_base & 0x00fffff8) >> 3; + txr_base = (txr_base & (PVR_RAM_SIZE - 1)) >> 3; /* Polygon mode 3 */ mode3 = FIELD_PREP(PVR_TA_PM3_MIPMAP, src->txr2.mipmap) diff --git a/kernel/arch/dreamcast/hardware/video.c b/kernel/arch/dreamcast/hardware/video.c index d54e2788..44082a99 100644 --- a/kernel/arch/dreamcast/hardware/video.c +++ b/kernel/arch/dreamcast/hardware/video.c @@ -601,3 +601,14 @@ void vid_shutdown(void) { /* Reset back to default mode, in case we're going back to a loader. */ vid_init(DM_640x480, PM_RGB565); } + +void vid_set_dithering(bool enable) { + uint32_t cfg = vid_bpp_to_pvr_cfg2[currmode.pm]; + + if(enable) + cfg |= PVR_PM_DITHER; + else + cfg &= ~PVR_PM_DITHER; + + PVR_SET(PVR_FB_CFG_2, cfg); +} diff --git a/kernel/arch/dreamcast/include/dc/video.h b/kernel/arch/dreamcast/include/dc/video.h index 6600573b..58412701 100644 --- a/kernel/arch/dreamcast/include/dc/video.h +++ b/kernel/arch/dreamcast/include/dc/video.h @@ -433,6 +433,16 @@ int vid_screen_shot(const char *destfn); */ size_t vid_screen_shot_data(uint8_t **buffer); +/** \brief Enable or disable dithering. + \ingroup video_fb + + This function can be used to enable or disable dithering when a 15-bit or + 16-bit video mode is used. + + \param enable Whether or not dithering should be enabled. +*/ +void vid_set_dithering(bool enable); + __END_DECLS #endif /* __DC_VIDEO_H */ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-07-16 21:42:14
|
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 b506f90239ec1e3383d8830225494d547042aaf4 (commit) from dd8d2eb764db4584dc77f767ba2bba13cb2daa05 (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 b506f90239ec1e3383d8830225494d547042aaf4 Author: Paul Cercueil <pa...@cr...> Date: Thu Jul 10 00:30:32 2025 +0200 pvr: Extend VRAM to 16 MiB on Naomi The Naomi has 16 MiB of VRAM. Signed-off-by: Paul Cercueil <pa...@cr...> ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/include/dc/pvr/pvr_regs.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/arch/dreamcast/include/dc/pvr/pvr_regs.h b/kernel/arch/dreamcast/include/dc/pvr/pvr_regs.h index 2f4180f4..74f20d06 100644 --- a/kernel/arch/dreamcast/include/dc/pvr/pvr_regs.h +++ b/kernel/arch/dreamcast/include/dc/pvr/pvr_regs.h @@ -30,6 +30,8 @@ #include <sys/cdefs.h> __BEGIN_DECLS +#include <kos/platform.h> + /**** Register macros ***************************************************/ /** \defgroup pvr_registers Registers @@ -173,7 +175,8 @@ __BEGIN_DECLS #define PVR_RAM_BASE 0xa5000000 /**< \brief VRAM 32-bit, P2 area, PVR->VRAM */ #define PVR_RAM_INT_BASE 0xa4000000 /**< \brief VRAM 64-bit, P2 area, PVR->VRAM */ -#define PVR_RAM_SIZE (8*1024*1024) /**< \brief RAM size in bytes */ +#define PVR_RAM_SIZE_MB (KOS_PLATFORM_IS_NAOMI ? 16 : 8) /**< \brief RAM size in MiB */ +#define PVR_RAM_SIZE (PVR_RAM_SIZE_MB*1024*1024) /**< \brief RAM size in bytes */ #define PVR_RAM_TOP (PVR_RAM_BASE + PVR_RAM_SIZE) /**< \brief Top of raw PVR RAM */ #define PVR_RAM_INT_TOP (PVR_RAM_INT_BASE + PVR_RAM_SIZE) /**< \brief Top of int PVR RAM */ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-07-14 01:15: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 dd8d2eb764db4584dc77f767ba2bba13cb2daa05 (commit) from 5d2b7a432487ba8cf06cf68a8ec76ff02c8815e7 (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 dd8d2eb764db4584dc77f767ba2bba13cb2daa05 Author: darc <da...@pr...> Date: Sun Jul 13 17:08:25 2025 -0500 Fix net_init crash when there are 0 detected network devices ----------------------------------------------------------------------- Summary of changes: kernel/net/net_core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/net/net_core.c b/kernel/net/net_core.c index 8d2b8dc9..0f4ae099 100644 --- a/kernel/net/net_core.c +++ b/kernel/net/net_core.c @@ -138,7 +138,10 @@ int net_dev_init(void) { dbglog(DBG_DEBUG, "net_dev_init: detected %d usable network device(s)\n", detected); - return 0; + if(detected) + return 0; + else + return -1; } /* Init */ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-07-12 19:21:24
|
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 5d2b7a432487ba8cf06cf68a8ec76ff02c8815e7 (commit) from 908fbacbb4a32e51d872e624e9dcc556477477bb (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 5d2b7a432487ba8cf06cf68a8ec76ff02c8815e7 Author: Ruslan Rostovtsev <sw...@21...> Date: Sun Jul 13 02:21:10 2025 +0700 isofs: Added cdrom streams and direct DMA support (#763) * Added cdrom DMA streams support. At the sector boundary with aligned buffer, DMA streaming will be started for the entire file and works until file end or cancelled (closed or another file used). Reading from an open stream can be done in chunks of up to a minimum of 32 bytes. * Added IOCTL function to determine that file system can load directly to SPU and PVR RAM's thought the Root Bus. ----------------------------------------------------------------------- Summary of changes: include/sys/ioctl.h | 12 +++ kernel/arch/dreamcast/fs/fs_iso9660.c | 196 +++++++++++++++++++++++++++++----- 2 files changed, 181 insertions(+), 27 deletions(-) diff --git a/include/sys/ioctl.h b/include/sys/ioctl.h index 0baa546a..40acd6c2 100644 --- a/include/sys/ioctl.h +++ b/include/sys/ioctl.h @@ -2,6 +2,7 @@ sys/ioctl.h Copyright (C) 2024 Andress Barajas + Copyright (C) 2025 Ruslan Rostovtsev */ @@ -25,6 +26,17 @@ __BEGIN_DECLS #include <kos/fs.h> +#ifndef IOCTL_FS_ROOTBUS_DMA_READY +/** \brief This operation can determine that file system + * can read data directly into SPU and PVR RAM's thought the Root Bus + * and are all the conditions for this met like file position + * on sector boundary at first reading and DMA aligning for others, + * if the data stream was not interrupted by another request or seeking. + * You can also get current alignment requirement in the argument (use uint32_t). + */ +#define IOCTL_FS_ROOTBUS_DMA_READY 0x8001 +#endif + /* Define ioctl as an alias for fs_ioctl */ #define ioctl fs_ioctl diff --git a/kernel/arch/dreamcast/fs/fs_iso9660.c b/kernel/arch/dreamcast/fs/fs_iso9660.c index 5fbd4d74..d67e465f 100644 --- a/kernel/arch/dreamcast/fs/fs_iso9660.c +++ b/kernel/arch/dreamcast/fs/fs_iso9660.c @@ -5,6 +5,7 @@ Copyright (C) 2001 Andrew Kieschnick Copyright (C) 2002 Bero Copyright (C) 2012, 2013, 2014, 2016 Lawrence Sebald + Copyright (C) 2025 Ruslan Rostovtsev */ @@ -40,11 +41,13 @@ ISO9660 systems, as these were used as references as well. #include <stdlib.h> #include <stdio.h> +#include <stdalign.h> #include <ctype.h> #include <string.h> #include <strings.h> #include <sys/queue.h> #include <errno.h> +#include <sys/ioctl.h> static int init_percd(void); static int percd_done; @@ -246,6 +249,7 @@ static void bgrad_cache(cache_block_t **cache, int block) { block index. Note that the sector in question may already be in the cache, in which case it just returns the containing block. */ static void iso_break_all(void); +static void iso_abort_stream(bool lock); static int bread_cache(cache_block_t **cache, uint32 sector) { int i, j, rv; @@ -271,6 +275,9 @@ static int bread_cache(cache_block_t **cache, uint32 sector) { i = 0; } + iso_abort_stream(cache == icache); + // dbglog(DBG_DEBUG, "Stream stop for %s read\n", cache == icache ? "cached" : "inode"); + /* Load the requested block */ j = cdrom_read_sectors_ex(cache[i]->data, sector + 150, 1, CDROM_READ_DMA); @@ -298,17 +305,17 @@ bread_exit: } /* read data block */ -static int bdread(uint32 sector) { +static inline int bdread(uint32_t sector) { return bread_cache(dcache, sector); } /* read inode block */ -static int biread(uint32 sector) { +static inline int biread(uint32_t sector) { return bread_cache(icache, sector); } /* Clear both caches */ -static void bclear(void) { +static inline void bclear(void) { bclear_cache(dcache); bclear_cache(icache); } @@ -570,28 +577,29 @@ static iso_dirent_t *find_object_path(const char *fn, int dir, iso_dirent_t *sta /********************************************************************************/ /* File primitives */ -/* File handles.. I could probably do this with a linked list, but I'm just - too lazy right now. =) */ typedef struct iso_fd { - uint32 first_extent; /* First sector */ - bool dir; /* True if a directory */ - uint32 ptr; /* Current read position in bytes */ - uint32 size; /* Length of file in bytes */ - dirent_t dirent; /* A static dirent to pass back to clients */ - bool broken; /* True if the CD has been swapped out since open */ TAILQ_ENTRY(iso_fd) next; /* Next handle in the linked list */ + uint32_t first_extent; /* First sector */ + bool dir; /* True if a directory */ + uint32_t ptr; /* Current read position in bytes */ + uint32_t size; /* Length of file in bytes */ + dirent_t dirent; /* A static dirent to pass back to clients */ + bool broken; /* True if the CD has been swapped out since open */ + size_t stream_part; /* Stream DMA part of 32 bytes */ + uint8_t alignas(32) stream_data[32]; } iso_fd_t; static TAILQ_HEAD(iso_fd_queue, iso_fd) iso_fd_queue; /* Mutex for protecting access to the iso_fd_queue */ static mutex_t fh_mutex; +static iso_fd_t *stream_fd = NULL; /* Break all of our open file descriptor. This is necessary when the disc is changed so that we don't accidentally try to keep on doing stuff with the old info. As files are closed and re-opened, the broken flag will be cleared. */ -static void iso_break_all(void) { +static inline void iso_break_all(void) { iso_fd_t *fd; mutex_lock_scoped(&fh_mutex); @@ -601,6 +609,20 @@ static void iso_break_all(void) { } } +/* Abort the current stream. */ +static inline void iso_abort_stream(bool lock) { + if(stream_fd) { + if(lock) + mutex_lock(&fh_mutex); + + cdrom_stream_stop(false); + stream_fd = NULL; + + if(lock) + mutex_unlock(&fh_mutex); + } +} + /* Open a file or directory */ static void * iso_open(vfs_handler_t * vfs, const char *fn, int mode) { iso_dirent_t *de; @@ -641,6 +663,9 @@ static void * iso_open(vfs_handler_t * vfs, const char *fn, int mode) { .first_extent = iso_733(de->extent), .dir = (mode & O_DIR) != 0, .size = iso_733(de->size), + .broken = false, + .stream_part = 0, + .stream_data = {0}, }; mutex_lock_scoped(&fh_mutex); @@ -656,6 +681,11 @@ static int iso_close(void * h) { mutex_lock_scoped(&fh_mutex); + if(fd == stream_fd) { + iso_abort_stream(false); + // dbglog(DBG_DEBUG, "Stream stop on close, fd=%p\n", fd); + } + TAILQ_REMOVE(&iso_fd_queue, fd, next); free(fd); @@ -666,6 +696,8 @@ static int iso_close(void * h) { static ssize_t iso_read(void * h, void *buf, size_t bytes) { int rv, toread, thissect, c; uint8 * outbuf; + size_t remain_size = 0, req_size; + uint32_t sector; iso_fd_t *fd = (iso_fd_t *)h; /* Check that the fd is valid */ @@ -676,6 +708,7 @@ static ssize_t iso_read(void * h, void *buf, size_t bytes) { rv = 0; outbuf = (uint8 *)buf; + mutex_lock(&fh_mutex); /* Read zero or more sectors into the buffer from the current pos */ while(bytes > 0) { @@ -686,7 +719,91 @@ static ssize_t iso_read(void * h, void *buf, size_t bytes) { /* How much more can we read in the current sector? */ thissect = 2048 - (fd->ptr % 2048); + sector = fd->first_extent + (fd->ptr / 2048); + + if((thissect & 31) == 0 && toread >= 32 && (((uintptr_t)outbuf) & 31) == 0) { + + if(stream_fd == fd) { + toread &= ~31; + c = cdrom_stream_request(outbuf, toread, 1); + + if(c) { + goto read_error; + } + cdrom_stream_progress(&remain_size); + // dbglog(DBG_DEBUG, "Stream request: read=%d remain=%d out=%p fd=%p\n", + // toread, remain_size, outbuf, fd); + } + else if(thissect == 2048) { + req_size = (fd->size - fd->ptr); + + if(req_size & 2047) { + req_size = (req_size + 2048) & ~2047; + } + if(stream_fd) { + iso_abort_stream(false); + // dbglog(DBG_DEBUG, "Stream stop for file fd: %p -> %p\n", stream_fd, fd); + } + c = cdrom_stream_start(sector + 150, req_size / 2048, CDROM_READ_DMA); + + if(c) { + goto read_loop; + } + fd->stream_part = 0; + stream_fd = fd; + // dbglog(DBG_DEBUG, "Stream start: lba=%ld cnt=%d fd=%p\n", + // sector + 150, req_size / 2048, fd); + + toread &= ~31; + c = cdrom_stream_request(outbuf, toread, 1); + + if(c) { + goto read_error; + } + cdrom_stream_progress(&remain_size); + // dbglog(DBG_DEBUG, "Stream request: read=%d remain=%d out=%p fd=%p\n", + // toread, remain_size, outbuf, fd); + } + else { + goto read_loop; + } + + if(remain_size == 0) { + iso_abort_stream(false); + // dbglog(DBG_DEBUG, "Stream stop on end, fd=%p\n", fd); + } + goto end_loop; + } + else if(stream_fd == fd && toread < 32) { + + toread = (toread > thissect) ? thissect : toread; + if(fd->stream_part > 0) { + memcpy(outbuf, &fd->stream_data[fd->stream_part - 1], toread); + fd->stream_part = 0; + } + else { + c = cdrom_stream_request(fd->stream_data, 32, 0); + if(c) { + goto read_error; + } + fd->stream_part = toread; + while(cdrom_stream_progress(&remain_size) == 1) { + thd_pass(); + } + memcpy(outbuf, fd->stream_data, toread); + } + // dbglog(DBG_DEBUG, "Stream request: read=%d remain=%d part=%d out=%p fd=%p\n", + // toread, remain_size, fd->stream_part, outbuf, fd); + + if(remain_size == 0) { + iso_abort_stream(false); + // dbglog(DBG_DEBUG, "Stream stop on end, fd=%p\n", fd); + } + goto end_loop; + } + +read_loop: /* If we're on a sector boundary and we have more than one full sector to read, then short-circuit the cache here and use the multi-sector reads from the CD unit. */ @@ -694,31 +811,23 @@ static ssize_t iso_read(void * h, void *buf, size_t bytes) { /* Round it off to an even sector count. */ thissect = toread / 2048; toread = thissect * 2048; + c = cdrom_read_sectors_ex(outbuf, sector + 150, thissect, CDROM_READ_DMA); - /* Do the read */ - c = cdrom_read_sectors_ex(outbuf, - fd->first_extent + (fd->ptr / 2048) + 150, - thissect, - CDROM_READ_DMA); - - if(c != ERR_OK) { - return -1; + if(c) { + goto read_error; } } else { toread = (toread > thissect) ? thissect : toread; - - /* Do the read */ - c = bdread(fd->first_extent + fd->ptr / 2048); + c = bdread(sector); if(c < 0) { - errno = EIO; - return -1; + goto read_error; } - memcpy(outbuf, dcache[c]->data + (fd->ptr % 2048), toread); } +end_loop: /* Adjust pointers */ outbuf += toread; fd->ptr += toread; @@ -726,11 +835,18 @@ static ssize_t iso_read(void * h, void *buf, size_t bytes) { rv += toread; } + mutex_unlock(&fh_mutex); return rv; + +read_error: + errno = EIO; + mutex_unlock(&fh_mutex); + return -1; } /* Seek elsewhere in a file */ static off_t iso_seek(void * h, off_t offset, int whence) { + uint32_t old_ptr; iso_fd_t *fd = (iso_fd_t *)h; /* Check that the fd is valid */ @@ -738,6 +854,7 @@ static off_t iso_seek(void * h, off_t offset, int whence) { errno = EBADF; return -1; } + old_ptr = fd->ptr; /* Update current position according to arguments */ switch(whence) { @@ -776,6 +893,11 @@ static off_t iso_seek(void * h, off_t offset, int whence) { /* Check bounds */ if(fd->ptr > fd->size) fd->ptr = fd->size; + if(fd == stream_fd && old_ptr != fd->ptr) { + iso_abort_stream(true); + // dbglog(DBG_DEBUG, "Stream stop on seek: %ld != %ld\n", old_ptr, fd->ptr); + } + return fd->ptr; } @@ -911,6 +1033,25 @@ static dirent_t *iso_readdir(void * h) { return &fd->dirent; } +static int iso_ioctl(void *h, int cmd, va_list ap) { + iso_fd_t *fd = (iso_fd_t *)h; + void *arg = va_arg(ap, void*); + + switch(cmd) { + case IOCTL_FS_ROOTBUS_DMA_READY: + if(arg != NULL) { + *(uint32_t *)arg = 32; + } + if(stream_fd == fd) { + return (fd->ptr & 31) ? -1 : 0; + } + return (fd->ptr & 2047) ? -1 : 0; + default: + errno = EINVAL; + return -1; + } +} + static int iso_rewinddir(void * h) { iso_fd_t *fd = (iso_fd_t *)h; @@ -927,6 +1068,7 @@ static int iso_rewinddir(void * h) { int iso_reset(void) { iso_break_all(); bclear(); + iso_abort_stream(false); percd_done = 0; return 0; } @@ -1077,7 +1219,7 @@ static vfs_handler_t vh = { iso_tell, iso_total, iso_readdir, - NULL, + iso_ioctl, NULL, NULL, NULL, hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-07-12 18:37:34
|
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 908fbacbb4a32e51d872e624e9dcc556477477bb (commit) from c8b4cd2cd1809af47593b3982bd10d0c5e0eaadf (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 908fbacbb4a32e51d872e624e9dcc556477477bb Author: darc <da...@pr...> Date: Fri May 30 17:49:57 2025 -0500 Use THD_STACK_ALIGNMENT to adjust arch's stack alignment requirements ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/include/arch/arch.h | 5 +++++ kernel/thread/thread.c | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/kernel/arch/dreamcast/include/arch/arch.h b/kernel/arch/dreamcast/include/arch/arch.h index f79915de..79a0fe83 100644 --- a/kernel/arch/dreamcast/include/arch/arch.h +++ b/kernel/arch/dreamcast/include/arch/arch.h @@ -79,6 +79,11 @@ extern char _etext; static const unsigned HZ __depr("Please use the new THD_SCHED_HZ macro.") = THD_SCHED_HZ; +#ifndef THD_STACK_ALIGNMENT +/** \brief Required alignment for stack. */ +#define THD_STACK_ALIGNMENT 8 +#endif + #ifndef THD_STACK_SIZE /** \brief Default thread stack size. */ #define THD_STACK_SIZE 32768 diff --git a/kernel/thread/thread.c b/kernel/thread/thread.c index b1faf558..8b56e708 100644 --- a/kernel/thread/thread.c +++ b/kernel/thread/thread.c @@ -45,8 +45,8 @@ also using their queue library verbatim (sys/queue.h). */ /* Builtin background thread data */ -static alignas(8) uint8_t thd_reaper_stack[512]; -static alignas(8) uint8_t thd_idle_stack[64]; +static alignas(THD_STACK_ALIGNMENT) uint8_t thd_reaper_stack[512]; +static alignas(THD_STACK_ALIGNMENT) uint8_t thd_idle_stack[64]; /*****************************************************************************/ /* Thread scheduler data */ @@ -404,7 +404,8 @@ kthread_t *thd_create_ex(const kthread_attr_t *restrict attr, /* Create a new thread stack */ if(!real_attr.stack_ptr) { - nt->stack = (uint32_t*)malloc(real_attr.stack_size); + nt->stack = (uint32_t*)aligned_alloc(THD_STACK_ALIGNMENT, + real_attr.stack_size); if(!nt->stack) { free(nt); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: quzar <qu...@us...> - 2025-07-11 23:50:31
|
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, v2.2.x has been created at e4171afbdaf20574a554d8d40f08552e0680db14 (commit) - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-07-11 22:56:07
|
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 c8b4cd2cd1809af47593b3982bd10d0c5e0eaadf (commit) from 48907615f92b09f0df765dd89f27897a6c9ef43e (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 c8b4cd2cd1809af47593b3982bd10d0c5e0eaadf Author: darc <da...@pr...> Date: Sun Jun 29 11:09:09 2025 -0500 dc-chain: Change source URL for config.guess and config.sub to more reliable mirror ----------------------------------------------------------------------- Summary of changes: utils/dc-chain/scripts/host-detect.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/dc-chain/scripts/host-detect.mk b/utils/dc-chain/scripts/host-detect.mk index 6782d4d3..17bf86f6 100644 --- a/utils/dc-chain/scripts/host-detect.mk +++ b/utils/dc-chain/scripts/host-detect.mk @@ -8,9 +8,9 @@ # Download ./config.guess if necessary # This will help a lot to execute conditional steps depending on the host. config_guess = config.guess -config_guess_url = http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=${config_guess};hb=HEAD +config_guess_url = https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;a=blob_plain;f=${config_guess};hb=HEAD config_sub = config.sub -config_sub_url = http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=${config_sub};hb=HEAD +config_sub_url = https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;a=blob_plain;f=${config_sub};hb=HEAD is_clean_target=$(findstring clean,$(MAKECMDGOALS)) config_guess_check=$(shell test -f ./config.guess || echo 0) hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-07-11 22:40:43
|
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 48907615f92b09f0df765dd89f27897a6c9ef43e (commit) from e4171afbdaf20574a554d8d40f08552e0680db14 (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 48907615f92b09f0df765dd89f27897a6c9ef43e Author: Paul Cercueil <pa...@cr...> Date: Sat May 3 17:45:26 2025 +0200 dmac: Drop old DMAC interface and header And move the code initializing DMAC on Naomi to the DMAC driver. Signed-off-by: Paul Cercueil <pa...@cr...> ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/hardware/dmac.c | 33 ++++++++ kernel/arch/dreamcast/include/dc/dmac.h | 140 -------------------------------- kernel/arch/dreamcast/kernel/init.c | 10 +-- 3 files changed, 35 insertions(+), 148 deletions(-) delete mode 100644 kernel/arch/dreamcast/include/dc/dmac.h diff --git a/kernel/arch/dreamcast/hardware/dmac.c b/kernel/arch/dreamcast/hardware/dmac.c index d674fbf7..3cde8d4a 100644 --- a/kernel/arch/dreamcast/hardware/dmac.c +++ b/kernel/arch/dreamcast/hardware/dmac.c @@ -33,6 +33,20 @@ typedef enum dma_register { #define REG_CHCR_TRANSFER_END BIT(1) #define REG_CHCR_DMAC_EN BIT(0) +#define REG_DMAOR_DDT BIT(15) +#define REG_DMAOR_PR GENMASK(9, 8) +#define REG_DMAOR_COD BIT(4) +#define REG_DMAOR_AE BIT(2) +#define REG_DMAOR_NMIF BIT(1) +#define REG_DMAOR_DME BIT(0) + +enum dmaor_pr_mode { + DMAOR_PR_CH0123, + DMAOR_PR_CH0231, + DMAOR_PR_CH2013, + DMAOR_PR_ROUND_ROBIN, +}; + static const dma_config_t *channels_cfg[4]; static const irq_t channel_to_irq[] = { @@ -173,3 +187,22 @@ void dma_transfer_abort(dma_channel_t channel) { dmac_write(channel, DMA_REG_CHCR, 0); genwait_wake_all((void *)&channels_cfg[channel]); } + +void dma_init(void) { + /* Set default settings for DMA #2. + * These are set by the bios on Dreamcast, but should be set by the OS + * on Naomi. */ + uint32_t chcr, dmaor; + + dmac_write(2, DMA_REG_SAR, 0); + + chcr = FIELD_PREP(REG_CHCR_SRC_ADDRMODE, DMA_ADDRMODE_INCREMENT) + | FIELD_PREP(REG_CHCR_REQUEST, DMA_REQUEST_EXTERNAL_MEM_TO_DEV) + | FIELD_PREP(REG_CHCR_DMAC_EN, 1); + dmac_write(2, DMA_REG_CHCR, chcr); + + dmaor = REG_DMAOR_DDT + | FIELD_PREP(REG_DMAOR_PR, DMAOR_PR_CH2013) + | REG_DMAOR_DME; + dmac_write(0, DMA_REG_DMAOR, dmaor); +} diff --git a/kernel/arch/dreamcast/include/dc/dmac.h b/kernel/arch/dreamcast/include/dc/dmac.h deleted file mode 100644 index 949e42e7..00000000 --- a/kernel/arch/dreamcast/include/dc/dmac.h +++ /dev/null @@ -1,140 +0,0 @@ -/* KallistiOS ##version## - - dmac.h - Copyright (C) 2023 Andy Barajas - -*/ - -/** \file dc/dmac.h - \brief Macros to access the DMA controller registers. - \ingroup system_dmac - - This header provides a set of macros to facilitate checking - the values of various DMA channels on the system. - - DMA channel 0 and its registers (DMAC_SAR0, DMAC_DAR0, DMAC_DMATCR0, - DMAC_CHCR0) are used by the hardware and not accessible to us but are - documented here anyway. - - DMA channel 2 is strictly used to transfer data to the PVR/TA. - - DMA channel 1 & 3 are free to use. - - \author Andy Barajas -*/ - -#ifndef __DC_DMAC_H -#define __DC_DMAC_H - -#include <sys/cdefs.h> -__BEGIN_DECLS - -/** \defgroup system_dmac DMA - \brief Driver for the SH4's Direct Memory Access - Controller - \ingroup system - - @{ -*/ - -#define DMAC_BASE 0xffa00000 - -/** \name DMA Source Address Registers (SAR0-SAR3) - - These registers designate the source address for DMA transfers. - Currently we only support 32-byte boundary addresses. - - @{ - */ - -#define DMAC_SAR0 (*((vuint32 *)(DMAC_BASE + 0x00))) -#define DMAC_SAR1 (*((vuint32 *)(DMAC_BASE + 0x10))) -#define DMAC_SAR2 (*((vuint32 *)(DMAC_BASE + 0x20))) -#define DMAC_SAR3 (*((vuint32 *)(DMAC_BASE + 0x30))) - -/** @} */ - -/** \name DMA Destination Address Registers (DAR0-DAR3) - - These registers designate the destination address for DMA transfers. - Currently we only support 32-byte boundary addresses. - - @{ - */ - -#define DMAC_DAR0 (*((vuint32 *)(DMAC_BASE + 0x04))) -#define DMAC_DAR1 (*((vuint32 *)(DMAC_BASE + 0x14))) -#define DMAC_DAR2 (*((vuint32 *)(DMAC_BASE + 0x24))) -#define DMAC_DAR3 (*((vuint32 *)(DMAC_BASE + 0x34))) - -/** @} */ - -/** \name DMA Transfer Count Registers (DMATCR0-DMATCR3) - - These registers define the transfer count for each DMA channel. The count - is defined as: num_bytes_to_transfer/32 - - @{ - */ - -#define DMAC_DMATCR0 (*((vuint32 *)(DMAC_BASE + 0x08))) -#define DMAC_DMATCR1 (*((vuint32 *)(DMAC_BASE + 0x18))) -#define DMAC_DMATCR2 (*((vuint32 *)(DMAC_BASE + 0x28))) -#define DMAC_DMATCR3 (*((vuint32 *)(DMAC_BASE + 0x38))) - -/** @} */ - -/** \name DMA Channel Control Registers (CHCR0-CHCR3) - - These registers configure the operating mode and transfer methodology for - each channel. - - For DMAC_CHCR2, it should always be set to 0x12c1 (source address - incremented, burst mode, interrupt disable, DMA enable). - - For DMAC_CHCR1 and DMAC_CHCR3, it would probably be set to 0x1241 - (source address incremented, cycle steal mode, interrupt disable, - DMA enable). - - @{ - */ - -#define DMAC_CHCR0 (*((vuint32 *)(DMAC_BASE + 0x0c))) -#define DMAC_CHCR1 (*((vuint32 *)(DMAC_BASE + 0x1c))) -#define DMAC_CHCR2 (*((vuint32 *)(DMAC_BASE + 0x2c))) -#define DMAC_CHCR3 (*((vuint32 *)(DMAC_BASE + 0x3c))) - -/** @} */ - - -/** - \brief A register that dictates the overall operation of the DMAC. - - So far we only use it check the status of DMA operations. - - */ -#define DMAC_DMAOR (*((vuint32 *)(DMAC_BASE + 0x40))) - -/** \name List of helpful masks to check operations - - The DMAOR_STATUS_MASK captures the On-Demand Data Transfer Mode (Bit 15), - Address Error Flag (Bit 2), NMI Flag (Bit 1), and DMAC Master Enable (Bit 0). - - The DMAOR_NORMAL_OPERATION is a state where DMAC Master Enable is active, - and the On-Demand Data Transfer Mode is not set, with no address errors - or NMI inputs. - - @{ -*/ - -#define DMAOR_STATUS_MASK 0x8007 -#define DMAOR_NORMAL_OPERATION 0x8001 - -/** @} */ - -/** @} */ - -__END_DECLS - -#endif /* __DC_DMAC_H */ - diff --git a/kernel/arch/dreamcast/kernel/init.c b/kernel/arch/dreamcast/kernel/init.c index 765f8850..7f75feb7 100644 --- a/kernel/arch/dreamcast/kernel/init.c +++ b/kernel/arch/dreamcast/kernel/init.c @@ -25,7 +25,6 @@ #include <dc/pvr.h> #include <dc/vmufs.h> #include <dc/syscalls.h> -#include <dc/dmac.h> #include "initall_hdrs.h" @@ -40,6 +39,7 @@ extern uintptr_t _bss_start, end; extern void _init(void); extern void _fini(void); extern void __verify_newlib_patch(); +extern void dma_init(void); void (*__kos_init_early_fn)(void) __attribute__((weak,section(".data"))) = NULL; @@ -280,13 +280,7 @@ void arch_main(void) { uint8 *bss_start = (uint8 *)(&_bss_start); int rv; - if (KOS_PLATFORM_IS_NAOMI) { - /* Ugh. I'm really not sure why we have to set up these DMA registers this - way on boot, but failing to do so breaks maple... */ - DMAC_SAR2 = 0; - DMAC_CHCR2 = 0x1201; - DMAC_DMAOR = 0x8201; - } + dma_init(); /* Ensure the WDT is not enabled from a previous session */ wdt_disable(); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-07-11 22:00: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 e4171afbdaf20574a554d8d40f08552e0680db14 (commit) via 09c5f1189cc5e4fcb821564f2b716229f4d244f2 (commit) from 0c6a4cf9e383fdfea5c2bcfefab301beee349f80 (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 e4171afbdaf20574a554d8d40f08552e0680db14 Author: QuzarDC <qu...@co...> Date: Thu Jun 19 18:42:09 2025 -0400 Update version to 2.2.0. Additionally clean up some whitespace. commit 09c5f1189cc5e4fcb821564f2b716229f4d244f2 Author: QuzarDC <qu...@co...> Date: Sun May 18 13:48:55 2025 -0400 Update Changelog and Relnotes for v2.2.0 ----------------------------------------------------------------------- Summary of changes: doc/CHANGELOG.md | 29 +++++++++++++++++++---- doc/RELNOTES.md | 64 +++++++++++++++++++++++++++++++++++++++++++++++---- include/kos/version.h | 36 ++++++++++++++--------------- 3 files changed, 102 insertions(+), 27 deletions(-) diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 1a6544c7..49f8937d 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -5,22 +5,43 @@ Platform-specific changes are prefixed with the platform name, otherwise the cha ## KallistiOS version 2.2.0 - Added . & .. directories to filesystems that lack it [Andress Barajas == AB] - Replaced previous implementation of realpath() to remove license from AUTHORS [AB] -- Enabled hybrid PVR DR/DMA vertex submission in driver + sped up pvr_prim() [Falco Girgis == FG] +- Made FD_SETSIZE configurable in kos/opts.h [AB] +- **Dreamcast**: Enabled hybrid PVR DR/DMA vertex submission in driver + sped up pvr_prim() [Falco Girgis == FG] - Add thread priority boosting system [Paul Cercueil == PC] +- **Dreamcast**: Use DMA for iso9660 reading [PC] +- **Dreamcast**: Dynamic maple device allocation [PC] - Add performance monitor API [PC] - Add/Fixed stat() implementations for all filesystems [AB] - **Dreamcast**: Add pvr palette example [AB] +- **Dreamcast**: Fixed, expanded, and created example for library loading [Ruslan Rostovtsev == RR] - **Dreamcast**: Cleaned up, documented, and enhanced BIOS font API [FG] -- Rework PVR hybrid mode + IRQ handling [PC] -- **Dreamcast**: Add support and update toolchain profiles for Newlib 4.5.0, Binutils 2.43.1, and GDB 15.2 [EF] +- Expanded KOS_INIT_FLAG options to include default VFSes and library loading [FG] +- **Dreamcast**: Rework PVR hybrid mode + IRQ handling [PC] +- Removed defines for BSD-style types (u_char, u_int, etc) [Donald Haase == DH] +- **Dreamcast**: Add support and update toolchain profiles for Newlib 4.5.0, Binutils 2.43.1, and GDB 15.2 [Eric Fradella == EF] - **Dreamcast**: Make m4-single the default floating-point ABI [EF] +- **Dreamcast**: Allow building a toolchain for the m4-nofpu ABI [DH] - **Dreamcast**: Add DMAC API [PC] - **Dreamcast**: Add basic MMU functionality [PC] +- **Dreamcast**: vmu_pkg loading from .ico icons [PC] +- **Dreamcast**: vmu_pkg Manage file headers outside of standard fs [PC] - **Dreamcast**: Added Raytris raylib example by Niisoks [FG] -- Removed old pthreads implementation from kernel/libc [LS] +- Added support for pthread_condattr_setclock() [FG] +- Expanded supported sysconf queries [FG] +- **Dreamcast**: iso9660 multi-sector reads to use DMA and no longer cached [RR] +- **Dreamcast**: Substantial cleanups and refactoring for PVR and IRQ APIs [FG] +- Various internal adjustments to support non-Dreamcast platforms [DH] +- **Dreamcast**: maple now allows per-driver device attach/detach callbacks [PC] +- **Dreamcast**: iso9660 file table now dynamic, preventing the need for manual size adjustment [PC] +- **Dreamcast**: cdrom add support for irq-based DMA reads as well as data streaming [RR] +- Removed old pthreads implementation from kernel/libc [Lawrence Sebald == LS] - Added new (more complete/compliant) pthreads implementation in addons/libpthread [LS] - Added implementation of thread barriers [LS] - Added support for pthread_condattr_setclock() [FG] +- **Dreamcast**: maple Keyboard driver significantly rewritten, new event driven API added [FG] +- **Dreamcast**: Add SCI driver [RR] +- **Dreamcast**: Update SD card driver for SCI support and optional CRC check disabling [RR] +- New macro __is_defined() which should be used in place of #ifdef guards internally [PC] ## KallistiOS version 2.1.1 - Added pvrtex utility by TapamN to utils [Daniel Fairchild == DF] diff --git a/doc/RELNOTES.md b/doc/RELNOTES.md index 68d1ce39..534a5d3b 100644 --- a/doc/RELNOTES.md +++ b/doc/RELNOTES.md @@ -1,12 +1,64 @@ -KallistiOS ##version## -Copyright (C) 2002, 2003 Megan Potter -Copyright (C) 2012-2019 Lawrence Sebald -Copyright (C) 2024 Donald Haase -Copyright (C) 2025 Eric Fradella +KallistiOS ##version## +Copyright (C) 2002, 2003 Megan Potter +Copyright (C) 2012-2019 Lawrence Sebald +Copyright (C) 2024-2025 Donald Haase +Copyright (C) 2025 Eric Fradella RELEASE NOTES for 2.2.0 ----------------------- +# What's New in Version 2.2.0 + +There are three major changes in v2.2.0 compared to prior releases. The first +is that it didn't take 10 years! Other than that, we have a new implementation +of [POSIX threading](./RELNOTES.md#libpthreads) and have updated the default +[Floating-point ABI](./RELNOTES.md#floating-point-ABI) to `m4-single`. A more +thorough explanation of each can be found below the rest of the high-level +changes. + +# Core Functionality +* FS: `.` and `..` handling and `stat` for all vfs. +* Expanded `KOS_INIT_FLAG` options for vfs support. +* New Priority Boosting scheme for threads. +* Fixed library loading functionality. +* Added `getpeername()`, `settimeofday()`, and expanded `sysconf()` support. +* Entirely new libpthreads providing enhanced support for POSIX threading. + +# Dreamcast Functionality +* Support for CD IRQ-based DMA, and DMA Streaming. +* Reworked APIs with strong typing for: IRQ, DMAC, bfont, Keyboard, and PVR. +* Support for SQs when using MMU. +* New Performance counter based performance monitor API. +* VMU metadata is now excluded from standard file reading and managed by API. +* [Driver for the SCI interface. Accessible on DC via mod or NAOMI via CN1.](https://github.com/KallistiOS/KallistiOS/pull/978) + +# API Breaking Changes + +## Strict types breaks + +In an effort to improve the reliability of our API overall, we have been moving +to using enum types and other defined types in place of standard types. This has +been done notably in the bfont, Keyboard, and PVR API reworks. These should +all remain compatible with previous implementations, but gcc 14+ will mark many +as errors rather than warnings. In every case, the error should clearly show +how simply changing the types of parameters will correct them. + +## VMU file headers + +Reads and writes to `/vmu/` will no longer need to be manually adjusted to avoid +writing into the file header or managing it specifically with file operations. +Instead `fs_vmu_set_header()` can be used to set the header to be used for a file +and `fs_vmu_default_header()` can be used to set a header to be used by default +for all files written to vmus. The file header contains metadata used by the +Dreamcast's BIOS in its memory manager and contain text and images. + +Prior to this change, files created by KOS on memory cards would either show +garbage in the Dreamcast's BIOS or the header would need to be manually compiled +and written to files prior to writing other data. This old behavior can still +be accessed by opening a `/vmu/` file with the `O_META` flag in `fs_open()`. + +# libpthreads + POSIX threading (pthreads) support has been moved out of the kernel and into its own addon library (libpthread). This support has been vastly improved and is much more complete and standard-compliant than it was before. It still isn't @@ -14,6 +66,8 @@ much more complete and standard-compliant than it was before. It still isn't no guarantee that this will work with GCC's `--enable-threads=posix`, as that configuration is not tested/supported any longer in dc-chain. +# Floating-point ABI + A significant change has been made regarding the default floating-point ABI used by KallistiOS. In previous KOS releases, and even in commercial games released during the Dreamcast's lifetime, the `m4-single-only` floating-point ABI was diff --git a/include/kos/version.h b/include/kos/version.h index 9b7e3baf..572692b2 100644 --- a/include/kos/version.h +++ b/include/kos/version.h @@ -41,7 +41,7 @@ ## Version Types The versioning information is split into two different groups: - + |Version Type|Description |------------|----------- |\ref version_comptime|The version of KOS your code is being compiled against. @@ -78,7 +78,7 @@ @{ */ -/** \defgroup version_comptime Compile-Time +/** \defgroup version_comptime Compile-Time \brief API providing compile-time KOS version and utilties. This API is is specifically for the compile-time versioning. As such, @@ -92,13 +92,13 @@ \brief Current compile-time version of KOS These macros provide information about the current version of KOS at - compile-time. + compile-time. @{ */ #define KOS_VERSION_MAJOR 2 /**< KOS's current major revision number. */ -#define KOS_VERSION_MINOR 1 /**< KOS's current minor revision number. */ +#define KOS_VERSION_MINOR 2 /**< KOS's current minor revision number. */ #define KOS_VERSION_PATCH 0 /**< KOS's current patch revision number. */ /** KOS's current version as an integer ID. */ @@ -116,8 +116,8 @@ \brief Compile-time checks against KOS's current version. This API provides several utility macros to check for a particular - exact, min, or max compile-time version for KOS. - + exact, min, or max compile-time version for KOS. + They are meant to be used with the preprocessor like so: \code{.c} @@ -150,7 +150,7 @@ KOS_VERSION_MAKE_ABOVE(major, minor, patch, KOS_VERSION) /** Compile-time check for a minimum KOS version. - + Checks to see whether the current KOS version is the same or higher than the given version. @@ -238,7 +238,7 @@ \brief Utilities for encoding a version from its components. @{ */ -/** Creates a version identifier from its constituents. +/** Creates a version identifier from its constituents. Used to create a version identifier at compile-time from its components. @@ -251,7 +251,7 @@ #define KOS_VERSION_MAKE(major, minor, patch) \ (((major) << 16) | ((minor) << 8) | (patch)) -/** Creates a version string from its constituents. +/** Creates a version string from its constituents. Used to create a compile-time string literal from version components. @@ -307,7 +307,7 @@ #define KOS_VERSION_MAKE_ABOVE(major, minor, patch, version) \ (KOS_VERSION_MAKE_COMPARISON(major, minor, patch, <, version)) -/** Creates a minimum version check. +/** Creates a minimum version check. Used to create a compile-time minimum version check. @@ -325,7 +325,7 @@ #define KOS_VERSION_MAKE_MIN(major, minor, patch, version) \ (KOS_VERSION_MAKE_COMPARISON(major, minor, patch, <=, version)) -/** Creates an exact version check. +/** Creates an exact version check. Used to create a compile-time exact version check. @@ -343,7 +343,7 @@ #define KOS_VERSION_MAKE_IS(major, minor, patch, version) \ (KOS_VERSION_MAKE_COMPARISON(major, minor, patch, ==, version)) -/** Creates a maximum version check. +/** Creates a maximum version check. Used to create a compile-time maximum version check. @@ -389,7 +389,7 @@ __BEGIN_DECLS #include <stdint.h> #include <stdbool.h> -/** \defgroup version_runtime Run-Time +/** \defgroup version_runtime Run-Time \brief API providing run-time KOS version and utilties. This API is is specifically for the run-time versioning. As such this @@ -399,7 +399,7 @@ __BEGIN_DECLS @{ */ -/** Type of a KOS version identifier. +/** Type of a KOS version identifier. This identifier packs the 3 version components into a single opaque ID. @@ -447,8 +447,8 @@ const char* kos_version_string(void); \brief Run-time checks against KOS's current version. This API provides several utility functions to check for a particular - exact, min, or max run-time version for KOS. - + exact, min, or max run-time version for KOS. + They are meant to be used as conditional expressions as such: \code{.c} @@ -492,7 +492,7 @@ bool kos_version_above(uint8_t major, uint16_t minor, uint8_t patch); bool kos_version_min(uint8_t major, uint16_t minor, uint8_t patch); /** Exact version run-time check for KOS - + Checks whether the current run-time version of KOS matches the given version. @@ -501,7 +501,7 @@ bool kos_version_min(uint8_t major, uint16_t minor, uint8_t patch); \param patch Patch version component. \retval true The version matches exactly. - \retval false The version does not match. + \retval false The version does not match. */ bool kos_version_is(uint8_t major, uint16_t minor, uint8_t patch); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-07-02 00:25: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 0c6a4cf9e383fdfea5c2bcfefab301beee349f80 (commit) from b50848f0ccc2c227f3cd90aeeb7c903016c6c45a (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 0c6a4cf9e383fdfea5c2bcfefab301beee349f80 Author: Paul Cercueil <pa...@cr...> Date: Sat Jun 28 23:00:17 2025 +0200 Fix built object file not added to the KOS library The source files inside the kernel/ subdirectory (which is just version.c for now) were compiled, but the object files were not added to the KallistiOS library. Address this by adding a Makefile dependency on the "defaultall" rule, which will copy the object files to the build folder, so that they are subsequently compiled inside the KallistiOS library. Signed-off-by: Paul Cercueil <pa...@cr...> ----------------------------------------------------------------------- Summary of changes: kernel/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/Makefile b/kernel/Makefile index 62dfa91c..85902e32 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -12,7 +12,7 @@ STUBS = stubs/kernel_export_stubs.o stubs/arch_export_stubs.o # Everything from here up should be plain old C. KOS_CFLAGS += $(KOS_CSTD) -all: subdirs $(STUBS) $(OBJS) +all: defaultall $(STUBS) rm -f $(KOS_BASE)/lib/$(KOS_ARCH)/libkallisti.a kos-ar rcs $(KOS_BASE)/lib/$(KOS_ARCH)/libromdiskbase.a romdisk/*.o kos-ar rcs $(KOS_BASE)/lib/$(KOS_ARCH)/libkallisti.a build/*.o hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-06-28 22:44: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 b50848f0ccc2c227f3cd90aeeb7c903016c6c45a (commit) via 19a74dd3f02dc6fdec3fa42dc9123e5293865355 (commit) via d099c4fefee1ac4a4c70f5a5d5740220b6b33a78 (commit) from 821ce865fd1bc51b6bd7c93800520ae76a52ecaf (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 b50848f0ccc2c227f3cd90aeeb7c903016c6c45a Author: QuzarDC <qu...@co...> Date: Sun Jun 22 19:36:28 2025 -0400 Clean up usage of packed attribute in addons. Both KOS and newlib provide `__packed` as a compatibility layer, no reason the addons should be operating differently. commit 19a74dd3f02dc6fdec3fa42dc9123e5293865355 Author: QuzarDC <qu...@co...> Date: Sun Jun 22 04:53:13 2025 -0400 Use regfield macros. This actually makes a difference in asic as there was a possibility of shifting up by 32, enough to be invalid for a signed int and the BIT macro enforces `1u`. commit d099c4fefee1ac4a4c70f5a5d5740220b6b33a78 Author: QuzarDC <qu...@co...> Date: Sat Jun 21 15:04:39 2025 -0400 Use `__is_aligned` and `__alignup` builtins. To note, I've applied them only when the param is a pointer. ----------------------------------------------------------------------- Summary of changes: addons/libkosext2fs/superblock.h | 2 +- addons/libkosfat/bpb.h | 10 +-- addons/libkosfat/directory.h | 4 +- addons/libkosutils/pcx_small.c | 2 +- addons/libppp/pap.c | 10 +-- addons/libppp/ppp_internal.h | 10 +-- kernel/arch/dreamcast/fs/fs_iso9660.c | 2 +- kernel/arch/dreamcast/hardware/asic.c | 7 +- kernel/arch/dreamcast/hardware/dmac.c | 2 +- kernel/arch/dreamcast/hardware/g2dma.c | 6 +- kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c | 4 +- kernel/arch/dreamcast/hardware/pvr/pvr_scene.c | 2 +- kernel/arch/dreamcast/hardware/scif-spi.c | 13 ++-- kernel/arch/dreamcast/hardware/spu.c | 2 +- kernel/arch/dreamcast/hardware/sq.c | 2 +- kernel/arch/dreamcast/include/dc/fifo.h | 14 ++-- .../arch/dreamcast/include/dc/maple/controller.h | 77 +++++++++++----------- kernel/arch/dreamcast/include/dc/maple/mouse.h | 7 +- kernel/arch/dreamcast/kernel/timer.c | 19 +++--- kernel/arch/dreamcast/kernel/wdt.c | 13 ++-- kernel/arch/dreamcast/sound/snd_stream.c | 8 +-- 21 files changed, 103 insertions(+), 113 deletions(-) diff --git a/addons/libkosext2fs/superblock.h b/addons/libkosext2fs/superblock.h index 65116f0f..e0dcdcd6 100644 --- a/addons/libkosext2fs/superblock.h +++ b/addons/libkosext2fs/superblock.h @@ -95,7 +95,7 @@ typedef struct ext2_superblock { uint32_t s_first_meta_bg; uint8_t unused[760]; -} __attribute__((packed)) ext2_superblock_t; +} __packed ext2_superblock_t; /* s_state values */ #define EXT2_VALID_FS 1 diff --git a/addons/libkosfat/bpb.h b/addons/libkosfat/bpb.h index b7ac1e95..64d0cc98 100644 --- a/addons/libkosfat/bpb.h +++ b/addons/libkosfat/bpb.h @@ -27,7 +27,7 @@ typedef struct fat_bpb { uint8_t num_heads[2]; uint8_t hidden_sector_count[4]; uint8_t num_sectors32[4]; -} __attribute__((packed)) fat_bpb_t; +} __packed fat_bpb_t; typedef struct fat16_ebpb { uint8_t drive_number; @@ -38,7 +38,7 @@ typedef struct fat16_ebpb { uint8_t fs_type[8]; uint8_t boot_code[448]; uint8_t boot_sig[2]; -} __attribute__((packed)) fat16_ebpb_t; +} __packed fat16_ebpb_t; typedef struct fat32_ebpb { uint8_t fat_size[4]; @@ -56,7 +56,7 @@ typedef struct fat32_ebpb { uint8_t fs_type[8]; uint8_t boot_code[420]; uint8_t boot_sig[2]; -} __attribute__((packed)) fat32_ebpb_t; +} __packed fat32_ebpb_t; typedef struct fat_bootblock { fat_bpb_t bpb; @@ -64,7 +64,7 @@ typedef struct fat_bootblock { fat16_ebpb_t fat16; fat32_ebpb_t fat32; } ebpb; -} __attribute__((packed,aligned(32))) fat_bootblock_t; +} __packed __attribute__((aligned(32))) fat_bootblock_t; typedef struct fat32_fsinfo { uint32_t fsinfo_sig1; @@ -74,7 +74,7 @@ typedef struct fat32_fsinfo { uint32_t last_alloc_cluster; uint8_t reserved2[12]; uint32_t fsinfo_sig3; -} __attribute__((packed,aligned(32))) fat32_fsinfo_t; +} __packed __attribute__((aligned(32))) fat32_fsinfo_t; #define FAT32_FSINFO_SIG1 0x41615252 #define FAT32_FSINFO_SIG2 0x61417272 diff --git a/addons/libkosfat/directory.h b/addons/libkosfat/directory.h index b938ef40..b78d6ea7 100644 --- a/addons/libkosfat/directory.h +++ b/addons/libkosfat/directory.h @@ -27,7 +27,7 @@ typedef struct fat_dentry { uint16_t mdate; uint16_t cluster_low; uint32_t size; -} __attribute__((packed)) fat_dentry_t; +} __packed fat_dentry_t; #define FAT_ENTRY_EOD 0x00 #define FAT_ENTRY_FREE 0xE5 @@ -54,7 +54,7 @@ typedef struct fat_longname { uint8_t name2[12]; uint16_t cluster_low; uint8_t name3[4]; -} __attribute__((packed)) fat_longname_t; +} __packed fat_longname_t; #define FAT_ORDER_LAST 0x40 diff --git a/addons/libkosutils/pcx_small.c b/addons/libkosutils/pcx_small.c index 7f8ce79c..0dc8faa6 100644 --- a/addons/libkosutils/pcx_small.c +++ b/addons/libkosutils/pcx_small.c @@ -27,7 +27,7 @@ typedef struct { uint16 bpl; /* bytes per line, 80 in mode 0x13 */ uint16 pltype; /* Grey or Color palette flag */ char filler[58]; /* Zsoft wanted a 128 byte header */ -} __attribute__((packed)) pcx_hdr; +} __packed pcx_hdr; /* This version converts directly into 16-bit BGR data */ int pcx_load_flat(const char *fn, int *w_out, int *h_out, void *pic_out) { diff --git a/addons/libppp/pap.c b/addons/libppp/pap.c index 5255ae1c..b4a58241 100644 --- a/addons/libppp/pap.c +++ b/addons/libppp/pap.c @@ -23,20 +23,12 @@ static int resend_cnt; #define PAP_AUTHENTICATE_ACK 2 #define PAP_AUTHENTICATE_NAK 3 -#ifdef PACKED -#undef PACKED -#endif - -#define PACKED __attribute__((packed)) - typedef struct pap_packet { uint8_t code; uint8_t id; uint16_t len; uint8_t data[]; -} PACKED pap_pkt_t; - -#undef PACKED +} __packed pap_pkt_t; static int pap_send_auth_req(ppp_protocol_t *self, int resend) { int nl = strlen(ppp_state->username); diff --git a/addons/libppp/ppp_internal.h b/addons/libppp/ppp_internal.h index 2f4cf018..7f8d66ac 100644 --- a/addons/libppp/ppp_internal.h +++ b/addons/libppp/ppp_internal.h @@ -69,24 +69,16 @@ typedef struct ppp_state { #define PPP_PROTOCOL_PAP 0xc023 /* RFC 1334 */ #define PPP_PROTOCOL_CHAP 0xc223 /* RFC 1994 */ -#ifdef PACKED -#undef PACKED -#endif - -#define PACKED __attribute__((packed)) - /* LCP packet structure - RFC 1661 Section 5 */ typedef struct lcp_packet { uint8_t code; uint8_t id; uint16_t len; uint8_t data[]; -} PACKED lcp_pkt_t; +} __packed lcp_pkt_t; typedef struct lcp_packet ipcp_pkt_t; -#undef PACKED - /* LCP Packet codes - RFC 1661 Section 5 Note: These also apply (in part) to network control protocols like IPCP. */ #define LCP_CONFIGURE_REQUEST 1 diff --git a/kernel/arch/dreamcast/fs/fs_iso9660.c b/kernel/arch/dreamcast/fs/fs_iso9660.c index c8a1aaba..5fbd4d74 100644 --- a/kernel/arch/dreamcast/fs/fs_iso9660.c +++ b/kernel/arch/dreamcast/fs/fs_iso9660.c @@ -690,7 +690,7 @@ static ssize_t iso_read(void * h, void *buf, size_t bytes) { /* If we're on a sector boundary and we have more than one full sector to read, then short-circuit the cache here and use the multi-sector reads from the CD unit. */ - if(thissect == 2048 && toread >= 2048 && (((uintptr_t)outbuf) & 31) == 0) { + if(thissect == 2048 && toread >= 2048 && __is_aligned(outbuf, 32)) { /* Round it off to an even sector count. */ thissect = toread / 2048; toread = thissect * 2048; diff --git a/kernel/arch/dreamcast/hardware/asic.c b/kernel/arch/dreamcast/hardware/asic.c index e9f78b0b..30c610e4 100644 --- a/kernel/arch/dreamcast/hardware/asic.c +++ b/kernel/arch/dreamcast/hardware/asic.c @@ -102,6 +102,7 @@ #include <dc/asic.h> #include <arch/spinlock.h> #include <kos/genwait.h> +#include <kos/regfield.h> #include <kos/worker_thread.h> /* XXX These based on g1ata.c and pvr.h and should be replaced by a standardized method */ @@ -167,7 +168,7 @@ static void handler_irq9(irq_t source, irq_context_t *context, void *data) { for(i = 0; i < ASIC_EVT_REG_HNDS; i++) { entry = &handlers[reg][i]; - if((mask & (1 << i)) && entry->hdl != NULL) + if((mask & BIT(i)) && entry->hdl != NULL) entry->hdl((reg << 8) | i, entry->data); } } @@ -195,7 +196,7 @@ void asic_evt_disable(uint16_t code, uint8_t irqlevel) { uint32_t addr = ASIC_EVT_REG_ADDR(irqlevel, evtreg); uint32_t val = IN32(addr); - OUT32(addr, val & ~(1 << evt)); + OUT32(addr, val & ~BIT(evt)); } /* Enable a particular G2 event */ @@ -209,7 +210,7 @@ void asic_evt_enable(uint16_t code, uint8_t irqlevel) { uint32_t addr = ASIC_EVT_REG_ADDR(irqlevel, evtreg); uint32_t val = IN32(addr); - OUT32(addr, val | (1 << evt)); + OUT32(addr, val | BIT(evt)); } /* Initialize events */ diff --git a/kernel/arch/dreamcast/hardware/dmac.c b/kernel/arch/dreamcast/hardware/dmac.c index aec59034..d674fbf7 100644 --- a/kernel/arch/dreamcast/hardware/dmac.c +++ b/kernel/arch/dreamcast/hardware/dmac.c @@ -129,7 +129,7 @@ int dma_transfer(const dma_config_t *cfg, dma_addr_t dst, dma_addr_t src, unsigned int transfer_size = dma_unit_size[cfg->unit_size]; uint32_t chcr; - if((len | dst | src) & (transfer_size - 1)) { + if(!__is_aligned(len | dst | src, transfer_size)) { dbglog(DBG_ERROR, "dmac: src/dst/len not aligned to the bus width\n"); errno = EFAULT; return -1; diff --git a/kernel/arch/dreamcast/hardware/g2dma.c b/kernel/arch/dreamcast/hardware/g2dma.c index ed37533d..e8ae8e12 100644 --- a/kernel/arch/dreamcast/hardware/g2dma.c +++ b/kernel/arch/dreamcast/hardware/g2dma.c @@ -173,13 +173,13 @@ int g2_dma_transfer(void *sh4, void *g2bus, size_t length, uint32_t block, } /* Check alignments */ - if(((uint32_t)sh4) & 31) { + if(!__is_aligned(sh4, 32)) { dbglog(DBG_ERROR, "g2_dma: Unaligned sh4 DMA %p\n", sh4); errno = EFAULT; return -1; } - if(((uint32_t)g2bus) & 31) { + if(!__is_aligned(g2bus, 32)) { dbglog(DBG_ERROR, "g2_dma: Unaligned g2bus DMA %p\n", g2bus); errno = EFAULT; return -1; @@ -193,7 +193,7 @@ int g2_dma_transfer(void *sh4, void *g2bus, size_t length, uint32_t block, dma_progress[g2chn] = 1; /* Make sure length is a multiple of 32 */ - length = (length + 0x1f) & ~0x1f; + length = __align_up(length, 32); dma_blocking[g2chn] = block; dma_callback[g2chn] = callback; diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c b/kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c index 8652b61b..7000e75d 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c @@ -149,9 +149,7 @@ available texture RAM, the PVR structures for the two frames are broken up and placed at 0x000000 and 0x400000. */ -#define BUF_ALIGN 128 -#define BUF_ALIGN_MASK (BUF_ALIGN - 1) -#define APPLY_ALIGNMENT(addr) (((addr) + BUF_ALIGN_MASK) & ~BUF_ALIGN_MASK) +#define APPLY_ALIGNMENT(addr) __align_up(addr, 128) void pvr_allocate_buffers(const pvr_init_params_t *params) { volatile pvr_ta_buffers_t *buf; diff --git a/kernel/arch/dreamcast/hardware/pvr/pvr_scene.c b/kernel/arch/dreamcast/hardware/pvr/pvr_scene.c index 9bdc6746..69fa89a9 100644 --- a/kernel/arch/dreamcast/hardware/pvr/pvr_scene.c +++ b/kernel/arch/dreamcast/hardware/pvr/pvr_scene.c @@ -48,7 +48,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(!(((uintptr_t)buffer) & 31)); + assert(__is_aligned(buffer, 32)); assert(!(len & 63)); // Save the old value. diff --git a/kernel/arch/dreamcast/hardware/scif-spi.c b/kernel/arch/dreamcast/hardware/scif-spi.c index cef162b1..0485a9e5 100644 --- a/kernel/arch/dreamcast/hardware/scif-spi.c +++ b/kernel/arch/dreamcast/hardware/scif-spi.c @@ -10,6 +10,7 @@ #include <dc/fs_dcload.h> #include <arch/timer.h> #include <kos/dbglog.h> +#include <kos/regfield.h> /* SCIF registers */ #define SCIFREG08(x) *((volatile uint8 *)(x)) @@ -26,12 +27,12 @@ #define SCLSR2 SCIFREG16(0xffe80024) /* Values for the SCSPTR2 register */ -#define PTR2_RTSIO (1 << 7) -#define PTR2_RTSDT (1 << 6) -#define PTR2_CTSIO (1 << 5) -#define PTR2_CTSDT (1 << 4) -#define PTR2_SPB2IO (1 << 1) -#define PTR2_SPB2DT (1 << 0) +#define PTR2_RTSIO BIT(7) +#define PTR2_RTSDT BIT(6) +#define PTR2_CTSIO BIT(5) +#define PTR2_CTSDT BIT(4) +#define PTR2_SPB2IO BIT(1) +#define PTR2_SPB2DT BIT(0) /* This doesn't seem to actually be necessary on any of the SD cards I've tried, but I'm keeping it around, just in case... */ diff --git a/kernel/arch/dreamcast/hardware/spu.c b/kernel/arch/dreamcast/hardware/spu.c index e5db35f5..21e55966 100644 --- a/kernel/arch/dreamcast/hardware/spu.c +++ b/kernel/arch/dreamcast/hardware/spu.c @@ -121,7 +121,7 @@ void spu_memload_dma(uintptr_t dst, void *src_void, size_t length) { spu_memload(dst, src_void, length); return; } - if(((uintptr_t)src_void) & 31) { + if(!__is_aligned(src_void, 32)) { spu_memload_sq(dst, src_void, length); return; } diff --git a/kernel/arch/dreamcast/hardware/sq.c b/kernel/arch/dreamcast/hardware/sq.c index 263038ba..53ae4427 100644 --- a/kernel/arch/dreamcast/hardware/sq.c +++ b/kernel/arch/dreamcast/hardware/sq.c @@ -142,7 +142,7 @@ __no_inline void *sq_cpy(void *dest, const void *src, size_t n) { n -= nb; /* If src is not 8-byte aligned, slow path */ - if ((uintptr_t)src & 7) { + if (!__is_aligned(src, 8)) { while(nb--) { dcache_pref_block(s + 8); /* Prefetch 32 bytes for next loop */ d[0] = *(s++); diff --git a/kernel/arch/dreamcast/include/dc/fifo.h b/kernel/arch/dreamcast/include/dc/fifo.h index 682e9b58..c029b7a5 100644 --- a/kernel/arch/dreamcast/include/dc/fifo.h +++ b/kernel/arch/dreamcast/include/dc/fifo.h @@ -21,6 +21,8 @@ #include <sys/cdefs.h> __BEGIN_DECLS +#include <kos/regfield.h> + /** \defgroup system_fifo FIFO \brief API for checking FIFO statuses \ingroup system @@ -46,12 +48,12 @@ __BEGIN_DECLS @{ */ -#define FIFO_AICA (1 << 0) /** \brief AICA FIFO status mask. */ -#define FIFO_BBA (1 << 1) /** \brief BBA FIFO status mask. */ -#define FIFO_EXT2 (1 << 2) /** \brief EXT2 FIFO status mask. */ -#define FIFO_EXTDEV (1 << 3) /** \brief EXTDEV FIFO status mask. */ -#define FIFO_G2 (1 << 4) /** \brief G2 FIFO status mask. */ -#define FIFO_SH4 (1 << 5) /** \brief SH4 FIFO status mask. */ +#define FIFO_AICA BIT(0) /** \brief AICA FIFO status mask. */ +#define FIFO_BBA BIT(1) /** \brief BBA FIFO status mask. */ +#define FIFO_EXT2 BIT(2) /** \brief EXT2 FIFO status mask. */ +#define FIFO_EXTDEV BIT(3) /** \brief EXTDEV FIFO status mask. */ +#define FIFO_G2 BIT(4) /** \brief G2 FIFO status mask. */ +#define FIFO_SH4 BIT(5) /** \brief SH4 FIFO status mask. */ /** @} */ diff --git a/kernel/arch/dreamcast/include/dc/maple/controller.h b/kernel/arch/dreamcast/include/dc/maple/controller.h index c5450091..22034888 100644 --- a/kernel/arch/dreamcast/include/dc/maple/controller.h +++ b/kernel/arch/dreamcast/include/dc/maple/controller.h @@ -28,6 +28,7 @@ __BEGIN_DECLS #include <stdint.h> +#include <kos/regfield.h> /** \defgroup controller Controller \brief Controller Maple Device API @@ -99,22 +100,22 @@ __BEGIN_DECLS @{ */ -#define CONT_C (1<<0) /**< \brief C button Mask. */ -#define CONT_B (1<<1) /**< \brief B button Mask. */ -#define CONT_A (1<<2) /**< \brief A button Mask. */ -#define CONT_START (1<<3) /**< \brief Start button Mask. */ -#define CONT_DPAD_UP (1<<4) /**< \brief Main Dpad Up button Mask. */ -#define CONT_DPAD_DOWN (1<<5) /**< \brief Main Dpad Down button Mask. */ -#define CONT_DPAD_LEFT (1<<6) /**< \brief Main Dpad Left button Mask. */ -#define CONT_DPAD_RIGHT (1<<7) /**< \brief Main Dpad right button Mask. */ -#define CONT_Z (1<<8) /**< \brief Z button Mask. */ -#define CONT_Y (1<<9) /**< \brief Y button Mask. */ -#define CONT_X (1<<10) /**< \brief X button Mask. */ -#define CONT_D (1<<11) /**< \brief D button Mask. */ -#define CONT_DPAD2_UP (1<<12) /**< \brief Secondary Dpad Up button Mask. */ -#define CONT_DPAD2_DOWN (1<<13) /**< \brief Secondary Dpad Down button Mask. */ -#define CONT_DPAD2_LEFT (1<<14) /**< \brief Secondary Dpad Left button Mask. */ -#define CONT_DPAD2_RIGHT (1<<15) /**< \brief Secondary Dpad Right button Mask. */ +#define CONT_C BIT(0) /**< \brief C button Mask. */ +#define CONT_B BIT(1) /**< \brief B button Mask. */ +#define CONT_A BIT(2) /**< \brief A button Mask. */ +#define CONT_START BIT(3) /**< \brief Start button Mask. */ +#define CONT_DPAD_UP BIT(4) /**< \brief Main Dpad Up button Mask. */ +#define CONT_DPAD_DOWN BIT(5) /**< \brief Main Dpad Down button Mask. */ +#define CONT_DPAD_LEFT BIT(6) /**< \brief Main Dpad Left button Mask. */ +#define CONT_DPAD_RIGHT BIT(7) /**< \brief Main Dpad right button Mask. */ +#define CONT_Z BIT(8) /**< \brief Z button Mask. */ +#define CONT_Y BIT(9) /**< \brief Y button Mask. */ +#define CONT_X BIT(10) /**< \brief X button Mask. */ +#define CONT_D BIT(11) /**< \brief D button Mask. */ +#define CONT_DPAD2_UP BIT(12) /**< \brief Secondary Dpad Up button Mask. */ +#define CONT_DPAD2_DOWN BIT(13) /**< \brief Secondary Dpad Down button Mask. */ +#define CONT_DPAD2_LEFT BIT(14) /**< \brief Secondary Dpad Left button Mask. */ +#define CONT_DPAD2_RIGHT BIT(15) /**< \brief Secondary Dpad Right button Mask. */ /** @} */ /** \brief Controller buttons for standard reset action @@ -238,28 +239,28 @@ int cont_btn_callback(uint8_t addr, uint32_t btns, cont_btn_callback_t cb); @{ */ -#define CONT_CAPABILITY_C (1<<24) /**< \brief C button capability mask. */ -#define CONT_CAPABILITY_B (1<<25) /**< \brief B button capability mask. */ -#define CONT_CAPABILITY_A (1<<26) /**< \brief A button capability mask. */ -#define CONT_CAPABILITY_START (1<<27) /**< \brief Start button capability mask. */ -#define CONT_CAPABILITY_DPAD_UP (1<<28) /**< \brief First Dpad up capability mask. */ -#define CONT_CAPABILITY_DPAD_DOWN (1<<29) /**< \brief First Dpad down capability mask. */ -#define CONT_CAPABILITY_DPAD_LEFT (1<<30) /**< \brief First Dpad left capability mask. */ -#define CONT_CAPABILITY_DPAD_RIGHT (1<<31) /**< \brief First Dpad right capability mask. */ -#define CONT_CAPABILITY_Z (1<<16) /**< \brief Z button capability mask. */ -#define CONT_CAPABILITY_Y (1<<17) /**< \brief Y button capability mask. */ -#define CONT_CAPABILITY_X (1<<18) /**< \brief X button capability mask. */ -#define CONT_CAPABILITY_D (1<<19) /**< \brief D button capability mask. */ -#define CONT_CAPABILITY_DPAD2_UP (1<<20) /**< \brief Second Dpad up capability mask. */ -#define CONT_CAPABILITY_DPAD2_DOWN (1<<21) /**< \brief Second Dpad down capability mask. */ -#define CONT_CAPABILITY_DPAD2_LEFT (1<<22) /**< \brief Second Dpad left capability mask. */ -#define CONT_CAPABILITY_DPAD2_RIGHT (1<<23) /**< \brief Second Dpad right capability mask. */ -#define CONT_CAPABILITY_RTRIG (1<<8) /**< \brief Right trigger capability mask. */ -#define CONT_CAPABILITY_LTRIG (1<<9) /**< \brief Left trigger capability mask. */ -#define CONT_CAPABILITY_ANALOG_X (1<<10) /**< \brief First analog X axis capability mask. */ -#define CONT_CAPABILITY_ANALOG_Y (1<<11) /**< \brief First analog Y axis capability mask. */ -#define CONT_CAPABILITY_ANALOG2_X (1<<12) /**< \brief Second analog X axis capability mask. */ -#define CONT_CAPABILITY_ANALOG2_Y (1<<13) /**< \brief Second analog Y axis capability mask. */ +#define CONT_CAPABILITY_C BIT(24) /**< \brief C button capability mask. */ +#define CONT_CAPABILITY_B BIT(25) /**< \brief B button capability mask. */ +#define CONT_CAPABILITY_A BIT(26) /**< \brief A button capability mask. */ +#define CONT_CAPABILITY_START BIT(27) /**< \brief Start button capability mask. */ +#define CONT_CAPABILITY_DPAD_UP BIT(28) /**< \brief First Dpad up capability mask. */ +#define CONT_CAPABILITY_DPAD_DOWN BIT(29) /**< \brief First Dpad down capability mask. */ +#define CONT_CAPABILITY_DPAD_LEFT BIT(30) /**< \brief First Dpad left capability mask. */ +#define CONT_CAPABILITY_DPAD_RIGHT BIT(31) /**< \brief First Dpad right capability mask. */ +#define CONT_CAPABILITY_Z BIT(16) /**< \brief Z button capability mask. */ +#define CONT_CAPABILITY_Y BIT(17) /**< \brief Y button capability mask. */ +#define CONT_CAPABILITY_X BIT(18) /**< \brief X button capability mask. */ +#define CONT_CAPABILITY_D BIT(19) /**< \brief D button capability mask. */ +#define CONT_CAPABILITY_DPAD2_UP BIT(20) /**< \brief Second Dpad up capability mask. */ +#define CONT_CAPABILITY_DPAD2_DOWN BIT(21) /**< \brief Second Dpad down capability mask. */ +#define CONT_CAPABILITY_DPAD2_LEFT BIT(22) /**< \brief Second Dpad left capability mask. */ +#define CONT_CAPABILITY_DPAD2_RIGHT BIT(23) /**< \brief Second Dpad right capability mask. */ +#define CONT_CAPABILITY_RTRIG BIT(8) /**< \brief Right trigger capability mask. */ +#define CONT_CAPABILITY_LTRIG BIT(9) /**< \brief Left trigger capability mask. */ +#define CONT_CAPABILITY_ANALOG_X BIT(10) /**< \brief First analog X axis capability mask. */ +#define CONT_CAPABILITY_ANALOG_Y BIT(11) /**< \brief First analog Y axis capability mask. */ +#define CONT_CAPABILITY_ANALOG2_X BIT(12) /**< \brief Second analog X axis capability mask. */ +#define CONT_CAPABILITY_ANALOG2_Y BIT(13) /**< \brief Second analog Y axis capability mask. */ /** @} */ /** \defgroup controller_caps_groups Capability Groups diff --git a/kernel/arch/dreamcast/include/dc/maple/mouse.h b/kernel/arch/dreamcast/include/dc/maple/mouse.h index 31803f92..b10a4f01 100644 --- a/kernel/arch/dreamcast/include/dc/maple/mouse.h +++ b/kernel/arch/dreamcast/include/dc/maple/mouse.h @@ -23,6 +23,7 @@ __BEGIN_DECLS #include <stdint.h> +#include <kos/regfield.h> /** \defgroup mouse Mouse \brief Driver for the Dreamcast's Mouse Input Device @@ -37,9 +38,9 @@ __BEGIN_DECLS @{ */ -#define MOUSE_RIGHTBUTTON (1<<1) /**< \brief Right mouse button */ -#define MOUSE_LEFTBUTTON (1<<2) /**< \brief Left mouse button */ -#define MOUSE_SIDEBUTTON (1<<3) /**< \brief Side mouse button */ +#define MOUSE_RIGHTBUTTON BIT(1) /**< \brief Right mouse button */ +#define MOUSE_LEFTBUTTON BIT(2) /**< \brief Left mouse button */ +#define MOUSE_SIDEBUTTON BIT(3) /**< \brief Side mouse button */ /** @} */ ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-06-28 19:48:29
|
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 821ce865fd1bc51b6bd7c93800520ae76a52ecaf (commit) from 77d9e22dafdf4c1210f06d6676b740e6ff34bda4 (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 821ce865fd1bc51b6bd7c93800520ae76a52ecaf Author: QuzarDC <qu...@co...> Date: Thu Jun 26 19:32:31 2025 -0400 examples: replace `.keepme` with `.gitignore` In each case that we were using `.keepme`, we had an empty romdisk folder that is either populated by generated files, or in the case of the sound examples user provided files. Instead of having a `.gitignore` in the main folder of the example that lists the files to ignore in the romdisk, then a separate `.keepme` just to keep the dir alive, we can have the `.gitignore` be directly in the romdisk folder. To match this, the Makefile.rules was updated to have romdisk building ignore `.gitignore` (which seems like just a nice thing anyways for users). Additionally, the sound examples previously did not have any `.gitignore` so so it was added to prevent the `test.mp3/ogg/opus/adx` files from appearing as untracked files. ----------------------------------------------------------------------- Summary of changes: Makefile.rules | 2 +- examples/dreamcast/basic/exec/.gitignore | 1 - examples/dreamcast/basic/exec/romdisk/.gitignore | 1 + examples/dreamcast/basic/exec/romdisk/.keepme | 0 examples/dreamcast/cpp/modplug_test/romdisk/.keepme | 0 examples/dreamcast/pvr/bumpmap/.gitignore | 2 -- examples/dreamcast/pvr/bumpmap/romdisk/.gitignore | 2 ++ examples/dreamcast/pvr/bumpmap/romdisk/.keepme | 0 examples/dreamcast/sound/ghettoplay-vorbis/romdisk/.gitignore | 2 ++ examples/dreamcast/sound/ghettoplay-vorbis/romdisk/.keepme | 0 examples/dreamcast/sound/hello-adx/romdisk/.gitignore | 1 + examples/dreamcast/sound/hello-adx/romdisk/.keepme | 0 examples/dreamcast/sound/hello-mp3/romdisk/.gitignore | 1 + examples/dreamcast/sound/hello-mp3/romdisk/.keepme | 0 examples/dreamcast/sound/hello-ogg/romdisk/.gitignore | 1 + examples/dreamcast/sound/hello-ogg/romdisk/.keepme | 0 examples/dreamcast/sound/hello-opus/romdisk/.gitignore | 1 + examples/dreamcast/sound/hello-opus/romdisk/.keepme | 0 18 files changed, 10 insertions(+), 4 deletions(-) delete mode 100644 examples/dreamcast/basic/exec/.gitignore create mode 100644 examples/dreamcast/basic/exec/romdisk/.gitignore delete mode 100644 examples/dreamcast/basic/exec/romdisk/.keepme delete mode 100644 examples/dreamcast/cpp/modplug_test/romdisk/.keepme delete mode 100644 examples/dreamcast/pvr/bumpmap/.gitignore create mode 100644 examples/dreamcast/pvr/bumpmap/romdisk/.gitignore delete mode 100644 examples/dreamcast/pvr/bumpmap/romdisk/.keepme create mode 100644 examples/dreamcast/sound/ghettoplay-vorbis/romdisk/.gitignore delete mode 100644 examples/dreamcast/sound/ghettoplay-vorbis/romdisk/.keepme create mode 100644 examples/dreamcast/sound/hello-adx/romdisk/.gitignore delete mode 100644 examples/dreamcast/sound/hello-adx/romdisk/.keepme create mode 100644 examples/dreamcast/sound/hello-mp3/romdisk/.gitignore delete mode 100644 examples/dreamcast/sound/hello-mp3/romdisk/.keepme create mode 100644 examples/dreamcast/sound/hello-ogg/romdisk/.gitignore delete mode 100644 examples/dreamcast/sound/hello-ogg/romdisk/.keepme create mode 100644 examples/dreamcast/sound/hello-opus/romdisk/.gitignore delete mode 100644 examples/dreamcast/sound/hello-opus/romdisk/.keepme diff --git a/Makefile.rules b/Makefile.rules index 9fa4aa62..6c34c9ed 100644 --- a/Makefile.rules +++ b/Makefile.rules @@ -78,7 +78,7 @@ $(patsubst %, _clean_dir_%, $(SUBDIRS)): # Define KOS_ROMDISK_DIR in your Makefile if you want these two handy rules. ifdef KOS_ROMDISK_DIR romdisk.img: - $(KOS_GENROMFS) -f romdisk.img -d $(KOS_ROMDISK_DIR) -v -x .keepme -x .DS_Store -x Thumbs.db + $(KOS_GENROMFS) -f romdisk.img -d $(KOS_ROMDISK_DIR) -v -x .gitignore -x .DS_Store -x Thumbs.db romdisk.o: romdisk.img $(KOS_BASE)/utils/bin2c/bin2c romdisk.img romdisk_tmp.c romdisk diff --git a/examples/dreamcast/basic/exec/.gitignore b/examples/dreamcast/basic/exec/.gitignore deleted file mode 100644 index 2e6b6d00..00000000 --- a/examples/dreamcast/basic/exec/.gitignore +++ /dev/null @@ -1 +0,0 @@ -romdisk/sub.bin diff --git a/examples/dreamcast/basic/exec/romdisk/.gitignore b/examples/dreamcast/basic/exec/romdisk/.gitignore new file mode 100644 index 00000000..1a6f3dfa --- /dev/null +++ b/examples/dreamcast/basic/exec/romdisk/.gitignore @@ -0,0 +1 @@ +sub.bin diff --git a/examples/dreamcast/basic/exec/romdisk/.keepme b/examples/dreamcast/basic/exec/romdisk/.keepme deleted file mode 100644 index e69de29b..00000000 diff --git a/examples/dreamcast/cpp/modplug_test/romdisk/.keepme b/examples/dreamcast/cpp/modplug_test/romdisk/.keepme deleted file mode 100644 index e69de29b..00000000 diff --git a/examples/dreamcast/pvr/bumpmap/.gitignore b/examples/dreamcast/pvr/bumpmap/.gitignore deleted file mode 100644 index 5e74dd6d..00000000 --- a/examples/dreamcast/pvr/bumpmap/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -romdisk/bricks.kmg -romdisk/bumpmap.raw diff --git a/examples/dreamcast/pvr/bumpmap/romdisk/.gitignore b/examples/dreamcast/pvr/bumpmap/romdisk/.gitignore new file mode 100644 index 00000000..538da471 --- /dev/null +++ b/examples/dreamcast/pvr/bumpmap/romdisk/.gitignore @@ -0,0 +1,2 @@ +bricks.kmg +bumpmap.raw diff --git a/examples/dreamcast/pvr/bumpmap/romdisk/.keepme b/examples/dreamcast/pvr/bumpmap/romdisk/.keepme deleted file mode 100644 index e69de29b..00000000 diff --git a/examples/dreamcast/sound/ghettoplay-vorbis/romdisk/.gitignore b/examples/dreamcast/sound/ghettoplay-vorbis/romdisk/.gitignore new file mode 100644 index 00000000..c96a04f0 --- /dev/null +++ b/examples/dreamcast/sound/ghettoplay-vorbis/romdisk/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/examples/dreamcast/sound/ghettoplay-vorbis/romdisk/.keepme b/examples/dreamcast/sound/ghettoplay-vorbis/romdisk/.keepme deleted file mode 100644 index e69de29b..00000000 diff --git a/examples/dreamcast/sound/hello-adx/romdisk/.gitignore b/examples/dreamcast/sound/hello-adx/romdisk/.gitignore new file mode 100644 index 00000000..3320b97a --- /dev/null +++ b/examples/dreamcast/sound/hello-adx/romdisk/.gitignore @@ -0,0 +1 @@ +test.adx \ No newline at end of file diff --git a/examples/dreamcast/sound/hello-adx/romdisk/.keepme b/examples/dreamcast/sound/hello-adx/romdisk/.keepme deleted file mode 100644 index e69de29b..00000000 diff --git a/examples/dreamcast/sound/hello-mp3/romdisk/.gitignore b/examples/dreamcast/sound/hello-mp3/romdisk/.gitignore new file mode 100644 index 00000000..51d612ab --- /dev/null +++ b/examples/dreamcast/sound/hello-mp3/romdisk/.gitignore @@ -0,0 +1 @@ +test.mp3 \ No newline at end of file diff --git a/examples/dreamcast/sound/hello-mp3/romdisk/.keepme b/examples/dreamcast/sound/hello-mp3/romdisk/.keepme deleted file mode 100644 index e69de29b..00000000 diff --git a/examples/dreamcast/sound/hello-ogg/romdisk/.gitignore b/examples/dreamcast/sound/hello-ogg/romdisk/.gitignore new file mode 100644 index 00000000..442d8bf9 --- /dev/null +++ b/examples/dreamcast/sound/hello-ogg/romdisk/.gitignore @@ -0,0 +1 @@ +test.ogg \ No newline at end of file diff --git a/examples/dreamcast/sound/hello-ogg/romdisk/.keepme b/examples/dreamcast/sound/hello-ogg/romdisk/.keepme deleted file mode 100644 index e69de29b..00000000 diff --git a/examples/dreamcast/sound/hello-opus/romdisk/.gitignore b/examples/dreamcast/sound/hello-opus/romdisk/.gitignore new file mode 100644 index 00000000..77084508 --- /dev/null +++ b/examples/dreamcast/sound/hello-opus/romdisk/.gitignore @@ -0,0 +1 @@ +test.opus \ No newline at end of file diff --git a/examples/dreamcast/sound/hello-opus/romdisk/.keepme b/examples/dreamcast/sound/hello-opus/romdisk/.keepme deleted file mode 100644 index e69de29b..00000000 hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-06-28 19:47:38
|
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 77d9e22dafdf4c1210f06d6676b740e6ff34bda4 (commit) from 9525f1ed451487c3a11fb530269886d265a77840 (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 77d9e22dafdf4c1210f06d6676b740e6ff34bda4 Author: QuzarDC <qu...@co...> Date: Wed Jun 25 05:13:04 2025 -0400 Fixes for doxygen warnings pthread.h - endcond was inside the header ifdef guards and cond was on the outside, so doxygen couldn't see them both. vmu.h - wrong ref name was being used for bfont icons. keyboard.h - There may be a better fix for this, but it seems that doxygen is choking on the depr inside a union. ----------------------------------------------------------------------- Summary of changes: include/pthread.h | 4 ++-- kernel/arch/dreamcast/include/dc/maple/keyboard.h | 10 ++++++---- kernel/arch/dreamcast/include/dc/maple/vmu.h | 8 ++++---- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/include/pthread.h b/include/pthread.h index e5b0da88..44c9359b 100644 --- a/include/pthread.h +++ b/include/pthread.h @@ -27,11 +27,11 @@ \author Lawrence Sebald */ -/** \cond **/ - #ifndef __PTHREAD_H #define __PTHREAD_H +/** \cond **/ + #include <sys/cdefs.h> #include <sys/features.h> #include <sys/_pthreadtypes.h> diff --git a/kernel/arch/dreamcast/include/dc/maple/keyboard.h b/kernel/arch/dreamcast/include/dc/maple/keyboard.h index aa0dbdfa..35e76676 100644 --- a/kernel/arch/dreamcast/include/dc/maple/keyboard.h +++ b/kernel/arch/dreamcast/include/dc/maple/keyboard.h @@ -451,16 +451,18 @@ typedef struct kbd_state { /** \brief The latest raw condition of the keyboard. */ kbd_cond_t cond; - /** \brief Current (and previous) state of all keys in kbd_keys_t */ union { + /* \cond */ uint8_t matrix[KBD_MAX_KEYS] __depr("Please see key_state_t and use key_states to access this."); - key_state_t key_states[KBD_MAX_KEYS]; + /* \endcond */ + key_state_t key_states[KBD_MAX_KEYS]; /** \brief Current (and previous) state of all keys in kbd_keys_t */ }; - /** \brief Modifier key status. Stored to track changes. */ union { + /* \cond */ int shift_keys __depr("Please see kbd_mods_t and use last_modifiers.raw to access this."); - kbd_mods_t last_modifiers; + /* \endcond */ + kbd_mods_t last_modifiers; /** \brief Modifier key status. Stored to track changes. */ }; /** \brief Keyboard type/region. */ diff --git a/kernel/arch/dreamcast/include/dc/maple/vmu.h b/kernel/arch/dreamcast/include/dc/maple/vmu.h index 13e412c5..30e5f510 100644 --- a/kernel/arch/dreamcast/include/dc/maple/vmu.h +++ b/kernel/arch/dreamcast/include/dc/maple/vmu.h @@ -189,12 +189,12 @@ int vmu_get_custom_color(maple_device_t *dev, uint8_t *red, uint8_t *green, uint icon by providing custom icons for both the DC BIOS menu and the VMU's LCD screen. \param dev The device to change the icon shape of. - \param icon_shape One of the values found in \ref vmu_icons. + \param icon_shape One of the values found in \ref bfont_vmu_icon_t. \retval 0 On success \retval -1 On failure - \sa vmu_icons, vmu_get_icon_shape + \sa bfont_vmu_icon_t, vmu_get_icon_shape */ int vmu_set_icon_shape(maple_device_t *dev, uint8_t icon_shape); @@ -211,12 +211,12 @@ int vmu_set_icon_shape(maple_device_t *dev, uint8_t icon_shape); icon by providing custom icons for both the DC BIOS menu and the VMU's LCD screen. \param dev The device to change the icon shape of. - \param icon_shape One of the values found in \ref vmu_icons. + \param icon_shape One of the values found in \ref bfont_vmu_icon_t. \retval 0 On success \retval -1 On failure - \sa vmu_icons, vmu_set_icon_shape + \sa bfont_vmu_icon_t, vmu_set_icon_shape */ int vmu_get_icon_shape(maple_device_t *dev, uint8_t *icon_shape); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-06-28 19:47: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 9525f1ed451487c3a11fb530269886d265a77840 (commit) from 59fa7fd65a08ed7edc8b949cb1cd6a6bdc486eb0 (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 9525f1ed451487c3a11fb530269886d265a77840 Author: QuzarDC <qu...@co...> Date: Sat Jun 21 00:51:30 2025 -0400 Keep network examples connected to dcload console. By default most network examples were set to call dctool with `-n` to disconnect the debug console. The idea behind it seems to have been to prevent dcload-ip from interferring with the network traffic, but that's not needed. We have a system in place just for this and it relies on the dcload console being active in order to request the already assigned IP. ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/network/basic/Makefile | 4 ++-- examples/dreamcast/network/dns-client/Makefile | 2 +- examples/dreamcast/network/httpd/Makefile | 2 +- examples/dreamcast/network/ntp/Makefile | 2 +- examples/dreamcast/network/ping/Makefile | 4 ++-- examples/dreamcast/network/ping6/Makefile | 4 ++-- examples/dreamcast/network/speedtest/Makefile | 4 ++-- examples/dreamcast/network/udpecho6/Makefile | 4 ++-- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/dreamcast/network/basic/Makefile b/examples/dreamcast/network/basic/Makefile index 659c49f9..a05f43ec 100644 --- a/examples/dreamcast/network/basic/Makefile +++ b/examples/dreamcast/network/basic/Makefile @@ -1,7 +1,7 @@ # # Basic KallistiOS skeleton / test program # (c)2001 Megan Potter -# +# # Put the filename of the output binary here TARGET = basic.elf @@ -26,7 +26,7 @@ $(TARGET): $(OBJS) kos-cc -o $(TARGET) $(OBJS) run: $(TARGET) - $(KOS_LOADER) $(TARGET) -n + $(KOS_LOADER) $(TARGET) dist: $(TARGET) -rm -f $(OBJS) diff --git a/examples/dreamcast/network/dns-client/Makefile b/examples/dreamcast/network/dns-client/Makefile index d7c241c3..dfd496ea 100644 --- a/examples/dreamcast/network/dns-client/Makefile +++ b/examples/dreamcast/network/dns-client/Makefile @@ -21,7 +21,7 @@ $(TARGET): $(OBJS) kos-cc -o $(TARGET) $(OBJS) run: $(TARGET) - $(KOS_LOADER) $(TARGET) -n + $(KOS_LOADER) $(TARGET) dist: $(TARGET) -rm -f $(OBJS) diff --git a/examples/dreamcast/network/httpd/Makefile b/examples/dreamcast/network/httpd/Makefile index 31b8c56a..c52cd2be 100644 --- a/examples/dreamcast/network/httpd/Makefile +++ b/examples/dreamcast/network/httpd/Makefile @@ -28,7 +28,7 @@ $(TARGET): $(OBJS) kos-cc -o $(TARGET) $(OBJS) run: $(TARGET) - $(KOS_LOADER) $(TARGET) -n + $(KOS_LOADER) $(TARGET) dist: $(TARGET) -rm -f $(OBJS) romdisk.img diff --git a/examples/dreamcast/network/ntp/Makefile b/examples/dreamcast/network/ntp/Makefile index 3be6733f..5db8421e 100644 --- a/examples/dreamcast/network/ntp/Makefile +++ b/examples/dreamcast/network/ntp/Makefile @@ -27,7 +27,7 @@ $(TARGET): $(OBJS) kos-cc -o $(TARGET) $(OBJS) run: $(TARGET) - $(KOS_LOADER) $(TARGET) -n + $(KOS_LOADER) $(TARGET) dist: $(TARGET) -rm -f $(OBJS) diff --git a/examples/dreamcast/network/ping/Makefile b/examples/dreamcast/network/ping/Makefile index 5ce6a0e4..53b6c744 100644 --- a/examples/dreamcast/network/ping/Makefile +++ b/examples/dreamcast/network/ping/Makefile @@ -1,7 +1,7 @@ # # Basic KallistiOS skeleton / test program # (c)2001 Megan Potter -# +# # Put the filename of the output binary here TARGET = ping.elf @@ -26,7 +26,7 @@ $(TARGET): $(OBJS) kos-cc -o $(TARGET) $(OBJS) run: $(TARGET) - $(KOS_LOADER) $(TARGET) -n + $(KOS_LOADER) $(TARGET) dist: $(TARGET) -rm -f $(OBJS) diff --git a/examples/dreamcast/network/ping6/Makefile b/examples/dreamcast/network/ping6/Makefile index 5ce6a0e4..53b6c744 100644 --- a/examples/dreamcast/network/ping6/Makefile +++ b/examples/dreamcast/network/ping6/Makefile @@ -1,7 +1,7 @@ # # Basic KallistiOS skeleton / test program # (c)2001 Megan Potter -# +# # Put the filename of the output binary here TARGET = ping.elf @@ -26,7 +26,7 @@ $(TARGET): $(OBJS) kos-cc -o $(TARGET) $(OBJS) run: $(TARGET) - $(KOS_LOADER) $(TARGET) -n + $(KOS_LOADER) $(TARGET) dist: $(TARGET) -rm -f $(OBJS) diff --git a/examples/dreamcast/network/speedtest/Makefile b/examples/dreamcast/network/speedtest/Makefile index 5c85f2f3..6616bf00 100644 --- a/examples/dreamcast/network/speedtest/Makefile +++ b/examples/dreamcast/network/speedtest/Makefile @@ -1,6 +1,6 @@ # # KallistiOS network/speedtest example -# +# # Copyright (C) 2024 Andress Barajas # @@ -23,7 +23,7 @@ $(TARGET): $(OBJS) kos-cc -o $(TARGET) $(OBJS) run: $(TARGET) - $(KOS_LOADER) $(TARGET) -n + $(KOS_LOADER) $(TARGET) dist: $(TARGET) -rm -f $(OBJS) romdisk.img diff --git a/examples/dreamcast/network/udpecho6/Makefile b/examples/dreamcast/network/udpecho6/Makefile index 080db0a3..1189f081 100644 --- a/examples/dreamcast/network/udpecho6/Makefile +++ b/examples/dreamcast/network/udpecho6/Makefile @@ -1,7 +1,7 @@ # # Basic KallistiOS skeleton / test program # (c)2001 Megan Potter -# +# # Put the filename of the output binary here TARGET = echo.elf @@ -26,7 +26,7 @@ $(TARGET): $(OBJS) kos-cc -o $(TARGET) $(OBJS) run: $(TARGET) - $(KOS_LOADER) $(TARGET) -n + $(KOS_LOADER) $(TARGET) dist: $(TARGET) -rm -f $(OBJS) hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-06-25 00:03:37
|
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 59fa7fd65a08ed7edc8b949cb1cd6a6bdc486eb0 (commit) from 3c2d96a8ce8d4b9622648ad78dfb82a4db5c233c (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 59fa7fd65a08ed7edc8b949cb1cd6a6bdc486eb0 Author: darc <da...@pr...> Date: Tue Jun 24 17:08:38 2025 -0500 dc-chain: Make GDB CPATH and LIBRARY_PATH exports for macOS conditional In the default case, we specify the CPATH and LIBRARY_PATH environment variables for users using the Homebrew package manager, which is the most common case. By making these variables conditional, we allow users of other package managers to specify their own environment variables here. ----------------------------------------------------------------------- Summary of changes: utils/dc-chain/scripts/gdb.mk | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/dc-chain/scripts/gdb.mk b/utils/dc-chain/scripts/gdb.mk index 30233338..595a16fd 100644 --- a/utils/dc-chain/scripts/gdb.mk +++ b/utils/dc-chain/scripts/gdb.mk @@ -26,13 +26,13 @@ build_gdb: $(stamp_gdb_build) ifeq ($(MACOS), 1) ifeq ($(uname_m),arm64) $(info Fixing up MacOS arm64 environment variables) - $(stamp_gdb_build): export CPATH := /opt/homebrew/include - $(stamp_gdb_build): export LIBRARY_PATH := /opt/homebrew/lib + $(stamp_gdb_build): export CPATH ?= /opt/homebrew/include + $(stamp_gdb_build): export LIBRARY_PATH ?= /opt/homebrew/lib endif ifeq ($(uname_m),x86_64) $(info Fixing up MacOS x86_64 environment variables) - $(stamp_gdb_build): export CPATH := /usr/local/include - $(stamp_gdb_build): export LIBRARY_PATH := /usr/local/lib + $(stamp_gdb_build): export CPATH ?= /usr/local/include + $(stamp_gdb_build): export LIBRARY_PATH ?= /usr/local/lib endif endif hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-06-24 01:07:09
|
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 3c2d96a8ce8d4b9622648ad78dfb82a4db5c233c (commit) from 1e95c1f3e843608ebd3f7045bd40e7be27d3a575 (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 3c2d96a8ce8d4b9622648ad78dfb82a4db5c233c Author: Shirobon <126...@us...> Date: Sun Jun 15 12:59:19 2025 +0900 Update to detect Apple Clang 17+ and fix zlib issue. New Apple Clang 17 in Xcode 16.3+ causes build issues with bundled in zlib in binutils/gcc, so detect compiler version and use system zlib if necessary. ----------------------------------------------------------------------- Summary of changes: utils/dc-chain/scripts/init.mk | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/utils/dc-chain/scripts/init.mk b/utils/dc-chain/scripts/init.mk index 0115ca7d..f5d71011 100644 --- a/utils/dc-chain/scripts/init.mk +++ b/utils/dc-chain/scripts/init.mk @@ -68,6 +68,18 @@ ifdef MACOS SH_CXX_FOR_TARGET += $(macos_extra_args) macos_gcc_configure_args = --with-sysroot --with-native-system-header=/usr/include macos_gdb_configure_args = --with-sysroot=$(sdkroot) + # Detect if CC is Apple Clang and get major version, skip if using gcc. + APPLE_CLANG_MAJOR := $(shell $(CC) --version 2>&1 | \ + grep -i "Apple clang" | cut -f 4 -d " " | cut -f 1 -d ".") + ifdef APPLE_CLANG_MAJOR + # When using Apple Clang 17 or above, use system zlib. + ifeq ($(shell [ "$(APPLE_CLANG_MAJOR)" -gt 16 ] && echo "yes"), yes) + $(info Apple clang $(APPLE_CLANG_MAJOR) detected, using system zlib) + macos_gcc_configure_args += --with-system-zlib + macos_gdb_configure_args += --with-system-zlib + binutils_extra_configure_args += --with-system-zlib + endif + endif endif endif hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: kosmirror <kos...@us...> - 2025-06-23 01:43:46
|
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 1e95c1f3e843608ebd3f7045bd40e7be27d3a575 (commit) from a3d0467bcb2659e44ce7cbeef6e900bb6f33cc62 (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 1e95c1f3e843608ebd3f7045bd40e7be27d3a575 Author: QuzarDC <qu...@co...> Date: Sun Jun 22 20:59:33 2025 -0400 arch/args.h: Add standard double-include protection and decls ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/include/arch/args.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/kernel/arch/dreamcast/include/arch/args.h b/kernel/arch/dreamcast/include/arch/args.h index 56f3ffe8..74b719af 100644 --- a/kernel/arch/dreamcast/include/arch/args.h +++ b/kernel/arch/dreamcast/include/arch/args.h @@ -14,6 +14,12 @@ \author Paul Cercueil */ +#ifndef __ARCH_ARGS_H +#define __ARCH_ARGS_H + +#include <kos/cdefs.h> +__BEGIN_DECLS + #ifdef __SH4_SINGLE_ONLY__ #define KOS_SH4_SINGLE_ONLY 1 #else @@ -46,3 +52,7 @@ * floating-point argument of a function (starting from n=0). */ #define KOS_FPARG(n) _KOS_FPARG(n, KOS_SH4_SINGLE_ONLY) + +__END_DECLS + +#endif /* __ARCH_ARGS_H */ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |