The transaction requires the following before it is started
An open pipe (see Chapter 4, Endpoints and Pipes) which specifies the direction and endpoint on the device.
A URB in which to contain the data to be sent or received. The URB used_size field indicates how much data is in the URB to be send for host to device transactions or the maximum size of data to be read from the device to the host.
A waiting structure to specify a waiting action upon transaction commencement. This structure is considered a template as it is never actually used by the transaction, it is merely a way of passing all the waiting parameters used in a single block.
A transaction is started using usb_request_start(USB_RequestStart (SWI&5538F)) passing the details as already outlined. It returns a pointer to a new waiting structure for the transaction, it does not modify the one passed in. There is also usb_request_start2(USBLib_RequestStart2 (SWI &56370)) which allows for a transaction timeout allowing the driver to take action if the device doesn't respond within a certain time.
A control transaction takes the form of a formatted structure whose contents are defined by the USB specification (see section 9.3 "USB Device Requests) on page 183 of the USB Specification 1.1). It may also have a second buffer to transfer data appropriate for the control transaction. The direction of data transfered is specified in the control transaction structure.
A control transaction may be sent by simple use of usblib_ctrl_msg(USBLib_CtrlMsg (SWI &5635E)). Using this library call reduces the driver writers work to perform control transactions to providing two URB of sufficient size.
The library call simply formats the data as required in the USB specification and starts a control transaction.
If the driver write wishes to perform the control transaction themselves they should note the following
A URB must be filled with the formated data and a call make to usb_request_start(USB_RequestStart (SWI&5538F))
Care should be taken with the order URBs are passed to the usb_request_start(USB_RequestStart (SWI&5538F)) call as the formatted structure is passed as the additional URB.
The transactions behaviour flags must contain the USB_TRANSACTION_STATUS_STAGE flag to indicate it is a control transaction.
If the control transaction is not transferring any additional data they it may either pass NULL for the data URB or a URB with zero indicated length.
Example 5.1, “Use of URBs with a control transaction” shows in more detain how to perform a control transaction.