libElysianVMU 1.6.0
Full-featured, accurate, cross-platform library emulating the Dreamcast's Visual Memory Unit
Loading...
Searching...
No Matches
evmu_timers.h
Go to the documentation of this file.
1/*! \file
2 * \brief EvmuTimers: BaseTimer, Timer0, and Timer1 Peripherals
3 * \ingroup peripherals
4 *
5 * This header provides an API and implementation for the three
6 * different timing peripherals contained within the VMU:
7 * * Timer 0
8 * * Timer 1
9 * * Base Timer
10 *
11 * \author 2023 Falco Girgis
12 * \copyright MIT License
13 */
14
15#ifndef EVMU_TIMERS_H
16#define EVMU_TIMERS_H
17
18#include "../types/evmu_peripheral.h"
19
20/*! \name Type System
21 * \brief Type UUID and cast operators
22 * @{
23 */
24#define EVMU_TIMERS_TYPE (GBL_TYPEID(EvmuTimers)) //!< Type UUID for EvmuTimers
25#define EVMU_TIMERS(self) (GBL_CAST(EvmuTimers, self)) //!< Function-style cast for GblInstance
26#define EVMU_TIMERS_CLASS(klass) (GBL_CLASS_CAST(EvmuTimers, klass)) //!< Function-style cast for GblClass
27#define EVMU_TIMERS_GET_CLASS(self) (GBL_CLASSOF(EvmuTimers, self)) //!< Get EvmuTimersClass from GblInstance
28//! @}
29
30#define EVMU_TIMERS_NAME "timers" //!< EvmuTimers GblObject name
31
32#define GBL_SELF_TYPE EvmuTimers
33
34GBL_DECLS_BEGIN
35
36//! Configuration modes for Timer 0
37GBL_DECLARE_ENUM(EVMU_TIMER0_MODE) {
38 EVMU_TIMER0_MODE_TIMER8_TIMER8, //!< Timer8 mode 0, dual 8-bit timers
39 EVMU_TIMER0_MODE_TIMER8_COUNTER8,
40 EVMU_TIMER0_MODE_TIMER16,
41 EVMU_TIMER0_MODE_COUNTER16
42};
43
44//! Configuration modes for Timer 1
45GBL_DECLARE_ENUM(EVMU_TIMER1_MODE) {
46 EVMU_TIMER1_MODE_TIMER8_TIMER8,
47 EVMU_TIMER1_MODE_TIMER8_PULSE8,
48 EVMU_TIMER1_MODE_TIMER16,
49 EVMU_TIMER1_MODE_PULSEVAR
50};
51
52/*! \struct EvmuTimersClass
53 * \extends EvmuPeripheralClass
54 * \brief GblClass structure for EvmuTimers
55 *
56 * No public members.
57 *
58 * \todo timeout/reload/tick virtual method?
59 *
60 * \sa EvmuTimers
61 */
62GBL_CLASS_DERIVE_EMPTY(EvmuTimers, EvmuPeripheral)
63
64/*! \struct EvmuTimers
65 * \extends EvmuPeripheral
66 * \ingroup peripherals
67 * \brief GblInstance structure for EvmuTimers
68 *
69 * No public members.
70 *
71 * \sa EvmuTimersClass
72 */
73GBL_INSTANCE_DERIVE_EMPTY(EvmuTimers, EvmuPeripheral)
74
75//! \cond
76/*! \todo baseTimer, timer0, timer1 values
77 * \todo timers enable/disabled/active
78 */
79GBL_PROPERTIES(EvmuTimers,
80 (timer0Mode, GBL_GENERIC, (READ), GBL_ENUM_TYPE),
81 (timer1Mode, GBL_GENERIC, (READ), GBL_ENUM_TYPE)
82)
83//! \endcond
84
85EVMU_EXPORT GblType EvmuTimers_type (void) GBL_NOEXCEPT;
86
87EVMU_EXPORT EVMU_TIMER1_MODE EvmuTimers_timer1Mode (GBL_CSELF) GBL_NOEXCEPT;
88EVMU_EXPORT EVMU_TIMER0_MODE EvmuTimers_timer0Mode (GBL_CSELF) GBL_NOEXCEPT;
89EVMU_EXPORT void EvmuTimers_update (GBL_SELF) GBL_NOEXCEPT;
90
91GBL_DECLS_END
92
93#undef GBL_SELF_TYPE
94
95#endif // EVMU_TIMERS_H
#define EVMU_EXPORT
Define used for adding attributes to export public symbols.
Definition evmu_api.h:18
EVMU_TIMER0_MODE
Definition evmu_timers.h:37
@ EVMU_TIMER0_MODE_TIMER8_TIMER8
Timer8 mode 0, dual 8-bit timers.
Definition evmu_timers.h:38
#define GBL_ENUM_TYPE
#define GBL_PROPERTIES(object,...)
uintptr_t GblType
GblInstance structure for EvmuTimers.
Definition evmu_timers.h:73
#define GBL_CLASS_CAST(cType, klass)
#define GBL_CLASSOF(cType, self)
#define GBL_CAST(cType, self)