Instruction manual
Renesas USB MCU and USB ASSP USB Basic Host and Peripheral firmware
R01AN0512EJ0210 Rev.2.10 Page 78 of 157
Apr 1, 2013
control
Process according to control code
Format
int16_t control(int16_t fileno, USB_CTRLCODE_t code, void *data)
Argument
fileno File number
code Control Code
*data Pointer to data
Return Value
- Error code
Description
This function performs processes 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 function to be called back when
the data receive is completed. Set the call-back
function in the 3rd argument.
USB_CTL_WR_NOTIFY_SET
Registers the function to be called back when
the data send is completed. 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_H_RD_TRANSFER_END
Forcibly ends data transfer in pipe specified in
argument.
USB_CTL_H_WR_TRANSFER_END
Forcibly ends data transfer in pipe specified in
argument.
USB_CTL_H_CHG_DEVICE_STATE Changes state of connected USB device.
USB_CTL_H_GET_DEVICE_INFO Gets state of connected USB device.
Note
Call this function from the user application.