|
fsp_err_t | R_USB_Open (usb_ctrl_t *const p_ctrl, usb_cfg_t const *const p_cfg) |
| Applies power to the USB module specified in the argument (p_ctrl). More...
|
|
fsp_err_t | R_USB_Close (usb_ctrl_t *const p_ctrl) |
| Terminates power to the USB module specified in argument (p_ctrl). USB0 module stops when USB_IP0 is specified to the member (module), USB1 module stops when USB_IP1 is specified to the member (module). More...
|
|
fsp_err_t | R_USB_Read (usb_ctrl_t *const p_ctrl, uint8_t *p_buf, uint32_t size, uint8_t destination) |
| Bulk/interrupt data transfer and control data transfer. More...
|
|
fsp_err_t | R_USB_Write (usb_ctrl_t *const p_ctrl, uint8_t const *const p_buf, uint32_t size, uint8_t destination) |
| Bulk/Interrupt data transfer and control data transfer. More...
|
|
fsp_err_t | R_USB_Stop (usb_ctrl_t *const p_ctrl, usb_transfer_t direction, uint8_t destination) |
| Requests a data read/write transfer be terminated when a data read/write transfer is being performed. More...
|
|
fsp_err_t | R_USB_Suspend (usb_ctrl_t *const p_ctrl) |
| Sends a SUSPEND signal from the USB module assigned to the member (module) of the usb_crtl_t structure. More...
|
|
fsp_err_t | R_USB_Resume (usb_ctrl_t *const p_ctrl) |
| Sends a RESUME signal from the USB module assigned to the member (module) of the usb_ctrl_tstructure. More...
|
|
fsp_err_t | R_USB_VbusSet (usb_ctrl_t *const p_ctrl, uint16_t state) |
| Specifies starting or stopping the VBUS supply. More...
|
|
fsp_err_t | R_USB_InfoGet (usb_ctrl_t *const p_ctrl, usb_info_t *p_info, uint8_t destination) |
| Obtains completed USB-related events. More...
|
|
fsp_err_t | R_USB_PipeRead (usb_ctrl_t *const p_ctrl, uint8_t *p_buf, uint32_t size, uint8_t pipe_number) |
| Requests a data read (bulk/interrupt transfer) via the pipe specified in the argument. More...
|
|
fsp_err_t | R_USB_PipeWrite (usb_ctrl_t *const p_ctrl, uint8_t *p_buf, uint32_t size, uint8_t pipe_number) |
| Requests a data write (bulk/interrupt transfer). More...
|
|
fsp_err_t | R_USB_PipeStop (usb_ctrl_t *const p_ctrl, uint8_t pipe_number) |
| Terminates a data read/write operation. More...
|
|
fsp_err_t | R_USB_UsedPipesGet (usb_ctrl_t *const p_ctrl, uint16_t *p_pipe, uint8_t destination) |
| Gets the selected pipe number (number of the pipe that has completed initalization) via bit map information. More...
|
|
fsp_err_t | R_USB_PipeInfoGet (usb_ctrl_t *const p_ctrl, usb_pipe_t *p_info, uint8_t pipe_number) |
| Gets the following pipe information regarding the pipe specified in the argument (p_ctrl) member (pipe): endpoint number, transfer type, transfer direction and maximum packet size. More...
|
|
fsp_err_t | R_USB_PullUp (usb_ctrl_t *const p_ctrl, uint8_t state) |
| This API enables or disables pull-up of D+/D- line. More...
|
|
fsp_err_t | R_USB_EventGet (usb_ctrl_t *const p_ctrl, usb_status_t *event) |
| Obtains completed USB related events. (OS-less Only) More...
|
|
fsp_err_t | R_USB_Callback (usb_callback_t *p_callback) |
| Register a callback function to be called upon completion of a USB related event. (RTOS only) More...
|
|
fsp_err_t | R_USB_HostControlTransfer (usb_ctrl_t *const p_ctrl, usb_setup_t *p_setup, uint8_t *p_buf, uint8_t device_address) |
| Performs settings and transmission processing when transmitting a setup packet. More...
|
|
fsp_err_t | R_USB_PeriControlDataGet (usb_ctrl_t *const p_ctrl, uint8_t *p_buf, uint32_t size) |
| Receives data sent by control transfer. More...
|
|
fsp_err_t | R_USB_PeriControlDataSet (usb_ctrl_t *const p_ctrl, uint8_t *p_buf, uint32_t size) |
| Performs transfer processing for control transfer. More...
|
|
fsp_err_t | R_USB_PeriControlStatusSet (usb_ctrl_t *const p_ctrl, usb_setup_status_t status) |
| Set the response to the setup packet. More...
|
|
fsp_err_t | R_USB_RemoteWakeup (usb_ctrl_t *const p_ctrl) |
| Sends a remote wake-up signal to the connected Host. More...
|
|
fsp_err_t | R_USB_ModuleNumberGet (usb_ctrl_t *const p_ctrl, uint8_t *module_number) |
| This API gets the module number. More...
|
|
fsp_err_t | R_USB_ClassTypeGet (usb_ctrl_t *const p_ctrl, usb_class_t *class_type) |
| This API gets the class type. More...
|
|
fsp_err_t | R_USB_DeviceAddressGet (usb_ctrl_t *const p_ctrl, uint8_t *device_address) |
| This API gets the device address. More...
|
|
fsp_err_t | R_USB_PipeNumberGet (usb_ctrl_t *const p_ctrl, uint8_t *pipe_number) |
| This API gets the pipe number. More...
|
|
fsp_err_t | R_USB_DeviceStateGet (usb_ctrl_t *const p_ctrl, uint16_t *state) |
| This API gets the state of the device. More...
|
|
fsp_err_t | R_USB_DataSizeGet (usb_ctrl_t *const p_ctrl, uint32_t *data_size) |
| This API gets the data size. More...
|
|
fsp_err_t | R_USB_SetupGet (usb_ctrl_t *const p_ctrl, usb_setup_t *setup) |
| This API gets the setup type. More...
|
|
Driver for the USB peripheral on RZ microprocessors. This module implements the USB Interface.
Overview
The USB module operates in combination with the device class drivers provided by Renesas to form a complete USB stack.
Features
The USB module has the following key features:
- USB Host mode
- Enumerates Low/Full/High-speed devices (see note below)
- Automatic transfer error determination and retry
- USB Peripheral mode
- Supports USB1.1/2.0/3.0 hosts
- Automatic processing of device connect/disconnect, suspend/resume, and USB bus reset
- Up to 10 pipes
- Control transfers supported on pipe 0
- Data transfer on pipes 1 to 9 (Bulk or Interrupt)
- Functions with or without an RTOS
- Note
- Supported speeds are dependent on the MCU.
Configuration
Build Time Configurations for r_usb_basic
The following build time configurations are defined in fsp_cfg/r_usb_basic_cfg.h:
Configuration | Options | Default | Description |
Parameter Checking |
-
Default (BSP)
-
Enabled
-
Disabled
| Default (BSP) | If selected code for parameter checking is included in the build. |
CPU Bus Access Wait Cycles | Refer to the RZT Configuration tool for available options. | 9 cycles | This setting controls the delay for consecutive USB peripheral register access. Set this value to a number of CPU cycles that is equivalent to 40.8ns or more. |
Power IC Shutdown Polarity |
| Active High | Select the polarity of the Shutdown signal on the power supply IC (if provided). |
Notifications for SET_INTERFACE/SET_FEATURE/CLEAR_FEATURE |
| Enabled | When enabled, the application will receive notifications for SET_INTERFACE, SET_FEATURE and CLEAR_FEATURE messages. |
Double Buffering |
| Enabled | When enabled, the FIFOs for Pipes 1-5 are double-buffered. |
Continuous Transfer Mode |
| Disabled | Enable or disable continuous transfer mode. |
DMA Support |
| Disable | Enable or disable DMA support for the USB module. |
Multiplex Interrupt |
| Disabled | Enable multiplex interrupt for a single driver. |
Peripheral module
Describes the setting items at the time of Peripheral.
Configurations for Connectivity > USB Driver on r_usb_basic
Configuration | Options | Default | Description |
Name | Name must be a valid C symbol | g_basic0 | Module name. |
USB Mode |
| Host mode | Select the usb mode. |
USB Speed |
| Hi Speed | Select the USB speed. |
USB Device Class |
-
Peripheral Communications Device Class
-
Peripheral Human Interface Device Class
-
Peripheral Mass Storage Class
-
Peripheral Vendor-defined Class
-
Host Communications Device Class
-
Host Human Interface Device Class
-
Host Mass Storage Class
-
Host Vendor-defined Class
| Peripheral Communications Device Class | Select the USB device class. |
USB Descriptor | USB Descriptor must be a valid C symbol. | g_usb_descriptor | Enter the name of the descriptor to be used.
For how to create a descriptor structure, refer to the Descriptor definition chapter in the usb_basic manual.
Specify NULL when using the Host class. |
USB Compliance Callback | Compliance Callback must be a valid C symbol. | NULL | Set the callback for compliance tests here. |
USBFS Interrupt Priority | MCU Specific Options | | Select the interrupt priority used by the main USB Function Interrupt ISR. |
USBFS Resume Priority | MCU Specific Options | | Select the interrupt priority used by the USB Function Resume ISR. |
USBFS D0FIFO Interrupt Priority | MCU Specific Options | | Select the interrupt priority used by the USB Function D0FIFO. |
USBFS D1FIFO Interrupt Priority | MCU Specific Options | | Select the interrupt priority used by the USB Function D1FIFO. |
USB RTOS Callback | Enter the address of the function. | NULL | If an RTOS is used, set the callback function here. |
USB Callback Context | Enter the address of the context. | NULL | If an RTOS is used, set the callback context here. |
Host module
Describes the setting items at the time of Host.
Configurations for Connectivity > USB Driver on (r_usb_basic)
Configuration | Options | Default | Description |
Name | Name must be a valid C symbol | g_basic0 | Module name. |
USB Mode |
| Host mode | Select the usb mode. |
USB Device Class |
-
Peripheral Communications Device Class
-
Peripheral Human Interface Device Class
-
Peripheral Mass Storage Class
-
Peripheral Vendor-defined Class
-
Host Communications Device Class
-
Host Human Interface Device Class
-
Host Mass Storage Class
-
Host Vendor-defined Class
| Peripheral Communications Device Class | Select the USB device class. |
USB Compliance Callback | Compliance Callback must be a valid C symbol. | NULL | Set the callback for compliance tests here. |
USB Host Interrupt Priority | MCU Specific Options | | Select the interrupt priority used by the main USB Host ISR. |
USB RTOS Callback | Enter the address of the function. | NULL | If an RTOS is used, set the callback function here. |
USB Callback Context | Enter the address of the context. | NULL | If an RTOS is used, set the callback context here. |
Clock Configuration
The USB module uses PLL as the clock source. The PLL frequency can be set in the Clocks tab of the configuration editor or by using the CGC Interface at run-time.
Pin Configuration
In peripheral mode the USB_VBUSIN pins are used to detect the USB connection status (connected or disconnected) and should be connected to the USB VBUS signal.
- Note
- USB_VBUSIN is 5V-tolerant pins.
In host mode the USB_VBUSEN, USB_OVRCUR pins should be connected to the relevant pins of an external power supply IC, if available. These pins will be used to manage the USB VBUS supply.
Descriptor definition
In Peripheral mode, the usb_descriptor_t structure stores descriptor information including the device and configuration descriptors. The values set in this structure are sent to the USB host as part of enumeration.
typedef struct usb_descriptor
{
uint8_t *p_device;
uint8_t *p_config_f;
uint8_t *p_config_h;
uint8_t *p_qualifier;
uint8_t **pp_string;
uint8_t num_string;
} usb_descriptor_t;
- Note
- Even in high-speed mode the full-speed configuration must be made available:
usb_descriptor_t g_usb_descriptor =
{
smp_device,
smp_config_f,
NULL,
NULL,
smp_str_table,
3,
};
usb_descriptor_t g_usb_descriptor =
{
smp_device,
smp_config_f,
smp_config_h,
smp_qualifier,
smp_str_table,
3,
};
String Descriptor
This USB driver requires string descriptors to be registered in the string descriptor table. Use the following format to define the elements:
uint8_t str_descriptor_0[]
{
0x04,
0x03,
0x09, 0x04
};
uint8_t str_descriptor_manufacturer[] =
{
0x10,
0x03,
'R', 0x00,
'E', 0x00,
'N', 0x00,
'E', 0x00,
'S', 0x00,
'A', 0x00,
'S', 0x00
};
uint8_t str_descriptor_product[] =
{
0x12,
0x03,
'C', 0x00,
'D', 0x00,
'C', 0x00,
'_', 0x00,
'D', 0x00,
'E', 0x00,
'M', 0x00,
'O', 0x00
};
uint8_t * smp_str_table[] =
{
str_descriptor_0,
str_descriptor_manufacturer,
str_descriptor_product,
};
- Note
- Set the string index values in the device/configuration descriptors (iManufacturer, iConfiguration etc.) to the index of the desired string in the string descriptor table. For example, in the table below, the manufacturer is described in str_descriptor_manufacturer and the value of iManufacturer in the device descriptor is 1.
Other Descriptors
Refer to the Universal Serial Bus Revision 2.0 specification (http://www.usb.org/developers/docs/) for details on how to construct the device, configuration and qualifier descriptors.
Usage Notes
Program Structure
USB applications (whether using an RTOS or not) should be written as an event-handling loop. Either a callback function (RTOS only) or R_USB_EventGet should be used to provide event data to the application loop where a switch statement handles the event.
- Note
- The USB_STATUS_CONFIGURED event should be confirmed before calling R_USB_Read or R_USB_Write.
Limitations
Developers should be aware of the following limitations when using the USB driver:
Peripheral Limitations
- Multiconfigurations are not supported.
- Only one device-class driver may be used at a time.
Host Limitations
- The current USB driver does not support hub.
- In USB host mode, the module does not support suspend during data transfers. Execute suspend only after confirming that all transfers are complete.
- In USB host mode, this USB driver does not support the composite device.
Examples
USB Basic Example
This is a basic example of minimal use of the USB in an application.
void usb_basic_example (void)
{
usb_event_info_t event_info;
g_usb_on_usb.
open(&g_basic0_ctrl, &g_basic0_cfg);
while (1)
{
g_usb_on_usb.
eventGet(&event_info, &event);
switch (event)
{
break;
break;
{
g_usb_on_usb.
periControlDataGet(&g_basic0_ctrl, (uint8_t *) &g_line_coding, LINE_CODING_LENGTH);
}
{
g_usb_on_usb.
periControlDataSet(&g_basic0_ctrl, (uint8_t *) &g_line_coding, LINE_CODING_LENGTH);
}
else
{
}
break;
break;
default:
break;
}
}
}
◆ usb_instance_ctrl_t
ICU private control block. DO NOT MODIFY. Initialization occurs when R_ICU_ExternalIrqOpen is called.
◆ R_USB_Open()
Applies power to the USB module specified in the argument (p_ctrl).
- Return values
-
FSP_SUCCESS | Success in open. |
FSP_ERR_USB_BUSY | Specified USB module now in use. |
FSP_ERR_ASSERTION | Parameter is NULL error. |
FSP_ERR_USB_FAILED | The function could not be completed successfully. |
FSP_ERR_USB_PARAMETER | Parameter error. |
- Note
- Do not call this API in the following function.
-
(1). Interrupt function.
-
(2). Callback function ( for RTOS ).
◆ R_USB_Close()
Terminates power to the USB module specified in argument (p_ctrl). USB0 module stops when USB_IP0 is specified to the member (module), USB1 module stops when USB_IP1 is specified to the member (module).
- Return values
-
FSP_SUCCESS | Success. |
FSP_ERR_USB_FAILED | The function could not be completed successfully. |
FSP_ERR_USB_NOT_OPEN | USB module is not open. |
FSP_ERR_ASSERTION | Parameter is NULL error. |
FSP_ERR_USB_PARAMETER | Parameter error. |
- Note
- Do not call this API in the following function.
-
(1). Interrupt function.
-
(2). Callback function ( for RTOS ).
◆ R_USB_Read()
fsp_err_t R_USB_Read |
( |
usb_ctrl_t *const |
p_ctrl, |
|
|
uint8_t * |
p_buf, |
|
|
uint32_t |
size, |
|
|
uint8_t |
destination |
|
) |
| |
Bulk/interrupt data transfer and control data transfer.
Bulk/interrupt data transfer
Requests USB data read (bulk/interrupt transfer). The read data is stored in the area specified by argument (p_buf). After data read is completed, confirm the operation by checking the return value (USB_STATUS_READ_COMPLETE) of the R_USB_GetEvent function. The received data size is set in member (size) of the usb_ctrl_t structure. To figure out the size of the data when a read is complete, check the return value (USB_STATUS_READ_COMPLETE) of the R_USB_GetEvent function, and then refer to the member (size) of the usb_crtl_t structure.
Control data transfer
The R_USB_Read function is used to receive data in the data stage and the R_USB_Write function is used to send data to the USB host.
- Return values
-
FSP_SUCCESS | Successfully completed (Data read request completed). |
FSP_ERR_USB_FAILED | The function could not be completed successfully. |
FSP_ERR_USB_BUSY | Data receive request already in process for USB device with same device address. |
FSP_ERR_ASSERTION | Parameter is NULL error. |
FSP_ERR_USB_PARAMETER | Parameter error. |
- Note
- The address specified in the argument p_buf must be 4-byte aligned.
-
Do not call this API in the following function.
-
(1). Interrupt function.
-
(2). Callback function ( for RTOS ).
◆ R_USB_Write()
fsp_err_t R_USB_Write |
( |
usb_ctrl_t *const |
p_ctrl, |
|
|
uint8_t const *const |
p_buf, |
|
|
uint32_t |
size, |
|
|
uint8_t |
destination |
|
) |
| |
Bulk/Interrupt data transfer and control data transfer.
Bulk/Interrupt data transfer
Requests USB data write (bulk/interrupt transfer). Stores write data in area specified by argument (p_buf). Set the device class type in usb_ctrl_t structure member (type). Confirm after data write is completed by checking the return value (USB_STATUS_WRITE_COMPLETE) of the R_USB_GetEvent function. To request the transmission of a NULL packet, assign USB_NULL(0) to the third argument (size).
Control data transfer
The R_USB_Read function is used to receive data in the data stage and the R_USB_Write function is used to send data to the USB host.
- Return values
-
FSP_SUCCESS | Successfully completed. (Data write request completed) |
FSP_ERR_USB_FAILED | The function could not be completed successfully. |
FSP_ERR_USB_BUSY | Data write request already in process for USB device with same device address. |
FSP_ERR_ASSERTION | Parameter is NULL error. |
FSP_ERR_USB_PARAMETER | Parameter error. |
- Note
- The address specified in the argument p_buf must be 4-byte aligned.
-
Do not call this API in the following function.
-
(1). Interrupt function.
-
(2). Callback function ( for RTOS ).
◆ R_USB_Stop()
Requests a data read/write transfer be terminated when a data read/write transfer is being performed.
To stop a data read, set USB_TRANSFER_READ as the argument (type); to stop a data write, specify USB_WRITE as the argument (type).
- Return values
-
FSP_SUCCESS | Successfully completed. (stop completed) |
FSP_ERR_USB_FAILED | The function could not be completed successfully. |
FSP_ERR_ASSERTION | Parameter is NULL error. |
FSP_ERR_USB_BUSY | Stop processing is called multiple times. |
FSP_ERR_USB_PARAMETER | Parameter error. |
- Note
- Do not call this API in the following function.
-
(1). Interrupt function.
-
(2). Callback function ( for RTOS ).
◆ R_USB_Suspend()
Sends a SUSPEND signal from the USB module assigned to the member (module) of the usb_crtl_t structure.
After the suspend request is completed, confirm the operation with the return value (USB_STATUS_SUSPEND) of the R_USB_EventGet function.
- Return values
-
FSP_SUCCESS | Successfully completed. |
FSP_ERR_USB_FAILED | The function could not be completed successfully. |
FSP_ERR_USB_BUSY | During a suspend request to the specified USB module, or when the USB module is already in the suspended state. |
FSP_ERR_ASSERTION | Parameter is NULL error. |
FSP_ERR_USB_PARAMETER | Parameter error. |
- Note
- Do not call this API in the following function.
-
(1). Interrupt function.
-
(2). Callback function ( for RTOS ).
◆ R_USB_Resume()
Sends a RESUME signal from the USB module assigned to the member (module) of the usb_ctrl_tstructure.
After the resume request is completed, confirm the operation with the return value (USB_STATUS_RESUME) of the R_USB_EventGet function
- Return values
-
FSP_SUCCESS | Successfully completed. |
FSP_ERR_USB_FAILED | The function could not be completed successfully. |
FSP_ERR_USB_BUSY | Resume already requested for same device address. (USB host mode only) |
FSP_ERR_USB_NOT_SUSPEND | USB device is not in the SUSPEND state. |
FSP_ERR_ASSERTION | Parameter is NULL error. |
FSP_ERR_USB_PARAMETER | Parameter error. |
- Note
- Do not call this API in the following function.
-
(1). Interrupt function.
-
(2). Callback function ( for RTOS ).
◆ R_USB_VbusSet()
Specifies starting or stopping the VBUS supply.
- Return values
-
FSP_SUCCESS | Successful completion. (VBUS supply start/stop completed) |
FSP_ERR_USB_FAILED | The function could not be completed successfully. |
FSP_ERR_ASSERTION | Parameter is NULL error. |
FSP_ERR_USB_PARAMETER | Parameter error. |
- Note
- Do not call this API in the following function.
-
(1). Interrupt function.
-
(2). Callback function ( for RTOS ).
◆ R_USB_InfoGet()
Obtains completed USB-related events.
- Return values
-
FSP_SUCCESS | Successful completion. (VBUS supply start/stop completed) |
FSP_ERR_ASSERTION | Parameter is NULL error. |
FSP_ERR_USB_FAILED | The function could not be completed successfully. |
FSP_ERR_USB_PARAMETER | Parameter error. |
◆ R_USB_PipeRead()
fsp_err_t R_USB_PipeRead |
( |
usb_ctrl_t *const |
p_ctrl, |
|
|
uint8_t * |
p_buf, |
|
|
uint32_t |
size, |
|
|
uint8_t |
pipe_number |
|
) |
| |
Requests a data read (bulk/interrupt transfer) via the pipe specified in the argument.
The read data is stored in the area specified in the argument (p_buf). After the data read is completed, confirm the operation with the R_USB_GetEvent function return value(USB_STATUS_READ_COMPLETE). To figure out the size of the data when a read is complete, check the return value (USB_STATUS_READ_COMPLETE) of the R_USB_GetEvent function, and then refer to the member (size) of the usb_crtl_t structure.
- Return values
-
FSP_SUCCESS | Successfully completed. |
FSP_ERR_USB_BUSY | Specified pipe now handling data receive/send request. |
FSP_ERR_USB_FAILED | The function could not be completed successfully. |
FSP_ERR_ASSERTION | Parameter is NULL error. |
FSP_ERR_USB_PARAMETER | Parameter error. |
- Note
- The address specified in the argument p_buf must be 4-byte aligned.
-
Do not call this API in the following function.
-
(1). Interrupt function.
-
(2). Callback function ( for RTOS ).
◆ R_USB_PipeWrite()
fsp_err_t R_USB_PipeWrite |
( |
usb_ctrl_t *const |
p_ctrl, |
|
|
uint8_t * |
p_buf, |
|
|
uint32_t |
size, |
|
|
uint8_t |
pipe_number |
|
) |
| |
Requests a data write (bulk/interrupt transfer).
The write data is stored in the area specified in the argument (p_buf). After data write is completed, confirm the operation with the return value (USB_STATUS_WRITE_COMPLETE) of the EventGet function. To request the transmission of a NULL packet, assign USB_NULL (0) to the third argument (size).
- Return values
-
FSP_SUCCESS | Successfully completed. |
FSP_ERR_USB_BUSY | Specified pipe now handling data receive/send request. |
FSP_ERR_USB_FAILED | The function could not be completed successfully. |
FSP_ERR_ASSERTION | Parameter is NULL error. |
FSP_ERR_USB_PARAMETER | Parameter error. |
- Note
- The address specified in the argument p_buf must be 4-byte aligned.
-
Do not call this API in the following function.
-
(1). Interrupt function.
-
(2). Callback function ( for RTOS ).
◆ R_USB_PipeStop()
Terminates a data read/write operation.
- Return values
-
FSP_SUCCESS | Successfully completed. (Stop request completed) |
FSP_ERR_USB_FAILED | The function could not be completed successfully. |
FSP_ERR_ASSERTION | Parameter is NULL error. |
FSP_ERR_USB_PARAMETER | Parameter error. |
- Note
- Do not call this API in the following function.
-
(1). Interrupt function.
-
(2). Callback function ( for RTOS ).
◆ R_USB_UsedPipesGet()
fsp_err_t R_USB_UsedPipesGet |
( |
usb_ctrl_t *const |
p_ctrl, |
|
|
uint16_t * |
p_pipe, |
|
|
uint8_t |
destination |
|
) |
| |
Gets the selected pipe number (number of the pipe that has completed initalization) via bit map information.
The bit map information is stored in the area specified in argument (p_pipe). Based on the information (module member and address member) assigned to the usb_ctrl_t structure, obtains the PIPE information of that USB device.
- Return values
-
FSP_SUCCESS | Successfully completed. |
FSP_ERR_USB_FAILED | The function could not be completed successfully. |
FSP_ERR_ASSERTION | Parameter is NULL error. |
FSP_ERR_USB_PARAMETER | Parameter error. |
◆ R_USB_PipeInfoGet()
fsp_err_t R_USB_PipeInfoGet |
( |
usb_ctrl_t *const |
p_ctrl, |
|
|
usb_pipe_t * |
p_info, |
|
|
uint8_t |
pipe_number |
|
) |
| |
Gets the following pipe information regarding the pipe specified in the argument (p_ctrl) member (pipe): endpoint number, transfer type, transfer direction and maximum packet size.
The obtained pipe information is stored in the area specified in the argument (p_info).
- Return values
-
FSP_SUCCESS | Successfully completed. |
FSP_ERR_USB_FAILED | The function could not be completed successfully. |
FSP_ERR_ASSERTION | Parameter is NULL error. |
FSP_ERR_USB_PARAMETER | Parameter error. |
◆ R_USB_PullUp()
This API enables or disables pull-up of D+/D- line.
- Return values
-
FSP_SUCCESS | Successful completion. (Pull-up enable/disable setting completed) |
FSP_ERR_USB_FAILED | The function could not be completed successfully. |
FSP_ERR_ASSERTION | Parameter is NULL error. |
FSP_ERR_USB_PARAMETER | Parameter error. |
- Note
- Do not call this API in the following function.
-
(1). Interrupt function.
-
(2). Callback function ( for RTOS ).
◆ R_USB_EventGet()
Obtains completed USB related events. (OS-less Only)
In USB host mode, the device address value of the USB device that completed an event is specified in the usb_ctrl_t structure member (address) specified by the event's argument. In USB peripheral mode, USB_NULL is specified in member (address). If this function is called in the RTOS execution environment, a failure is returned.
- Return values
-
FSP_SUCCESS | Event Get Success. |
FSP_ERR_USB_FAILED | If called in the RTOS environment, an error is returned. |
- Note
- Do not use the same variable as the first argument of R_USB_Open for the first argument.
-
Do not call this API in the interrupt function.
◆ R_USB_Callback()
fsp_err_t R_USB_Callback |
( |
usb_callback_t * |
p_callback | ) |
|
Register a callback function to be called upon completion of a USB related event. (RTOS only)
This function registers a callback function to be called when a USB-related event has completed. If this function is called in the OS-less execution environment, a failure is returned.
- Return values
-
FSP_SUCCESS | Successfully completed. |
FSP_ERR_USB_FAILED | If this function is called in the OS-less execution environment, a failure is returned. |
FSP_ERR_ASSERTION | Parameter is NULL error. |
- Note
- Do not call this API in the interrupt function.
◆ R_USB_HostControlTransfer()
fsp_err_t R_USB_HostControlTransfer |
( |
usb_ctrl_t *const |
p_ctrl, |
|
|
usb_setup_t * |
p_setup, |
|
|
uint8_t * |
p_buf, |
|
|
uint8_t |
device_address |
|
) |
| |
Performs settings and transmission processing when transmitting a setup packet.
- Return values
-
FSP_SUCCESS | Successful completion. |
FSP_ERR_USB_FAILED | The function could not be completed successfully. |
FSP_ERR_ASSERTION | Parameter is NULL error. |
FSP_ERR_USB_PARAMETER | Parameter error. |
FSP_ERR_USB_BUSY | Specified pipe now handling data receive/send request. |
- Note
- The address specified in the argument p_buf must be 4-byte aligned.
-
Do not call this API in the following function.
-
(1). Interrupt function.
-
(2). Callback function ( for RTOS ).
◆ R_USB_PeriControlDataGet()
fsp_err_t R_USB_PeriControlDataGet |
( |
usb_ctrl_t *const |
p_ctrl, |
|
|
uint8_t * |
p_buf, |
|
|
uint32_t |
size |
|
) |
| |
Receives data sent by control transfer.
- Return values
-
FSP_SUCCESS | Successful completion. |
FSP_ERR_USB_FAILED | The function could not be completed successfully. |
FSP_ERR_ASSERTION | Parameter is NULL error. |
FSP_ERR_USB_BUSY | Specified pipe now handling data receive/send request. |
FSP_ERR_USB_PARAMETER | Parameter error. |
- Note
- The address specified in the argument p_buf must be 4-byte aligned.
-
Do not call this API in the following function.
-
(1). Interrupt function.
-
(2). Callback function ( for RTOS ).
◆ R_USB_PeriControlDataSet()
fsp_err_t R_USB_PeriControlDataSet |
( |
usb_ctrl_t *const |
p_ctrl, |
|
|
uint8_t * |
p_buf, |
|
|
uint32_t |
size |
|
) |
| |
Performs transfer processing for control transfer.
- Return values
-
FSP_SUCCESS | Successful completion. |
FSP_ERR_USB_FAILED | The function could not be completed successfully. |
FSP_ERR_ASSERTION | Parameter is NULL error. |
FSP_ERR_USB_BUSY | Specified pipe now handling data receive/send request. |
FSP_ERR_USB_PARAMETER | Parameter error. |
- Note
- The address specified in the argument p_buf must be 4-byte aligned.
-
Do not call this API in the following function.
-
(1). Interrupt function.
-
(2). Callback function ( for RTOS ).
◆ R_USB_PeriControlStatusSet()
Set the response to the setup packet.
- Return values
-
FSP_SUCCESS | Successful completion. |
FSP_ERR_USB_FAILED | The function could not be completed successfully. |
FSP_ERR_ASSERTION | Parameter is NULL error. |
- Note
- Do not call this API in the following function.
-
(1). Interrupt function.
-
(2). Callback function ( for RTOS ).
◆ R_USB_RemoteWakeup()
Sends a remote wake-up signal to the connected Host.
- Return values
-
FSP_SUCCESS | Successful completion. |
FSP_ERR_USB_FAILED | The function could not be completed successfully. |
FSP_ERR_ASSERTION | Parameter is NULL error. |
FSP_ERR_USB_NOT_SUSPEND | Device is not suspended. |
FSP_ERR_USB_BUSY | The device is in resume operation. |
- Note
- Do not call this API in the following function.
-
(1). Interrupt function.
-
(2). Callback function ( for RTOS ).
◆ R_USB_ModuleNumberGet()
This API gets the module number.
- Return values
-
FSP_SUCCESS | Successful completion. |
◆ R_USB_ClassTypeGet()
This API gets the class type.
- Return values
-
FSP_SUCCESS | Successful completion. |
◆ R_USB_DeviceAddressGet()
This API gets the device address.
- Return values
-
FSP_SUCCESS | Successful completion. |
◆ R_USB_PipeNumberGet()
This API gets the pipe number.
- Return values
-
FSP_SUCCESS | Successful completion. |
◆ R_USB_DeviceStateGet()
This API gets the state of the device.
- Return values
-
FSP_SUCCESS | Successful completion. |
◆ R_USB_DataSizeGet()
This API gets the data size.
- Return values
-
FSP_SUCCESS | Successful completion. |
◆ R_USB_SetupGet()
This API gets the setup type.
- Return values
-
FSP_SUCCESS | Successful completion. |