Instruction manual

Renesas USB MCU and USB ASSP USB Basic Host and Peripheral firmware
R01AN0512EJ0210 Rev.2.10 Page 109 of 157
Apr 1, 2013
5.4 Host call-back functions
5.4.1 HCD call-backs
Call-backs are used so that the user does not need to poll for events. The user application registers a callback in order to
be alerted when, for example, requests made to HCD are completed, and data is has been transferred over USB to the
peripheral. By using call-backs the application is propelled forward by the USB USB-BASIC-F/W stack.
Each table below is named after the function registering the call-back, and the table content explains the nature of the
“called-back” function.
Table 5.3 R_usb_hstd_TransferStart call-back
Name Data Transfer Request call-back function
Call format (*USB_CB_INFO_t)(USB_UTR_t*);
Arguments USB_UTR_t* USB_UTR_t pointer of argument of R_usb_hstd_TransferStart
Return values
Description
This function is executed at the end of a data transfer. This should occur when the number
of bytes specified by the TransferStart function are transmitted, or when a short packet is
received. Transmit/receive data length and the error count are updated. Check the result of
data communications.
Notes
Table 5.4 R_usb_hstd_ChangeDeviceState(USB_MSG_HCD_USBRESET) call-back
Name USB Bus Reset call-back function
Call format (*USB_CB_INFO_t)(USB_UTR_t*, uint16_t, uint16_t)
USB_UTR_t * Pointer to a USB Transfer Structure
uint16_t
USB_NOCONNECT: Not connected
USB_HSCONNECT: Hi-speed device
USB_FSCONNECT: Full-speed device
USB_LSCONNECT: Low-speed device
Arguments
uint16_t NOARGUMENT: Not used
Return values
Description This function is executed at the end of USB bus reset processing.
The communication speed of the connected device is returned as an argument to the call-
back.
The response is “not connected” if disconnection is detected during USB bus reset
processing or if the speed is undefined.
Notes