Instruction manual

Renesas USB MCU and USB ASSP USB Basic Host and Peripheral firmware
R01AN0512EJ0210 Rev.2.10 Page 27 of 157
Apr 1, 2013
control
Process a control code
Format
int32_t control (int16_t fileno, USB_CTRLCODE_t code, void *data)
Arguments
filneno File number
code Control code
data Pointer to data
Return Value
Error code
Description
This function performs according to the control code. If an unsupported control code is specified, the function sends
(-1) as the return value.
The following are control codes supported by control.
Control Code Description
USB_CTL_USBIP_NUM Gets the USB module number.
USB_CTL_RD_NOTIFY_SET
Registers the call-back function when the data receive is
completed by read(). Set the call-back function in the 3rd
argument.
USB_CTL_WR_NOTIFY_SET
Registers the call-back function when the data send is
completed by write(). Set the call-back function in the 3rd
argument.
USB_CTL_RD_LENGTH_GET
Gets the data length read from the FIFO buffer when data is
read.
USB_CTL_WR_LENGTH_GET
Gets the data length written to the FIFO buffer when data is
sent.
USB_CTL_GET_RD_STATE Gets the state when data is read.
USB_CTL_GET_WR_STATE Gets the state when data is sent.
USB_CTL_P_RD_TRANSFER_END Forcibly ends data reception in pipe specified in argument.
USB_CTL_P_WR_TRANSFER_END Forcibly ends data transmission in pipe specified in argument.
USB_CTL_P_CHG_DEVICE_STATE Changes USB device to state specified in argument.
USB_CTL_P_GET_DEVICE_INFO Gets state of connected USB device.
USB_CTL_P_RD_SET_STALL Sets STALL to PID of reading pipe.
USB_CTL_P_WR_SET_STALL Sets STALL to PID of writing pipe.