|
From: kosmirror <kos...@us...> - 2025-08-27 05:42:57
|
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 b2f9efc31f65b43f52d9db9d474685f386beef2e (commit)
via 0441dbb88d2e4ab7ce2de62fc276a214375ea1ac (commit)
from 7bd48056e76e750d1c90e0cc4aeb156f46da31f8 (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 b2f9efc31f65b43f52d9db9d474685f386beef2e
Author: darc <da...@pr...>
Date: Tue Aug 26 14:28:07 2025 -0500
Update examples to use new dc/wdt.h header
commit 0441dbb88d2e4ab7ce2de62fc276a214375ea1ac
Author: darc <da...@pr...>
Date: Tue Aug 26 14:23:53 2025 -0500
Move Dreamcast wdt driver from arch/ to dc/
-----------------------------------------------------------------------
Summary of changes:
.../dreamcast/basic/threading/barrier/barrier.c | 4 +-
examples/dreamcast/cpp/concurrency/concurrency.cpp | 2 +-
kernel/arch/dreamcast/hardware/Makefile | 2 +-
kernel/arch/dreamcast/{kernel => hardware}/wdt.c | 2 +-
kernel/arch/dreamcast/include/arch/kos.h | 2 +-
kernel/arch/dreamcast/include/arch/rtc.h | 2 +-
kernel/arch/dreamcast/include/arch/timer.h | 2 +-
kernel/arch/dreamcast/include/arch/wdt.h | 194 +--------------------
kernel/arch/dreamcast/include/{arch => dc}/wdt.h | 10 +-
kernel/arch/dreamcast/kernel/Makefile | 2 +-
kernel/arch/dreamcast/kernel/init.c | 2 +-
11 files changed, 18 insertions(+), 206 deletions(-)
rename kernel/arch/dreamcast/{kernel => hardware}/wdt.c (99%)
copy kernel/arch/dreamcast/include/{arch => dc}/wdt.h (97%)
diff --git a/examples/dreamcast/basic/threading/barrier/barrier.c b/examples/dreamcast/basic/threading/barrier/barrier.c
index 51b1de2a..2eb4d979 100644
--- a/examples/dreamcast/basic/threading/barrier/barrier.c
+++ b/examples/dreamcast/basic/threading/barrier/barrier.c
@@ -17,7 +17,7 @@
#include <kos/thread.h>
#include <kos/barrier.h>
-#include <arch/wdt.h>
+#include <dc/wdt.h>
#include <stdlib.h>
#include <stdint.h>
@@ -193,4 +193,4 @@ int main(int argc, char* argv[]) {
fprintf(stderr, "\nXXXXX TEST COMPLETE: FAILURE XXXXX\n\n");
return EXIT_FAILURE;
}
-}
\ No newline at end of file
+}
diff --git a/examples/dreamcast/cpp/concurrency/concurrency.cpp b/examples/dreamcast/cpp/concurrency/concurrency.cpp
index 594663cf..e77abf08 100644
--- a/examples/dreamcast/cpp/concurrency/concurrency.cpp
+++ b/examples/dreamcast/cpp/concurrency/concurrency.cpp
@@ -61,7 +61,7 @@
#include <exception>
#include <string>
-#include <arch/wdt.h>
+#include <dc/wdt.h>
// 20 seconds in us
inline constexpr unsigned WATCHDOG_TIMEOUT = (20 * 1000 * 1000);
diff --git a/kernel/arch/dreamcast/hardware/Makefile b/kernel/arch/dreamcast/hardware/Makefile
index 3b78ca9e..6038e310 100644
--- a/kernel/arch/dreamcast/hardware/Makefile
+++ b/kernel/arch/dreamcast/hardware/Makefile
@@ -28,7 +28,7 @@ OBJS += asic.o g2bus.o
OBJS += video.o vblank.o
# CPU-related
-OBJS += sq.o sq_fast_cpy.o scif.o sci.o ubc.o dmac.o
+OBJS += sq.o sq_fast_cpy.o scif.o sci.o ubc.o dmac.o wdt.o
# SPI device support
OBJS += scif-spi.o sd.o
diff --git a/kernel/arch/dreamcast/kernel/wdt.c b/kernel/arch/dreamcast/hardware/wdt.c
similarity index 99%
rename from kernel/arch/dreamcast/kernel/wdt.c
rename to kernel/arch/dreamcast/hardware/wdt.c
index 227e5768..59e0d9f6 100644
--- a/kernel/arch/dreamcast/kernel/wdt.c
+++ b/kernel/arch/dreamcast/hardware/wdt.c
@@ -6,9 +6,9 @@
/* This file contains the implementation of the SH4 watchdog timer driver. */
-#include <arch/wdt.h>
#include <arch/irq.h>
#include <kos/regfield.h>
+#include <dc/wdt.h>
/* Macros for accessing WDT registers */
#define WDT(o, t) (*((volatile t *)(WDT_BASE + (o))))
diff --git a/kernel/arch/dreamcast/include/arch/kos.h b/kernel/arch/dreamcast/include/arch/kos.h
index 27056363..964cb752 100644
--- a/kernel/arch/dreamcast/include/arch/kos.h
+++ b/kernel/arch/dreamcast/include/arch/kos.h
@@ -25,7 +25,6 @@ __BEGIN_DECLS
#include <arch/gdb.h>
#include <arch/mmu.h>
#include <arch/memory.h>
-#include <arch/wdt.h>
#include <dc/asic.h>
#include <dc/biosfont.h>
@@ -68,6 +67,7 @@ __BEGIN_DECLS
#include <dc/vmu_fb.h>
#include <dc/vmu_pkg.h>
#include <dc/vmufs.h>
+#include <dc/wdt.h>
__END_DECLS
diff --git a/kernel/arch/dreamcast/include/arch/rtc.h b/kernel/arch/dreamcast/include/arch/rtc.h
index 43181072..d60deb67 100644
--- a/kernel/arch/dreamcast/include/arch/rtc.h
+++ b/kernel/arch/dreamcast/include/arch/rtc.h
@@ -15,7 +15,7 @@
standard C functions, like time(), rather than these when simply needing
to fetch the current system time.
- \sa arch/wdt.h
+ \sa dc/wdt.h
\author Megan Potter
\author Falco Girgis
diff --git a/kernel/arch/dreamcast/include/arch/timer.h b/kernel/arch/dreamcast/include/arch/timer.h
index f12572c1..caf1290c 100644
--- a/kernel/arch/dreamcast/include/arch/timer.h
+++ b/kernel/arch/dreamcast/include/arch/timer.h
@@ -18,7 +18,7 @@
the gettime functions.
\sa arch/rtc.h
- \sa arch/wdt.h
+ \sa dc/wdt.h
\author Megan Potter
\author Falco Girgis
diff --git a/kernel/arch/dreamcast/include/arch/wdt.h b/kernel/arch/dreamcast/include/arch/wdt.h
index ece78b4b..b4dc7587 100644
--- a/kernel/arch/dreamcast/include/arch/wdt.h
+++ b/kernel/arch/dreamcast/include/arch/wdt.h
@@ -1,197 +1,9 @@
/* KallistiOS ##version##
- arch/dreamcast/include/wdt.h
- Copyright (C) 2023 Falco Girgis
+ kernel/arch/dreamcast/include/arch/wdt.h
*/
-/** \file arch/wdt.h
- \brief Watchdog Timer API
- \ingroup wdt
+#include <dc/wdt.h>
- This file provides an API for configuring and utilizing the SH4's watchdog
- timer as either a reset or an interval timer.
-
- \sa arch/timer.h
- \sa arch/rtc.h
-
- \author Falco Girgis
-*/
-
-#ifndef __ARCH_WDT_H
-#define __ARCH_WDT_H
-
-#include <kos/cdefs.h>
-__BEGIN_DECLS
-
-#include <stdint.h>
-
-/** \defgroup wdt Watchdog Timer
- \brief Driver for using the WDT as a reset or interval timer
- \ingroup timing
-
- The watchdog timer (WDT) is a special-purpose timer peripheral integrated
- within the Dreamcast's SH4 CPU.
-
- \warning
- At this time, there are no known emulators which are emulating the WDT,
- as it was never used in commercial games; however, it works perfectly fine
- on real hardware.
-
- There are two different modes of operation which are supported:
- - watchdog mode: counter overflow causes a reset interrupt
- - interval timer mode: counter overflow invokes a callback function
-
- To start the WDT in watchdog mode, use wdt_enable_watchdog(). To use the
- WDT as a general-purpose interval timer, use wdt_enable_timer().
-
- The timer can be stopped in either mode by calling wdt_disable().
-
- \sa rtc
-*/
-
-/** \brief Clock divider settings
- \ingroup wdt
-
- Denominators used to set the frequency divider
- for the input clock to the WDT.
- */
-typedef enum WDT_CLK_DIV {
- WDT_CLK_DIV_32, /**< \brief Period: 41us */
- WDT_CLK_DIV_64, /**< \brief Period: 82us */
- WDT_CLK_DIV_128, /**< \brief Period: 164us */
- WDT_CLK_DIV_256, /**< \brief Period: 328us */
- WDT_CLK_DIV_512, /**< \brief Period: 656us */
- WDT_CLK_DIV_1024, /**< \brief Period: 1.31ms */
- WDT_CLK_DIV_2048, /**< \brief Period: 2.62ms */
- WDT_CLK_DIV_4096 /**< \brief Period: 5.25ms */
-} WDT_CLK_DIV;
-
-/** \brief Reset signal type
- \ingroup wdt
-
- Specifies the kind of reset to be performed when the WDT
- overflows in watchdog mode.
-*/
-typedef enum WDT_RST {
- WDT_RST_POWER_ON, /**< \brief Power-On Reset */
- WDT_RST_MANUAL /**< \brief Manual Reset */
-} WDT_RST;
-
-/* \brief WDT interval timer callback function type
- \ingroup wdt
-
- Type of the callback function to be passed to wdt_enable_timer().
-*/
-typedef void (*wdt_callback)(void *user_data);
-
-/** \brief Enables the WDT as an interval timer
- \ingroup wdt
-
- Stops the WDT if it was previously running and reconfigures it
- to be used as a generic interval timer, calling the given callback
- periodically at the requested interval (or as close to it as possible
- without calling it prematurely).
-
- \note
- The internal resolution for each tick of the WDT in this mode is
- 41us, meaning a requested \p microsec_period of 100us will result
- in an actual callback interval of 123us.
-
- \warning
- \p callback is invoked within an interrupt context, meaning that
- special care should be taken to not perform any logic requiring
- additional interrupts. Data that is accessed from both within
- and outside of the callback should be atomic or protected by a
- lock.
-
- \param initial_count Initial value of the WDT counter (Normally 0).
- \param microsec_period Timer callback interval in microseconds
- \param irq_prio Priority for the interval timer IRQ (1-15)
- \param callback User function to invoke periodically
- \param user_data Arbitrary user-provided data for the callback
-
- \sa wdt_disable()
-*/
-void wdt_enable_timer(uint8_t initial_count,
- uint32_t microsec_period,
- uint8_t irq_prio,
- wdt_callback callback,
- void *user_data);
-
-/** \brief Enables the WDT in watchdog mode
- \ingroup wdt
-
- Stops the WDT if it was previously running and reconfigures it
- to be used as a typical watchdog timer, generating a reset
- interrupt upon counter overflow. To prevent this from happening,
- the user should be periodically resetting the counter.
-
- \note
- Keep in mind the speed of the WDT. With a range of 41us to 5.2ms,
- the WDT will overflow before a single frame in a typical game.
-
- \param initial_count Initial value of the WDT counter (Normally 0)
- \param clk_config Clock divider to set watchdog period
- \param reset_select The type of reset generated upon overflow
-
- \sa wdt_disable()
-*/
-void wdt_enable_watchdog(uint8_t initial_count,
- WDT_CLK_DIV clk_config,
- WDT_RST reset_select);
-
-/** \brief Fetches the counter value
- \ingroup wdt
-
- Returns the current 8-bit value of the WDT counter.
-
- \return Current counter value
-
- \sa wdt_set_counter()
-*/
-uint8_t wdt_get_counter(void);
-
-/** \brief Sets the counter value
- \ingroup wdt
-
- Sets the current 8-bit value of the WDT counter.
-
- \param value New value for the counter
-
- \sa wdt_get_counter(), wdt_pet()
-*/
-void wdt_set_counter(uint8_t value);
-
-/** \brief Resets the counter value
- \ingroup wdt
-
- "Petting" or "kicking" the WDT is the same thing as
- resetting its counter value to 0.
-
- \sa wdt_set_counter()
-*/
-void wdt_pet(void);
-
-/** \brief Disables the WDT
- \ingroup wdt
-
- Disables the WDT if it was previously enabled,
- otherwise does nothing.
-
- \sa wdt_enable_timer(), wdt_enable_watchdog()
-*/
-void wdt_disable(void);
-
-/** \brief Returns whether the WDT is enabled
- \ingroup wdt
-
- Checks to see whether the WDT has been enabled.
-
- \return 1 if enabled, 0 if disabled
-*/
-int wdt_is_enabled(void);
-
-__END_DECLS
-
-#endif /* __ARCH_WDT_H */
+#warning "The `<arch/wdt.h>` header has been moved to `<dc/wdt.h>`."
diff --git a/kernel/arch/dreamcast/include/arch/wdt.h b/kernel/arch/dreamcast/include/dc/wdt.h
similarity index 97%
copy from kernel/arch/dreamcast/include/arch/wdt.h
copy to kernel/arch/dreamcast/include/dc/wdt.h
index ece78b4b..00afbc64 100644
--- a/kernel/arch/dreamcast/include/arch/wdt.h
+++ b/kernel/arch/dreamcast/include/dc/wdt.h
@@ -1,11 +1,11 @@
/* KallistiOS ##version##
- arch/dreamcast/include/wdt.h
+ kernel/arch/dreamcast/include/dc/wdt.h
Copyright (C) 2023 Falco Girgis
*/
-/** \file arch/wdt.h
+/** \file dc/wdt.h
\brief Watchdog Timer API
\ingroup wdt
@@ -18,8 +18,8 @@
\author Falco Girgis
*/
-#ifndef __ARCH_WDT_H
-#define __ARCH_WDT_H
+#ifndef __DC_WDT_H
+#define __DC_WDT_H
#include <kos/cdefs.h>
__BEGIN_DECLS
@@ -194,4 +194,4 @@ int wdt_is_enabled(void);
__END_DECLS
-#endif /* __ARCH_WDT_H */
+#endif /* __DC_WDT_H */
diff --git a/kernel/arch/dreamcast/kernel/Makefile b/kernel/arch/dreamcast/kernel/Makefile
index f3dabe6c..d6c3da9f 100644
--- a/kernel/arch/dreamcast/kernel/Makefile
+++ b/kernel/arch/dreamcast/kernel/Makefile
@@ -10,7 +10,7 @@
# that minimum set must be present.
COPYOBJS = banner.o cache.o entry.o irq.o init.o mm.o panic.o
-COPYOBJS += rtc.o timer.o wdt.o perfctr.o perf_monitor.o
+COPYOBJS += rtc.o timer.o perfctr.o perf_monitor.o
COPYOBJS += init_flags_default.o
COPYOBJS += mmu.o itlb.o
COPYOBJS += exec.o execasm.o stack.o gdb_stub.o thdswitch.o tls_static.o arch_exports.o
diff --git a/kernel/arch/dreamcast/kernel/init.c b/kernel/arch/dreamcast/kernel/init.c
index 9ad3b7e9..4c05733f 100644
--- a/kernel/arch/dreamcast/kernel/init.c
+++ b/kernel/arch/dreamcast/kernel/init.c
@@ -19,12 +19,12 @@
#include <arch/memory.h>
#include <arch/rtc.h>
#include <arch/timer.h>
-#include <arch/wdt.h>
#include <dc/perfctr.h>
#include <dc/ubc.h>
#include <dc/pvr.h>
#include <dc/vmufs.h>
#include <dc/syscalls.h>
+#include <dc/wdt.h>
#include "initall_hdrs.h"
hooks/post-receive
--
A pseudo Operating System for the Dreamcast.
|