Instruction manual

Renesas USB MCU and USB ASSP USB Basic Host and Peripheral firmware
R01AN0512EJ0210 Rev.2.10 Page 20 of 157
Apr 1, 2013
open
Enable USB peripheral device class communication and confirm
Format
int16_t open (int8_t *name, uint16_t mode, uint16_t flg)
Arguments
*name Class code : USB_CLASS_PSTD_BULK / USB_CLASS_PSTD_INT
mode Mode ( Not used, set to 0)
flg Flag (Not used, set to 0)
Return Value
File number. (Success: 0x10 -- 0x1F /Failure: -1)
As the File Number is required for subsequent communication using read() and write(), the
open() function must be called first.
Description
This function enables the USB device class communication and confirms whether it is enabled or not.
If USB device class communication is enabled, the function sends the file number (0x100x1f) as the return value,
if the connection fails, it returns (-1).
When a file number is received, USB device class communications using read() or write() can be performed.
The following is Class code that USB-BASIC-FW supports.
Class Class code Note
VENDOR USB_CLASS_PSTD_BULK
USB_CLASS_PSTD_BULK is an example class that
only has (two) bulk type endpoints
VENDOR USB_CLASS_PSTD_INT
USB_CLASS_PSTD_INT is an example class which
only has (two) interrupt endpoints.
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. As the file number is required for USB device class communications using read() or write(), the open
function must be called before performing the communication.