mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +00:00
Kernel/USB: Adjust USB Pipe buffer
Allocate DMA buffer pages for use within the USBD Pipe class, and allow for the user to specify the size of this buffer, rounding up to the next page boundary.
This commit is contained in:
parent
f0420def78
commit
1304575190
Notes:
sideshowbarker
2024-07-17 07:16:27 +09:00
Author: https://github.com/b14ckcat
Commit: 1304575190
Pull-request: https://github.com/SerenityOS/serenity/pull/15631
Reviewed-by: https://github.com/Quaker762 ✅
2 changed files with 3 additions and 3 deletions
|
@ -12,9 +12,9 @@
|
|||
|
||||
namespace Kernel::USB {
|
||||
|
||||
ErrorOr<NonnullOwnPtr<Pipe>> Pipe::try_create_pipe(USBController const& controller, Type type, Direction direction, u8 endpoint_address, u16 max_packet_size, i8 device_address, u8 poll_interval)
|
||||
ErrorOr<NonnullOwnPtr<Pipe>> Pipe::try_create_pipe(USBController const& controller, Type type, Direction direction, u8 endpoint_address, u16 max_packet_size, i8 device_address, size_t buffer_size, u8 poll_interval)
|
||||
{
|
||||
auto dma_region = TRY(MM.allocate_kernel_region(PAGE_SIZE, "USB device DMA buffer"sv, Memory::Region::Access::ReadWrite));
|
||||
auto dma_region = TRY(MM.allocate_dma_buffer_pages(TRY(Memory::page_round_up(buffer_size)), "USB device DMA buffer"sv, Memory::Region::Access::ReadWrite));
|
||||
return adopt_nonnull_own_or_enomem(new (nothrow) Pipe(controller, type, direction, endpoint_address, max_packet_size, poll_interval, device_address, move(dma_region)));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue