USB services: Difference between revisions
Line 690: | Line 690: | ||
The buffer contains an array of [[#XferReport]]. | The buffer contains an array of [[#XferReport]]. | ||
On newer sysvers this runs code which is the same as the user-process code handling the tmem from [[#ShareReportRing]]. This cmd can handle getting reports from that tmem as well, however normally user-processes would just access the tmem [[#ShareReportRing|directly]]. | |||
==== BatchBufferAsync ==== | ==== BatchBufferAsync ==== | ||
Line 702: | Line 704: | ||
Takes an input u64 '''buffer''' and an u64 '''size''', no output. | Takes an input u64 '''buffer''' and an u64 '''size''', no output. | ||
This validates that both input params are page-aligned. | |||
This maps the specified buffer as devicemem and stores the fields for this in object state. If this was already used with this IClientEpSession object, an error is thrown. | |||
==== ShareReportRing ==== | ==== ShareReportRing ==== | ||
Takes an input u32 '''size''' and an input TransferMemory handle, no output. | Takes an input u32 '''size''' and an input TransferMemory handle, no output. | ||
Official user-processes create the TransferMemory with permissions=RW. | Official user-processes create the TransferMemory with permissions=RW. This validates that the input size is page-aligned, and this is also validated against data from state. Official user-processes also do this same validation. | ||
When this was used, official user-processes read data from this TransferMemory buffer instead of using [[#GetXferReport]]. | When this was used, official user-processes read data from this TransferMemory buffer instead of using [[#GetXferReport]]. | ||
This maps a TransferMemory buffer which is used for the [[#XferReport]] Ring, replacing the heap Ring buffer which was setup during [[#PopulateRing]]. | |||
Structure of the tmem: | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset || Size || Description | |||
|- | |||
| 0x0 || 0x8 || Write index | |||
|- | |||
| 0x8 || 0x8 || Read index | |||
|- | |||
| 0x10 || 0x18*count || Array of [[#XferReport]] | |||
|} | |||
write_index!=read_index indicates that report data is available. The index fields are updated with: <code>index = index+1 % count;</code> write_index is updated by sysmodule, read_index is updated by the user-process. If the index field being used is >=count, this will Abort. | |||
= usb:pd = | = usb:pd = |