@@ -43,14 +43,18 @@ class TestAction : public psyqo::CDRomDevice::Action<TestActionState> {
43
43
public:
44
44
TestAction () : Action(" TestAction" ) {}
45
45
46
- void start (psyqo::CDRomDevice *device, CDRomCommandBuffer commandBuffer, eastl::function<void (bool )> &&callback) {
46
+ void start (psyqo::CDRomDevice *device, const psyqo::Hardware::CDRom::CDRomCommandBuffer &commandBuffer,
47
+ eastl::function<void (bool )> &&callback) {
47
48
psyqo::Kernel::assert (device->isIdle (), " CDRomDevice::test() called while another action is in progress" );
48
49
registerMe (device);
49
50
setCallback (eastl::move (callback));
50
51
setState (TestActionState::TEST);
51
52
eastl::atomic_signal_fence (eastl::memory_order_release);
52
53
psyqo::Hardware::CDRom::Command.send (psyqo::Hardware::CDRom::CDL::TEST, commandBuffer);
53
54
}
55
+ void start (psyqo::CDRomDevice *device, eastl::function<void (bool )> &&callback) {
56
+ start (device, m_commandBuffer, eastl::move (callback));
57
+ }
54
58
bool complete (const psyqo::CDRomDevice::Response &) override {
55
59
setSuccess (true );
56
60
return true ;
@@ -59,23 +63,29 @@ class TestAction : public psyqo::CDRomDevice::Action<TestActionState> {
59
63
setSuccess (true );
60
64
return true ;
61
65
}
66
+
67
+ psyqo::Hardware::CDRom::CDRomCommandBuffer m_commandBuffer;
62
68
};
63
69
64
70
TestAction s_testAction;
65
71
66
72
} // namespace
67
73
68
- void psyqo::CDRomDevice::test (CDRomCommandBuffer commandBuffer, eastl::function<void (bool )> &&callback) {
74
+ void psyqo::CDRomDevice::test (const psyqo::Hardware::CDRom::CDRomCommandBuffer &commandBuffer,
75
+ eastl::function<void (bool )> &&callback) {
69
76
Kernel::assert (m_callback == nullptr , " CDRomDevice::test called with pending action" );
70
77
s_testAction.start (this , commandBuffer, eastl::move (callback));
71
78
}
72
79
73
- psyqo::TaskQueue::Task psyqo::CDRomDevice::scheduleTest (CDRomCommandBuffer commandBuffer) {
80
+ psyqo::TaskQueue::Task psyqo::CDRomDevice::scheduleTest (
81
+ const psyqo::Hardware::CDRom::CDRomCommandBuffer &commandBuffer) {
82
+ s_testAction.m_commandBuffer = commandBuffer;
83
+
74
84
return TaskQueue::Task (
75
- [this , commandBuffer ](auto task) { test (commandBuffer , [task](bool success) { task->complete (success); }); });
85
+ [this ](auto task) { s_testAction. start ( this , [task](bool success) { task->complete (success); }); });
76
86
}
77
87
78
- void psyqo::CDRomDevice::testBlocking (GPU &gpu, CDRomCommandBuffer commandBuffer) {
88
+ void psyqo::CDRomDevice::testBlocking (GPU &gpu, const psyqo::Hardware::CDRom:: CDRomCommandBuffer & commandBuffer) {
79
89
Kernel::assert (m_callback == nullptr , " CDRomDevice::testBlocking called with pending action" );
80
90
bool success = false ;
81
91
{
0 commit comments