Instruction manual

Renesas USB MCU and USB ASSP USB Basic Host and Peripheral firmware
R01AN0512EJ0210 Rev.2.10 Page 62 of 157
Apr 1, 2013
2. Main task
After initialization, the sample program calls the usb_apl_task_switch function and the device returns to the “static state”.
With the sample program is in the static state, enumeration and USB operation is triggered via interrupts.
3. Static state operations:
Check for processing requests with scheduler.
If any processing requests are present, select the task with highest priority and set its task processing request flag.
If a task processing request flag is set, confirm the message and process the task specified in the message
Figure 4-2 shows the program flow in the static state.
usb_apl_task_switch
R_usb_cstd_Scheduler
Yes
task processing
request flag set?
R_usb_pstd_PcdTask
R_usb_pvendor_task
usb_pvendor_apl_task
No
Figure 4-2 Static State Program Flow
4. Sample Application Task (APL) - usb_pvendor_apl_task()
The sample application task performs open processing and issues data transmit/receive requests to the sample vendor
driver as described below for the ANSI-type configuration.
(1). Open Processing
Checks if USB communication with USB host is enabled. If enabled, obtains file number.
(2). Issue data transmit/receive requests to the sample vendor driver (PDCD below).
After open processing is complete, the sample application task uses the file number obtained in the open
processing to transmit/receive data to/from the sample driver.
5. Sample Vendor Class Driver Task (PDCD) - usb_pvendor_task()
The sample vendor driver task (PDCD) notifies PCD of data transmit/receive requests from the sample application task
and performs the data transmit/receive operation.