libElysianVMU 1.6.0
Full-featured, accurate, cross-platform library emulating the Dreamcast's Visual Memory Unit
Loading...
Searching...
No Matches
evmu_peripheral.h
Go to the documentation of this file.
1/*! \file
2 * \brief EvmuPeripheral base VMU component type
3 * \ingroup peripherals
4 *
5 * EvmuPeripheral and its APIs comprise the various hardware
6 * peripherals such as timers, serial ports. clocks, etc which
7 * are containe within the Sanyo Potato IC.
8 *
9 * \author 2023 Falco Girgis
10 * \copyright MIT License
11 */
12#ifndef EVMU_PERIPHERAL_H
13#define EVMU_PERIPHERAL_H
14
15#include "evmu_ibehavior.h"
16
17/*! \name Type System
18 * \brief Type UUID and cast operators
19 * @{
20 */
21#define EVMU_PERIPHERAL_TYPE (GBL_TYPEID(EvmuPeripheral)) //!< GblType UUID for EvmuPeripheral
22#define EVMU_PERIPHERAL(self) (GBL_CAST(EvmuPeripheral, self)) //!< Function-style GblInstance cast operator
23#define EVMU_PERIPHERAL_CLASS(klass) (GBL_CLASS_CAST(EvmuPeripheral, klass)) //!< Function-style GblClass cast operator
24#define EVMU_PERIPHERAL_GET_CLASS(self) (GBL_CLASSOF(EvmuPeripheral, self)) //!< Get an EvmuPeripheralClass from GblInstance
25//! @}
26
27/*! \defgroup peripherals Peripherals
28 * \brief Hardware subcomponents of the VMU's SoC
29 *
30 * An EvmuDevice is comprised of a collection of EvmuPeripherals
31 * which act as its individual hardware components. Each Peripheral
32 * inherits from the base type, EvmuPeripheral.
33 */
34
35#define GBL_SELF_TYPE EvmuPeripheral
36
37GBL_DECLS_BEGIN
38
39GBL_FORWARD_DECLARE_STRUCT(EvmuMemoryEvent);
40GBL_FORWARD_DECLARE_STRUCT(EvmuClockEvent);
41GBL_FORWARD_DECLARE_STRUCT(EvmuDevice);
42GBL_FORWARD_DECLARE_STRUCT(EvmuPeripheral);
43
44GBL_DECLARE_ENUM(EVMU_PERIPHERAL_LOG_LEVEL) {
45 EVMU_PERIPHERAL_LOG_LEVEL_ERROR,
46 EVMU_PERIPHERAL_LOG_LEVEL_WARNING,
47 EVMU_PERIPHERAL_LOG_LEVEL_VERBOSE,
48 EVMU_PERIPHERAL_LOG_LEVEL_DEBUG,
49 EVMU_PERIPHERAL_LOG_LEVEL_DISABLED
50};
51
52/*! \struct EvmuPeripheralClass
53 * \extends GblObjectClass
54 * \implements EvmuIBehaviorClass
55 * \brief GblClass structure for EvmuPeripherals
56 *
57 * GblClass/vtable structure containing virtual functions
58 * for EvmuPeripheral instances.
59 *
60 * \sa EvmuPeripheral
61 */
62GBL_CLASS_DERIVE(EvmuPeripheral, GblObject, EvmuIBehavior)
63 //! Called when an EvmuRamEvent has been fired
64 EVMU_RESULT (*pFnMemoryEvent)(GBL_SELF, EvmuMemoryEvent* pEvent);
65 //! Called when an EvmuClockEvent has been fired
66 EVMU_RESULT (*pFnClockEvent) (GBL_SELF, EvmuClockEvent* pEvent);
67GBL_CLASS_END
68
69/*! \struct EvmuPeripheral
70 * \ingroup peripherals
71 * \extends GblObject
72 * \implements EvmuIBehavior
73 * \brief Emulated hardware component of an EvmuDevice
74 *
75 * Base instance type of all emulated components of the
76 * Visual Memory Unit / Potato IC.
77 *
78 * \sa EvmuPeripheralClass
79 */
80GBL_INSTANCE_DERIVE(EvmuPeripheral, GblObject)
81 GblFlags logLevel; //!< Active log level filter for peripheral
82GBL_INSTANCE_END
83
84//! Returns the GblType UUID corresponding to the EvmuPeripheral type
86
87/*! \name Accessors
88 * \brief Methods for reading/writing state
89 * \relatesalso EvmuPeripheral
90 * @{
91 */
92//! Returns the EvmuDevice to which the given peripheral is attached to
93EVMU_EXPORT EvmuDevice* EvmuPeripheral_device (GBL_CSELF) GBL_NOEXCEPT;
94//! @}
95
96GBL_DECLS_END
97
98#undef GBL_SELF_TYPE
99
100#endif // EVMU_PERIPHERAL_H
#define EVMU_EXPORT
Define used for adding attributes to export public symbols.
Definition evmu_api.h:18
GblType EvmuPeripheral_type(void)
Returns the GblType UUID corresponding to the EvmuPeripheral type.
uint32_t GblFlags
uintptr_t GblType
Emulated hardware component of an EvmuDevice.
GblFlags logLevel
Active log level filter for peripheral.
EvmuDevice * EvmuPeripheral_device(const EvmuPeripheral *pSelf)
Returns the EvmuDevice to which the given peripheral is attached to.
#define GBL_CLASS_CAST(cType, klass)
#define GBL_CLASSOF(cType, self)
#define GBL_CAST(cType, self)