libsidplayfp 3.0.0
usbsid-emu.h
1
2#ifndef USBSID_EMU_H
3#define USBSID_EMU_H
4
5#include <cstdint>
6
7#include "sidplayfp/SidConfig.h"
8#include "sidemu.h"
9#include "Event.h"
10#include "EventScheduler.h"
11#include "sidplayfp/siddefs.h"
12#include "driver/src/USBSID.h"
13
14#include "sidcxx11.h"
15
16#ifdef HAVE_CONFIG_H
17# include "config.h"
18#endif
19
20namespace libsidplayfp
21{
22
23/***************************************************************************
24 * USBSID SID Specialisation
25 ***************************************************************************/
26class USBSID final : public sidemu, private Event//, public USBSIDBuilder
27{
28private:
29 /* USBSID specific data */
31 int m_handle;
32 int sidno;
33
34 uint8_t busValue; /* Return value on read */
35
36 SidConfig::sid_model_t runmodel; /* Read model type */
37
38 event_clock_t delay(); /* Event */
39
40public:
41 static const char* getCredits();
42
43public:
44 explicit USBSID(sidbuilder *builder);
45 ~USBSID() override;
46
47 /* static variables required due to
48 * multiple class initializations */
49 static long raster_rate;
50 static event_clock_t m_delayClk;
51
52 bool getStatus() const { return m_status; }
53
54 uint8_t read(uint_least8_t addr) override;
55 void write(uint_least8_t addr, uint8_t data) override;
56
57 /* c64sid functions */
58 void reset(uint8_t volume) override;
59
60 /* Standard SID functions */
61 void clock() override {};
62
63
64 void sampling(float systemclock, float freq,
65 SidConfig::sampling_method_t method) override;
66
67 void model(SidConfig::sid_model_t model, MAYBE_UNUSED bool digiboost) override;
68
69 /* USBSID specific */
70 void flush(void);
71
72 /* ISSUE: Disabled, blocks playing */
73 // Must lock the SID before using the standard functions.
74 // bool lock(EventScheduler *env) override;
75 // void unlock() override;
76
77private:
78 // Fixed interval timer delay to prevent sidplay2
79 // shoot to 100% CPU usage when song no longer
80 // writes to SID.
81 void event() override;
82};
83
84}
85
86#endif // USBSID_EMU_H
sid_model_t
SID chip model.
Definition SidConfig.h:44
sampling_method_t
Sampling method.
Definition SidConfig.h:77
Definition USBSID.h:298
Event(const char *const name)
Definition Event.h:58
virtual void event()=0
void clock() override
Definition usbsid-emu.h:61
Definition sidbuilder.h:41