diff options
Diffstat (limited to 'Kernel/Bus/USB/USBTransfer.h')
-rw-r--r-- | Kernel/Bus/USB/USBTransfer.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Kernel/Bus/USB/USBTransfer.h b/Kernel/Bus/USB/USBTransfer.h index 5923542d6c..c506650d9e 100644 --- a/Kernel/Bus/USB/USBTransfer.h +++ b/Kernel/Bus/USB/USBTransfer.h @@ -20,7 +20,7 @@ namespace Kernel::USB { class Transfer final : public AtomicRefCounted<Transfer> { public: - static ErrorOr<NonnullLockRefPtr<Transfer>> try_create(Pipe&, u16 length, Memory::Region& dma_buffer); + static ErrorOr<NonnullLockRefPtr<Transfer>> create(Pipe&, u16 length, Memory::Region& dma_buffer, USBAsyncCallback callback = nullptr); Transfer() = delete; ~Transfer(); @@ -41,14 +41,17 @@ public: bool complete() const { return m_complete; } bool error_occurred() const { return m_error_occurred; } + void invoke_async_callback(); + private: - Transfer(Pipe& pipe, u16 len, Memory::Region& dma_buffer); + Transfer(Pipe& pipe, u16 len, Memory::Region& dma_buffer, USBAsyncCallback callback); Pipe& m_pipe; // Pipe that initiated this transfer Memory::Region& m_dma_buffer; // DMA buffer USBRequestData m_request; // USB request u16 m_transfer_data_size { 0 }; // Size of the transfer's data stage bool m_complete { false }; // Has this transfer been completed? bool m_error_occurred { false }; // Did an error occur during this transfer? + USBAsyncCallback m_callback { nullptr }; }; } |