Instruction manual
Renesas USB MCU and USB ASSP USB Basic Host and Peripheral firmware
R01AN0512EJ0210 Rev.2.10 Page 23 of 157
Apr 1, 2013
read
USB receive
Format
int32_t read (int16_t fileno, uint8_t *buf, int32_t count)
Arguments
fileno File number
*buf Pointer to data buffer
count Data transfer size
Return Value
- Error code
Description
This function executes a data receive request for the USB device class specified in the file number.
Data is read from the FIFO buffer of the specified data transfer size (3rd argument), and then stored in the data
buffer (2nd argument).
When the receive process is complete, the call-back function is called. This call-back function is registered by the
Control API. Please refer to control code USB_CTL_RD_NOTIFY_SET in the Control API.
The actual read size can be obtained by using control API after the receive process is complete. Please refer to
control code USB_CTL_RD_LENGTH_GET in the Control API.
Note
1. Call this function from the user application. See “
4.2.2 General operation using ANSI API” for more
explanation on how to use this function from the context of a user application.
2. After the file number is received, USB device class communication using this function can be performed.
The file number is obtained by using the Open API.
3. Use the Control API to register the call-back function for notification of data transfer completion before calling
this function.
4. This function only executes a data receive request and does not block any processes. Therefore the return value
is always (-1).