mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 15:37:46 +00:00
Kernel/USB: Add support for async & interrupt transfers
Add support for async transfers by using a separate kernel task to poll a list of active async transfers on a set time interval, and invoke their user-provided callback function when they are complete. Also add support for the interrupt class of transfers, building off of this async functionality.
This commit is contained in:
parent
1aa16b4dd4
commit
7400eb3640
8 changed files with 181 additions and 62 deletions
|
@ -18,6 +18,8 @@ namespace Kernel::USB {
|
|||
class USBController;
|
||||
class Transfer;
|
||||
|
||||
using USBAsyncCallback = Function<void(Transfer* transfer)>;
|
||||
|
||||
//
|
||||
// A pipe is the logical connection between a memory buffer on the PC (host) and
|
||||
// an endpoint on the device. In this implementation, the data buffer the pipe connects
|
||||
|
@ -111,6 +113,8 @@ class InterruptInPipe : public Pipe {
|
|||
public:
|
||||
static ErrorOr<NonnullOwnPtr<InterruptInPipe>> create(USBController const& controller, u8 endpoint_address, u16 max_packet_size, i8 device_address, u16 poll_interval, size_t buffer_size = PAGE_SIZE);
|
||||
|
||||
ErrorOr<NonnullLockRefPtr<Transfer>> interrupt_in_transfer(size_t length, u16 ms_interval, USBAsyncCallback callback);
|
||||
|
||||
u16 poll_interval() const { return m_poll_interval; }
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue