template <typename PhysIterType>

class FidlRequest

Defined at line 66 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

FidlRequest is a wrapper around a fuchsia_hardware_usb_request::Request implementing common

functionality. Especially, FidlRequest keeps track of VMOs that were pinned upon PhysMap() and

unpins them upon destruction.

Public Methods

void FidlRequest<PhysIterType> ()

Defined at line 71 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

void FidlRequest<PhysIterType> (EndpointType ep_type)

Defined at line 72 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

void FidlRequest<PhysIterType> (fuchsia_hardware_usb_request::Request request)

Defined at line 90 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

void FidlRequest<PhysIterType> (FidlRequest<PhysIterType> && request)

Disallow copy and assign, allow move.

Defined at line 94 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

FidlRequest<PhysIterType> & operator= (FidlRequest<PhysIterType> && request)

Defined at line 95 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

void FidlRequest<PhysIterType> (const FidlRequest<PhysIterType> & )

Defined at line 96 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

FidlRequest<PhysIterType> & operator= (const FidlRequest<PhysIterType> & )

Defined at line 97 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

void ~FidlRequest<PhysIterType> ()

Defined at line 99 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

FidlRequest<PhysIterType> & set_control (fuchsia_hardware_usb_descriptor::UsbSetup setup)

Defined at line 101 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

FidlRequest<PhysIterType> & set_bulk ()

Defined at line 106 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

FidlRequest<PhysIterType> & set_isochronous (uint64_t frame_id)

Defined at line 111 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

FidlRequest<PhysIterType> & set_interrupt ()

Defined at line 116 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

FidlRequest<PhysIterType> & add_vmo_id (uint64_t vmo_id, size_t size, size_t offset)

Defined at line 122 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

FidlRequest<PhysIterType> & add_data (std::vector<uint8_t> data, size_t size, size_t offset)

Defined at line 134 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

FidlRequest<PhysIterType> & clear_buffers ()

Defined at line 146 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

FidlRequest<PhysIterType> & reset_buffers (const get_mapped_func_t & GetMapped)

Defined at line 156 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

std::vector<size_t> CopyTo (size_t offset, const void * buffer, size_t size, const get_mapped_func_t & GetMapped)

CopyTo: tries to copy `size` bytes from `buffer` to contiguous `request` buffers from

`offset`. Returns the number of bytes copied for each buffer.

Defined at line 177 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

std::vector<size_t> CopyFrom (size_t offset, void * buffer, size_t size, const get_mapped_func_t & GetMapped)

CopyFrom: tries to copy `size` bytes from `request` (starting from `offset`) to `buffer`.

Returns the number of bytes copied for each buffer.

Defined at line 228 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

zx_status_t CacheFlushInvalidate (get_mapped_func_t GetMapped)

About CacheFlush and CacheFlushInvalidate: CacheFlush or CacheFlush invalidate MUST always be

called after data is written to the VMO and before the data is processed on schedule (see

comment in endpoint.fidl on `RequestQueue`).

CacheFlush should be called for operations where data is to be written out, but not read in

and CacheFlushInvalidate should be called for operations where data needs to be read in.

CacheFlush and CacheFlushInvalidate flush and invalidate cache for all buffer regions of a

request.

Defined at line 279 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

zx_status_t CacheFlush (get_mapped_func_t GetMapped)

Defined at line 291 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

zx_status_t CacheHelper (const fuchsia_hardware_usb_request::BufferRegion & buffer, uint32_t options, const get_mapped_func_t & GetMapped)

CacheHelper flushes and invaldiates cache for specified buffer region.

Defined at line 304 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

zx_status_t PhysMap (const zx::bti & bti)

Pins VMOs if needed. For

- fuchsia_hardware_usb_request::Buffer::Tag::kVmoId -- Uses preregistered VMO. Does nothing.

- fuchsia_hardware_usb_request::Buffer::Tag::kVmo -- Pins VMO.

- fuchsia_hardware_usb_request::Buffer::Tag::kData -- Creates, maps, pins, VMO. Copies data

to VMO. (Unmapped and unpinned on

Unpin()).

Defined at line 327 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

zx_status_t Unpin ()

Unpins VMOs pinned by PhysMap.

Defined at line 398 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

fuchsia_hardware_usb_request::Request * operator-> ()

Defined at line 424 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

const fuchsia_hardware_usb_request::Request * operator-> ()

Defined at line 425 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

PhysIterType phys_iter (size_t idx, size_t max_length)

Gets a PhysIterType for the buffer at request.data()->at(idx). PhysIterTypes return a

std::pair

<zx

_paddr_t, size_t> on iteration. For template specialization, see the public

headers outside the internal namespace.

const fuchsia_hardware_usb_request::Request & request ()

Defined at line 426 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

fuchsia_hardware_usb_request::Request take_request ()

Ensures any removal of `request` is intentional and `Unpin` is called.

Defined at line 428 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h

size_t length ()

Returns the total length of all data in the request. Saves to a variable for future use.

Defined at line 433 of file ../../src/devices/usb/lib/usb/include/usb/internal/request-fidl.h