Instruction manual

Renesas USB MCU and USB ASSP USB Basic Host and Peripheral firmware
R01AN0512EJ0210 Rev.2.10 Page 15 of 157
Apr 1, 2013
3. How to Register Class Driver
The class driver which the user created functions as the USB class driver by registering with USB-BASIC-FW.
3.1 How to register Peripheral Class Driver
Please consult function usb_papl_registration () in r_usb_vendor_papl.c and register the class driver into USB-BASIC-
FW. For details, please refer to Chapter
4.3.1.
The following describes how to register user-created class drivers and applications in the USB-BASIC-FW.
void usb_papl_registration(USB_UTR_t *ptr)
{
USB_PCDREG_t driver;
/* Driver registration */
/* Pipe Define Table address */
driver.pipetbl = (uint16_t**)&usb_gpvendor_smpl_epptr;
/* Device descriptor Table address */
driver.devicetbl = (uint8_t*)&usb_gpvendor_smpl_DeviceDescriptor;
/* Qualifier descriptor Table address */
driver.qualitbl = (uint8_t*)&usb_gpvendor_smpl_QualifierDescriptor;
/* Configuration descriptor Table address */
driver.configtbl = (uint8_t**)&usb_gpvendor_smpl_ConPtr;
/* Other configuration descriptor Table address */
driver.othertbl = (uint8_t**)&usb_gpvendor_smpl_ConPtrOther;
/* String descriptor Table address */
driver.stringtbl = (uint8_t**)&usb_gpvendor_str_ptr;
/* Driver init */
driver.classinit = &usb_cvendor_dummy_function;
/* Device default */
/* Condition compilation by the difference of user define */
#if USB_SPEEDSEL_PP == USB_HS_PP
driver.devdefault = &usb_pvendor_smpl_DescriptorChange;
#else /* USB_SPEEDSEL_PP == USB_HS_PP */
driver.devdefault = &usb_cvendor_dummy_function;
#endif /* USB_SPEEDSEL_PP == USB_HS_PP */
/* Device configured */
driver.devconfig = &usb_pvendor_apl_init;
/* Device detach */
driver.devdetach = &usb_pvendor_apl_close;
/* Device suspend */
driver.devsuspend = &usb_cvendor_dummy_function;
/* Device resume */
driver.devresume = &usb_cvendor_dummy_function;
/* Interfaced change */
driver.interface = &usb_cvendor_dummy_function;
/* Control Transfer */
driver.ctrltrans = &usb_cstd_UsrCtrlTransFunction;
R_usb_pstd_DriverRegistration(ptr, &driver);
}