SlideShare une entreprise Scribd logo
1  sur  129
Télécharger pour lire hors ligne
APPLICATION NOTE

Renesas USB Device                                                                                                                 R01AN0512EJ0110
                                                                                                                                            Rev.1.10
USB Basic Firmware                                                                                                                      Jun 10, 2011


Introduction
This document is an instruction manual for the Renesas USB Device USB basic firmware, a sample program for USB
interface control using the Renesas USB Device.

Target Device
RX62N, RX630 and R8A66597

Contents

     1.     Document Overview .......................................................................................................................... 2

     2.     Overview ........................................................................................................................................... 3

     3.     Using USB-BASIC-F/W................................................................................................................... 10

     4.     User-Defined Macros ...................................................................................................................... 13

     5.     User-Defined Information ................................................................................................................ 17

     6.     Workspace ...................................................................................................................................... 28

     7.     Sample Applications........................................................................................................................ 33

     8.     Peripheral Driver (PCD) .................................................................................................................. 41

     9.     Peripheral Control Transfer............................................................................................................. 53

     10. Host Driver (HCD) ........................................................................................................................... 56

     11. Host Control Transfer ...................................................................................................................... 65

     12. Host Manager (MGR) ...................................................................................................................... 74

     13. Non-OS Scheduler .......................................................................................................................... 89

     14. uITRON System .............................................................................................................................. 97

     15. HUB class driver(HUBCD) .............................................................................................................. 99

     16. Data Transfer ................................................................................................................................ 105

     17. DTC Transfer................................................................................................................................. 116

     18. EXDMA Transfer ........................................................................................................................... 121

     19. Restrictions.................................................................................................................................... 125




R01AN0512EJ0110 Rev.1.10                                                                                                                    Page 1 of 126
Jun 10, 2011
USB Basic Firmware


1.     Document Overview
     1.1      Overview
This document is an instruction manual for the Renesas USB Devices USB basic firmware, a sample program for USB
interface control using the Renesas USB Devices.
This firmware includes uITRON ver. and OS less ver.
This document is intended to be used together with the device’s data sheet.


     1.2      Related Documents
[1] Universal Serial Bus Revision 2.0 Specification
    [http://www.usb.org/developers/docs/]

[2] Renesas USB Device Hardware Manual
    Available from the Renesas website

Renesas Website
   [http://www.renesas.com/index.html]

USB Device Page
  [http://www.renesas.com/prod/usb/]



     1.3      List of Terms
Terms and abbreviations used in this document are listed below.
USB:         Universal Serial Bus
USB-BASIC-F/W:       USB basic firmware for Renesas USB Device (non-OS/uITRON)
non-OS:      USB basic firmware for OS less system
uITRON:      USB basic firmware for uITRON system
HEW:         High-performance Embedded Workshop

PCD:               Peripheral control driver of USB-BASIC-F/W
PDCD:              Peripheral device class driver (device driver and USB class driver)
HCD:               Host control driver of USB-BASIC-F/W
MGR:               Peripheral device state manager of HCD
HDCD:              Host device class driver (device driver and USB class driver)
HUBCD:             Hub class sample driver
APL:               Application program
HTST:              Host electrical test
Task:              Processing unit
scheduler:         Used to schedule functions, like a simplified OS
Scheduler macro:   Used to call a scheduler function (non-OS)




R01AN0512EJ0110 Rev.1.10                                                                         Page 2 of 126
Jun 10, 2011
USB Basic Firmware

2.     Overview
     2.1     Features of USB-BASIC-F/W
The main features of USB-BASIC-F/W are as follows.
 [Overall]
•  Can control RX62N, RX630 and R8A66597 by common source code.
•  Can use same source code in uITRON or non-OS.
•  Can operate in either host function or peripheral function mode.
•  Multiple device class drivers may be installed without the need to customize USB-BASIC-F/W.
   (Device class drivers can be registered up to the maximum number of devices that can be connected.)
 [Host function mode]
• When a no-response condition is detected during data transfer, the transfer is retried
   (n retries per transfer on the same pipe: specified by user in file r_usbc_cDefUsr.h).
• Common API for control transfer, bulk transfer and interrupt transfer is provided.
• API for devices connect/disconnect processing is provided.
• API for suspend/resume processing is provided.
• HUBCD sample program code is provided.
• Sample application for data transfer is added. (This application operates as Vendor class.)
• A single pipe can perform multiple exclusive data communication tasks in order to manage HDCD pipe information
   tables.
 [Peripheral function mode]
• Operation can be confirmed by using USBCommandVerifier.exe.
   (USBCV is available for download from http://www.usb.org/developers/developers/tools/.)
• API for control transfer is provided.
• Common API for bulk transfer and interrupt transfer is provided.
• API for devices connect/disconnect processing is provided.
• API for suspend/resume processing is provided.
• Sample application for data transfer is added. (This application operates as Vendor class.)

The following functions must be provided by the customer to match the system under development.
• Overcurrent detection processing when connecting USB cables (host function mode).
• Descriptor analysis (host function mode).
• Device class driver



     2.2     Development Goals
USB-BASIC-F/W was developed with the following goals in mind.
• To simplify the development of USB communication programs by customers using Renesas USB Device.
• To provide source code examples for hardware control of USB.



     2.3     Functions
The functions provided by USB-BASIC-F/W are as follows.
• In host function mode, enumeration as low-speed/full-speed/high-speed device (However, operating speed is
  different by devices ability.)
• In peripheral function mode, enumeration as USB1.1/2.0/3.0 host
• Device connect/disconnect, suspend/resume, and USB bus reset processing
• Control transfer on pipe 0
• Data transfer on pipes 1 to 9 (bulk or interrupt transfer: CPU access/DTC or DMA access)
• Transfer error determination and transfer retry



R01AN0512EJ0110 Rev.1.10                                                                           Page 3 of 126
Jun 10, 2011
USB Basic Firmware

  2.4             Task Configuration
In peripheral function mode, USB-BASIC-F/W comprises the peripheral driver, which controls H/W, and the
application. In host function mode, USB-BASIC-F/W comprises the host driver, which controls H/W, the manager,
which manages device states, the hub class driver, which controls devices connected to the down ports of the USB hub,
and the application.
Peripheral driver and host driver initiate hardware control according to messages from the various tasks or interrupt
handler. They also notify the appropriate task when hardware control ends, of processing results, and of hardware
requests.
Manager manages the states of devices connected and performs enumeration. In addition, manager issues a message to
host driver or hub class driver when the application changes the device state. Hub class driver is sample program code
for managing the states of devices connected to the down ports of the USB hub and performing enumeration.
         uITRON


                    Scheduler Function
                         non-OS




                                         Figure 2.1 Task Configuration of USB-BASIC-F/W




R01AN0512EJ0110 Rev.1.10                                                                                 Page 4 of 126
Jun 10, 2011
USB Basic Firmware
Table 2.1     Task Functions
No.   Module Name                                        Function
1     USB interrupt handler                                •   USB interrupt handler
      void usb_cstd_UsbHandler(void)                           (USB packet transmit/receive end and special
                                                               signal detection)
2     Peripheral driver (PCD)                              •   Hardware control in peripheral function mode
      void                                                 •   Peripheral transaction management
      usb_pstd_PcdTask(USBC_VP_INT_t)
3     Host driver (HCD)                                     •     Hardware control in host function mode
      void                                                  •     Host transaction management
      usb_hstd_HcdTask(USBC_VP_INT_t)
4     Host manager (MGR)                                   •    Device state management
      void                                                 •    Enumeration
      usb_hstd_MgrTask(USBC_VP_INT_t)                      •    HCD/HUBCD control message determination
5     Hub class driver (HUBCD)                             •    HUB down port device state management
      void usb_hhub_Task(USBC_VP_INT_t)                    •    HUB down port enumeration
6     Device class driver (PDCD/HDCD)                    Provided by the customer as appropriate for the system.
7     Device driver (HDD)                                Provided by the customer as appropriate for the system.
8     Application (APL)                                  Provided by the customer as appropriate for the system.


    2.5       Non-OS Scheduler Function
A scheduler function manages requests generated by the tasks and hardware according to the relative priority of the
tasks. When multiple requests are generated by tasks with the same priority, they are executed using a FIFO
configuration. To assure commonality with non-OS and uITRON-compatible firmware, requests between tasks are
implemented by transmitting and receiving messages. In addition, call-back functions are used for responses to tasks
indicating the end of a request, so the customer need only install appropriate class drivers for the system and there is no
need to modify the scheduler itself.


    2.6       Sequence Outline
Like USB-BASIC-F/W comprises usbc_cstd_MainTask, MainInit, MainLoop and usb_cstd_UsbHandler. In non-OS,
the compositions add scheduler.
When an interrupt occurs, the function mode that is selected by USB operational mode setting is checked and
notification is sent by means of a message to PCD/HCD. When the PCD or HCD task receives a message from the USB
interrupt handler, it determines the interrupt source and executes the appropriate processing. (For a sequence outline of
PCD/HCD task, see sections 8 and 10.)
The PCD or HCD is selected by USB function setting. (For a USB function setting, see sections 5.)




R01AN0512EJ0110 Rev.1.10                                                                                   Page 5 of 126
Jun 10, 2011
USB Basic Firmware

          usbc_cstd_Main                   MainInit
               Task
                                        Initialize USB
              MainInit()                    function

                                        Register driver
           Start Idle Task                                        usb_cstd_UsbHandler
                                      Initialize scheduler
                                             function                                     USBC_HOST_PP
                                                                    Operating mode?
            MainLoop()                    Set priority
                                                                              USBC_PERI_PP
                                          Set USB                    Clear interrupt           Clear interrupt
              Idle Task                operating mode                   source                    source

                                                                     Send message           Send message
                                            Return                      to PCD                 to HCD


                                                                        Return


   USB_FUNCSEL_PP ==               USB_FUNCSEL_PP ==                      Task
     USBC_PERI_PP                    USBC_HOST_PP
                                                                                          No
                                                                  USBC_TRCV_MSG?
         MainLoop                         MainLoop
                                                                             Yes
         Application                      Application                  Processing


                             No                              No                          Tasks starting is
       Task processing                 Task processing                   Return             controlled
          flag set?                       flag set?
                                                                                          by scheduler
                   Yes                             Yes
                                                                       Scheduler
          PCD task                         HCD task
                                                                                           No
         PDCD task                        MGR task                 Processing request?

                                           HUB task                               Yes
                                                                   Select request with
         Scheduler                        HDCD task                    top priority

           Return                                                       Set task
                                          Scheduler
                                                                     processing flag

                                            Return
                                                                         Return


                                  Figure 2.2 Sequence Outline (non-OS)




R01AN0512EJ0110 Rev.1.10                                                                              Page 6 of 126
Jun 10, 2011
USB Basic Firmware

              usbc_cstd_Main
                                                                MainInit
                   Task
                                                              Initialize USB
                 MainInit()                                       function

               Start Idle task                     Start PCD task        Start MGR task

                                                                         Start HCD task

                MainLoop()
                                                             Register driver

                                                                Set USB
                                                             operating mode


                                                                    Return




                      Task                             usb_cstd_UsbHandler


                                                                                USBC_HOST_PP
                                                         Operating mode?
               USBC_TRCV_MSG?
                                                                    USBC_PERI_PP
                                                          Clear interrupt     Clear interrupt
                   Processing                                source              source

                                                          Send message             Send message
                                                             to PCD                   to HCD


                                                              Return


                                 Figure 2.3 Sequence Outline (uITRON)




R01AN0512EJ0110 Rev.1.10                                                                          Page 7 of 126
Jun 10, 2011
USB Basic Firmware

  2.7       Non-OS Task Operation Example
An example of the operation of a USB-BASIC-F/W task is shown below.

                     Execution request received by MGR task in host function mode
                     Note: Operation is the same in peripheral function mode.
                                                  Execution request
                               MainLoop                                  HCD task
                                                    MGR task
                                                       execution
                              Application                                                  No
                                                                      USBC_TRCV_MSG?

                                                  No                             Yes
                               Flag set ?                               Processing
                                            Yes
                               HCD task                                   Return

                               MGR task                                  MGR task

                               HUB task                                                    No
                                                                      USBC_TRCV_MSG?
                              HDCD task                                              Yes
                                                                        Processing


                               Scheduler                                  Return


                                 return                                  HUB task

                                                                                           No
                                                                      USBC_TRCV_MSG?

                                                                                 Yes
                                                                        Processing


                                                                          Return

                                                                        HDCD task

                                                                                           No
                                                                      USBC_TRCV_MSG?

                                                                                  Yes
                                                                         Processing


                                                                          Return


                              Figure 2.4 Task Operation Example (non-OS)




R01AN0512EJ0110 Rev.1.10                                                                        Page 8 of 126
Jun 10, 2011
USB Basic Firmware

  2.8       uITRON Task-Related Operation
Operation related to USB-BASIC-F/W tasks is shown below.




                              Figure 2.5 Task-Related Operation (uITRON)




R01AN0512EJ0110 Rev.1.10                                                           Page 9 of 126
Jun 10, 2011
USB Basic Firmware

3.     Using USB-BASIC-F/W
     3.1      Overview
USB-BASIC-F/W is a USB driver that is adapted for the customer’s system by making changes to the non-OS
scheduler macros or uITRON system control macros (r_usbc_cItron.h, r_usbc_cMacSystemcall.h), user information
(r_usbc_cDefUsr.h, r_usb_cDefUsr.h), and non-OS settings (r_usbc_cKernelId.h, main.c, r_usb_PSMPL_apl.c,
r_usb2_HSMPL_apl.c) to add HDCD and PDCD tasks.


     3.2      Changing USB-BASIC-F/W
In order to use USB-BASIC-F/W, it is necessary to make changes to the following program code and header files.
1. It is necessary select the project and the build configuration in USB-BASIC-F/W.
   ⎯ Select the project of the non-OS or uITRON from HEW project, and select the build configuration of the
        appropriate function (Host mode or Peripheral mode) for the system under development from HEW build
        configuration in USB-BASIC-F/W and set the selected project in the active condition.
2. Sample application source code for executing data transfer is provided. These should be changed as needed to match
   the system under development.
   ⎯ Initialization of the control MCU, interrupt handlers, interrupt control, DTC or DMA control, etc. (See table
        3.1.)
   ⎯ For the non-OS, adjustments to the duration of the specified wait time functions (usbc_cpu_DelayXms()
        function, usbc_cpu_Delay1us() function)
   ⎯ For the non-OS, settings of functions that disable or enable USB-related interrupts in order to use the scheduler
        function (usb_cstd_IntDisable() function, usb_cstd_IntEnable() function)
        The USB interrupt disable function (usb_cstd_IntDisable() function) and USB interrupt enable function
        (usb_cstd_IntEnable() function) disable and enable, respectively. Make any necessary changes to the settings to
        match the MCU being used.
3. For using R8A66597, it is necessary to make changes to the hardware settings in the usb_cstd_Pinconfig function in
   r_usb_cSignal.c to match the system under development. Make sure to refer to section 5 regarding the definitions
   for the settings.
   ⎯ External bus operating voltage (set by user-defined information)
   ⎯ FIFO access endian specification (common with CPU endian mode: set by user-defined information)
   ⎯ Interrupt pin operation level
   ⎯ DMA pin operation level
   ⎯ BRDY interrupt operating mode
   ⎯ SOF pin operating mode
   ⎯ Low-power sleep operation specification (set by user-defined information)
4. Some files must be customized by the customer.
   ⎯ Refer to 5, User-Defined Information, and make appropriate changes to the user settings.
5. Debug Information Output Function
   ⎯ Make the appropriate settings in the file r_usbc_cMacPrint.h to enable or disable output of debug information.
        (Debug information can be output by creating a serial driver, or the like.)




R01AN0512EJ0110 Rev.1.10                                                                              Page 10 of 126
Jun 10, 2011
USB Basic Firmware
Table 3.1    List of Functions
Type           Function                                                          Description
void           usb_cstd_TargetInit(void)                                         System initialization
void           usb_cstd_UsbIntHand(void)                                         USB interrupt handler
void           usb_cstd_Dma0/1IntHand(void)                                      DTC/DMA interrupt handler
void           usbc_cpu_UsbintInit(void)                                         USB interrupt enable
void           usbc_cpu_DmaintInit(void)                                         DTC/DMA interrupt enable
uint16_t       usb_cstd_D0fifo2BufStartDma(uint32_t SourceAddr)                  DTC/DMA read start
uint16_t       usb_cstd_Buf2D0fifoStartDma(uint32_t DistAddr)                    DTC/DMA write start
void           usb_cstd_StopDma(void)                                            DTC/DMA stop
void           usb_cstd_IntEnable(void)                                          USB interrupt enable for
                                                                                 scheduler function of non-OS
void           usb_cstd_IntDisable(void)                                         USB interrupt disable for
                                                                                 scheduler function of non-OS
void           usbc_cpu_Delay1us(uint16_t time)                                  1us delay
void           usbc_cpu_DelayXns(uint16_t time)                                  1ms delay


  3.3        Creating HDCD and PDCD Tasks
USB-BASIC-F/W includes sample application source code for executing data transfer, it is necessary to create HDCD
or PDCD tasks to match the system under development. It must also be configured to enable control of the scheduler
function of the non-OS firmware.
For the non-OS, HDCD or PDCD tasks should be configured to run USBC_TRCV_MSG at the start of processing, and
in case of USBC_NG, to end the function.
For the non-OS, the following processing routines must be added to HDCD to enable control by the scheduler function.
Refer to the sample application function (usb2_hstd_MainTask() function).
1. Class check processing (to check the class driver during enumeration)
2. Initialization processing
3. Enumeration waits processing (so that when multiple devices are attached, the other devices wait until enumeration
   of the current device ends)
   Note: RX62N does not require this processing.
4. Task processing (created to match the system)

For non-OS, the following processing routines must be added to PDCD to enable control by the scheduler function.
Refer to the sample function (usb_pstd_MainTask() function).
5. Task processing (created to match the system)




R01AN0512EJ0110 Rev.1.10                                                                             Page 11 of 126
Jun 10, 2011
USB Basic Firmware

                     HDCD_Task


                                        No
                 USBC_TRCV_MSG?


                            Yes
                                                                  R8A66597 only
                  Processing contents
                                                      USB_MSG              USB_MSG          USB_MSG
                              USB_MSG_CLS_            _CLS_INIT            _CLS_WAIT        _CLS_TASK
                              CHECKREQUEST

                    1. Class check           2. Initialization     3. Enumeration        4. Task
                      processing               processing          wait processing     processing
                     enumeration




                        Return




                     PDCD_Task



                 USBC_TRCV_MSG ?



                        5. Task
                      processing


                        Return


                                   Figure 3.1 PDCD/HDCD Sequence for non-OS



  3.4         Note
The customer will need to make a variety of customizations, for example designating classes, issuing vendor-specific
requests, making settings with regard to the communication speed or program capacity, or making individual settings
that affect the user interface.
Note: USB-BASIC-F/W is not guaranteed to provide USB communication operation. The customer should verify
      operation when utilizing it in a system and confirm the ability to connect to a variety of different types of
      devices.




R01AN0512EJ0110 Rev.1.10                                                                                Page 12 of 126
Jun 10, 2011
USB Basic Firmware

4.     User-Defined Macros
     4.1       Overview
USB-BASIC-F/W includes macros for hardware register access (including FIFO access), so an executable file
customized to the customer’s requirements can be generated by rewriting the macro header files. Make appropriate
changes to the macros for accessing the registers and FIFOs to match the system under development. The macros
comprise the six types listed below. Scheduler macros are defined in (r_usbc_cMacSystemcall.h), debug output macros
in (r_usbc_cMacPrint.h), and register access macros in (r_usb_cMacUsr.h).
1.   Non-OS scheduler macros
2.   uITRON system call macros
3.   Debug output macros
4.   Register and FIFO data register read/write macros
5.   Register bit set/clear/modify macros
6.   Status register bit clear macro
7.   Status register bit set macro


4.1.1          Non-OS Scheduler Macros
USB-BASIC-F/W includes the file r_usbc_cScheduler.c, which contains functions for registering the scheduler macros
USBC_SND_MSG, USBC_ISND_MSG, USBC_WAI_MSG, USBC_TRCV_MSG, USBC_PGET_BLK, and
USBC_REL_BLK. Functions are registered to scheduler macros in r_usbc_cMacSystemcall.h.
[Function registration example]
     #define USBC_SND_MSG(ID, MESS)    usbc_cstd_SndMsg((uint8_t)ID,(USBC_MSG_t*)MESS)
     #define USBC_ISND_MSG(ID, MESS)   usbc_cstd_iSndMsg((uint8_t)ID,(USBC_MSG_t*)MESS)
     #define USBC_WAI_MSG(ID, MESS, TM)
                            usbc_cstd_WaiMsg((uint8_t)ID, (USBC_MSG_t*)MESS, (uint16_t)TM)
     #define USBC_TRCV_MSG(ID, MESS, TM)
                            usbc_cstd_RecMsg((uint8_t)ID,(USBC_MSG_t**)MESS,(USBC_TM_t)TM)
     #define USBC_PGET_BLK(ID, BLK)    usbc_cstd_PgetBlk((uint8_t)ID,(USBC_MH_t*)BLK)
     #define USBC_REL_BLK(ID, BLK)     usbc_cstd_RelBlk((uint8_t)ID,(USBC_MH_t)BLK)

[USB_NG registration example]
     #define   USBC_CRE_TSK(ID,INFO)           USBC_NG




R01AN0512EJ0110 Rev.1.10                                                                           Page 13 of 126
Jun 10, 2011
USB Basic Firmware

4.1.2       uITRON System Call Macro
The uITRON system call macro is shown below.
Modify the code as necessary to match the ITRON version used.
Note that ITRON macros are redefined for USB-BASIC-F/W in the file r_usbc_cMacSystemcall.h, so the ITRON
macros are defined by conditional compilation even when ITRON is not used. Therefore, this file should be also be
modified to match the ITRON version used.
  #define    USBC_CRE_TSK(ID,INFO)                 cre_tsk(   (USBC_ID_t)ID, (USBC_TSK_t*)INFO )
  #define    USBC_DEL_TSK(ID)                      del_tsk(   (USBC_ID_t)ID )
  #define    USBC_STA_TSK(ID,CODE)                 sta_tsk(   (USBC_ID_t)ID, (USBC_VI_t)CODE )
  #define    USBC_ACT_TSK(ID)                      act_tsk(   (USBC_ID_t)ID )
  #define    USBC_TER_TSK(ID)                      ter_tsk(   (USBC_ID_t)ID )
  #define    USBC_EXT_TSK()                        ext_tsk(   )
  #define    USBC_REF_TST(ID, STS)                 ref_tst(   (USBC_ID_t)ID, (USBC_RTST_t*)STS )

  #define    USBC_DLY_TSK(TIME)                    dly_tsk( (USBC_RT_t)TIME )

  #define    USBC_CRE_MBX(ID, INFO)               cre_mbx( (USBC_ID_t)ID, (USBC_MBX_t*)INFO )
  #define    USBC_DEL_MBX(ID)                     del_mbx( (USBC_ID_t)ID )
  #define    USBC_SND_MSG(ID, MESS)               snd_mbx( (USBC_ID_t)ID, (USBC_MSG_t*)MESS )
  #define    USBC_ISND_MSG(ID, MESS)              isnd_mbx( (USBC_ID_t)ID, (USBC_MSG_t*)MESS )
  #define    USBC_RCV_MSG(ID, MESS)               rcv_mbx( (USBC_ID_t)ID, (USBC_MSG_t**)MESS )
  #define    USBC_PRCV_MSG(ID, MESS)              prcv_mbx( (USBC_ID_t)ID, (USBC_MSG_t**)MESS )
  #define    USBC_TRCV_MSG(ID, MESS, TM)          trcv_mbx( (USBC_ID_t)ID, (USBC_MSG_t**)MESS,
                                                  (USBC_TM_t)TM )

  #define    USBC_CRE_MPL(ID, INFO)                cre_mpf( (USBC_ID_t)ID, (USBC_MPL_t*)INFO )
  #define    USBC_DEL_MPL(ID)                      del_mpf( (USBC_ID_t)ID )
  #define    USBC_PGET_BLK(ID, BLK)                pget_mpf( (USBC_ID_t)ID, (USBC_MH_t*)BLK )
  #define    USBC_IPGET_BLK(ID, BLK)               ipget_mpf( (USBC_ID_t)ID, (USBC_MH_t*)BLK )
  #define    USBC_REL_BLK(ID, BLK)                 rel_mpf( (USBC_ID_t)ID, (USBC_MH_t)BLK )

  #define    USBC_CRE_SEM(ID, INFO)                cre_sem(   (USBC_ID_t)ID, (USBC_SEM_t*)INFO )
  #define    USBC_WAI_SEM(ID)                      wai_sem(   (USBC_ID_t)ID )
  #define    USBC_POL_SEM(ID)                      pol_sem(   (USBC_ID_t)ID )
  #define    USBC_SIG_SEM(ID)                      sig_sem(   (USBC_ID_t)ID )

  #define    USBC_CRE_ALM(ID, INFO)                cre_alm(   (USBC_ID_t)ID, (USBC_ALM_t*)INFO )
  #define    USBC_STA_ALM(ID, TIME)                sta_alm(   (USBC_ID_t)ID, (USBC_RT_t)TIME )
  #define    USBC_STP_ALM(ID)                      stp_alm(   (USBC_ID_t)ID )
  #define    USBC_DEL_ALM(ID)                      del_alm(   (USBC_ID_t)ID )




R01AN0512EJ0110 Rev.1.10                                                                            Page 14 of 126
Jun 10, 2011
USB Basic Firmware

4.1.3       Debug Information Output Macros
This type of macro outputs debug information to a UART or display device. A serial driver or display device driver is
required.
  #define     USBC_SPRINTF0(FORM)                    fprintf(stderr,FORM)
  #define     USBC_SPRINTF1(FORM,x1)                 fprintf(stderr,FORM,x1)
  #define     USBC_SPRINTF2(FORM,x1,x2)              fprintf(stderr,FORM,x1,x2)
  #define     USBC_SPRINTF3(FORM,x1,x2,x3)           fprintf(stderr,FORM,x1,x2,x3)
  #define     USBC_SPRINTF4(FORM,x1,x2,x3,x4)        fprintf(stderr,FORM,x1,x2,x3,x4)
  #define     USBC_SPRINTF5(FORM,x1,x2,x3,x4,x5)     fprintf(stderr,FORM,x1,x2,x3,x4,x5)
  #define     USBC_SPRINTF6(FORM,x1,x2,x3,x4,x5,x6) fprintf(stderr,FORM,x1,x2,x3,x4,x5,x6)
  #define     USBC_SPRINTF7(FORM,x1,x2,x3,x4,x5,x6,x7)
                                                 fprintf(stderr,FORM,x1,x2,x3,x4,x5,x6,x7)
  #define     USBC_SPRINTF8(FORM,x1,x2,x3,x4,x5,x6,x7,x8)
                                                 fprintf(stderr,FORM,x1,x2,x3,x4,x5,x6,x7,x8)
  #define     USBC_PRINTF0(FORM)                     printf(FORM)
  #define     USBC_PRINTF1(FORM,x1)                  printf(FORM,x1)
  #define     USBC_PRINTF2(FORM,x1,x2)               printf(FORM,x1,x2)
  #define     USBC_PRINTF3(FORM,x1,x2,x3)            printf(FORM,x1,x2,x3)
  #define     USBC_PRINTF4(FORM,x1,x2,x3,x4)         printf(FORM,x1,x2,x3,x4)
  #define     USBC_PRINTF5(FORM,x1,x2,x3,x4,x5)      printf(FORM,x1,x2,x3,x4,x5)
  #define     USBC_PRINTF6(FORM,x1,x2,x3,x4,x5,x6) printf(FORM,x1,x2,x3,x4,x5,x6)
  #define     USBC_PRINTF7(FORM,x1,x2,x3,x4,x5,x6,x7)
                                                     printf(FORM,x1,x2,x3,x4,x5,x6,x7)
  #define     USBC_PRINTF8(FORM,x1,x2,x3,x4,x5,x6,x7,x8)
                                                     printf(FORM,x1,x2,x3,x4,x5,x6,x7,x8)

If no debug information will be output, the following lines should be commented out as shown.
  //#define         USBC_DEBUGSIO_PP                  /* enable serial out (printf) */
  //#define         USBC_DEBUGLCD_PP                  /* enable display out (lprintf) */



4.1.4       Register and FIFO Data Register Read/Write Macros
This type of macro performs read or write access to registers or FIFO port registers.
  #define     USB_RD( r, v )           do { (( v ) = ( USB_IP.r.WORD )); } while(0)
  #define     USB_WR( r, v )           do { (( USB_IP.r.WORD ) = ( v )); } while(0)

  #define     USB_RDW( r, v      )   do    {   ((   v ) = ( USB_IP.r     ));   }   while(0)
  #define     USB_WRW( r, v      )   do    {   ((   USB_IP.r ) = ( v     ));   }   while(0)
  #define     USB_RD_FF( r,      v ) do    {   ((   v ) = ( USB_IP.r     ));   }   while(0)
  #define     USB_WR_FF( r,      v ) do    {   ((   USB_IP.r ) = ( v     ));   }   while(0)




R01AN0512EJ0110 Rev.1.10                                                                              Page 15 of 126
Jun 10, 2011
USB Basic Firmware

4.1.5        Register Bit Set/Clear/Modify Macros
This type of macro sets, clears, or modifies the value of bits in registers.
Each macro is written to accommodate the RMW (Read Modify Write) instruction, and it uses a register and FIFO data
register read/write macro of the type mentioned above.
Notes: 1. These macros do not need to be modified by the customer.
       2. Do not use the bit clear macro to clear bits in status registers.
  /* set bit(s) of USB register                   */
  /* r : USB register                             */
  /* v : value to set                             */
  #define USB_SET_PAT( r, v )                     do { (( USB_IP.r.WORD ) |= ( v )); } while(0)

  /* reset bit(s) of USB register                 */
  /* r : USB register                             */
  /* m : bit pattern to reset                     */
  #define USB_CLR_PAT( r, m )                     do { (( USB_IP.r.WORD ) &= ( (uint16_t)(~(m)) )); }
  while(0)

  /* modify bit(s) of USB register                */
  /* r : USB register                             */
  /* v : value to set                             */
  /* m : bit pattern to modify                    */
  #define USB_MDF_PAT( r, v, m )                  do {                                                  
                                                         uint16_t mtmp;                                 
                                                         USB_RD( r, mtmp );                             
                                                         mtmp &= ( (uint16_t)(~(m)) );                  
                                                         mtmp |= ( (uint16_t)(v & m) );                 
                                                         USB_WR( r, mtmp );                             
                                                  } while(0)



4.1.6        Status Register Bit Clear Macro
This macro clears bits in status registers.
This macro is written to accommodate the RMW (Read Modify Write) instruction, and it uses a register and FIFO data
register read/write macro of the type mentioned above. This macro is designed to avoid deleting status bits that have
changed during the execution of the RMW instruction.
Notes: 1. This macro does not need to be modified by the customer.
       2. This macro should only be used for status registers where writing 1 has no effect.
  /* reset bit(s) of USB status   */
  /* r : USB register             */
  /* m : bit pattern to reset     */
  #define USB_CLR_STS( r, m ) USB_WR( r, ( (uint16_t)(~(m)) ) )




R01AN0512EJ0110 Rev.1.10                                                                             Page 16 of 126
Jun 10, 2011
USB Basic Firmware

5.     User-Defined Information
     5.1      Overview
An executable file customized to the customer’s requirements can be generated by rewriting the user system definition
information file (r_usbc_cDefUsr.h) and user-defined information file (r_usb_cDefUsr.h) included in USB-BASIC-F/W.
The items listed below should be changed to match the system under development.


     5.2      User System Definition Information File (r_usbc_cDefUsr.h)
1. Target device designation
2. Installed USB-IP type designation
3. 597IP function designation (number of Pipe)
4. 597IP function designation (number of Device Address)
5. 597IP function designation (buffer size)
6. Transfer speed designation
7. Bus width designation
8. USB port designation
9. External bus operating voltage designation
10. Oscillating frequency of connected resonator
11.      Operating environment designation
12.      Create Systemcall designation (uITRON)
13. CPU byte endian designation
14. DTC/DMA designation
15. Low Power Mode designation
16. PID = NAK setting at transfer end enable designation (peripheral function mode)
17. Software retry count at pipe no-response (host function mode)
18. Control read data buffer size (host function mode)
19. Device address initial value (host function mode)
20. Hub down port count (host function mode)


5.2.1       Target Device Designation
The target device may be specified as either of the following two options.
1) USBC_ASSP_PP: R8A66597
2) USBC_RX600_PP: RX62N or RX630

Example: RX62N or RX630
  #define     USBC_TARGET_CHIP_PP              USBC_RX600_PP

This setting is selected by the macro definition of HEW project in USB-BASIC-F/W.
The macro definition is selected from option category in Standard toolchain of compiler tab.

5.2.2       Installed USB-IP Type Designation
The USB-IP type may be specified as either of the following three options.
1) USBC_592IP_PP: Installed 592IP
2) USBC_596IP_PP: Installed 596IP
3) USBC_597IP_PP: Installed 597IP

Example: Installed 597IP
  #define     USBC_IPSEL_PP           USBC_597IP_PP




R01AN0512EJ0110 Rev.1.10                                                                           Page 17 of 126
Jun 10, 2011
USB Basic Firmware
5.2.3       597IP Function Designation (Number of Pipe)
The number of pipe may be specified as either of the following two options.
1) USBC_IP_PIPE_9_PP: 1-9 of PIPE use
2) USBC_IP_PIPE_7_PP: 1-7 of PIPE use

Example: 1-9 of PIPE use
  #define     USBC_IP_PIPE_PP              USBC_IP_PIPE_9_PP



5.2.4       597IP Function Designation (Number of Device Address)
The number of device address may be specified as either of the following two options.
1) USBC_IP_DEVADD_A_PP: 10 device address use
2) USBC_IP_DEVADD_5_PP: 5 device address use

Example: 5 device address use
  #define     USBC_IP_DEVADD_PP            USBC_IP_DEVADD_5_PP



5.2.5       597IP Function Designation (Buffer Size)
The buffer type may be specified as either of the following two options.
1) USBC_PIPEBUFF_FIX_PP: PIPEBUF is fixation
2) USBC_PIPEBUFF_CHANGE_PP: PIPEBUF is changeable

Example: PIPEBUF is fixation
  #define     USBC_PIPEBUF_MODE_PP             USBC_PIPEBUF_CHANGE_PP



5.2.6       Transfer Speed Designation
The target speed may be specified as either of the following two options.
1) USBC_HS_PP: High-Speed support
2) USBC_FS_PP: Full-Speed support

Example: Full-Speed support
  #define     USBC_SPEEDSEL_PP             USBC_FS_PP



5.2.7       Bus Width Designation
The bus width may be specified as either of the following two options.
1) USBC_BUSSIZE_16_PP: 16 bits
2) USBC_BUSSIZE_32_PP: 32 bits

Example: 16 bits
  #define     USBC_BUSSIZE_PP              USBC_BUSSIZE_16_PP




R01AN0512EJ0110 Rev.1.10                                                                       Page 18 of 126
Jun 10, 2011
USB Basic Firmware

5.2.8       USB Port Designation
The USB port may be specified as either of the following two options.
1) USBC_1PORT_PP: 1 USB Port use
2) USBC_2PORT_PP: 2 USB Ports use

Example: 1 USB Port use
  #define     USBC_PORTSEL_PP             USBC_1PORT_PP



5.2.9       Operating Environment Designation
The operating environment may be specified as either of the following two options.
1) USBC_FW_OS_PP: OS support
2) USBC_FW_NONOS_PP: No OS support

Example: No OS support
  #define     USBC_FW_PP         USBC_FW_NONOS_PP

This setting is selected by the macro definition of HEW project in USB-BASIC-F/W.
The macro definition is selected from option category in Standard toolchain of compiler tab.


5.2.10      External Bus Operating Voltage Designation
The external bus operating voltage may be specified as either of the following two options.
1) USBC_VIF1: 1.8 V applied to external bus pins.
2) USBC_VIF3: 3.3 V external bus pins.

Example: 3.3 V
  #define     USB_LDRVSEL        USBC_VIF3

For the RX62N and RX630, use the USBC_VIF3 setting.


5.2.11      Oscillating Frequency of Connected Resonator
Oscillating frequency of connected resonator may be specified as one of the following three options.
1) USBC_XTAL48: 48 MHz resonator connected.
2) USBC_XTAL24: 24 MHz resonator connected.
3) USBC_XTAL12: 12 MHz resonator connected.

Example: 24 MHz resonator
  #define     USBC_XINSEL       USBC_XTAL24

For the RX62N and RX630. Use the USBC_XTAL24 setting.




R01AN0512EJ0110 Rev.1.10                                                                               Page 19 of 126
Jun 10, 2011
USB Basic Firmware

5.2.12      Create System call Designation (uITRON)
It may be specified as either of the following two options that the Task Creation System call is supported or not
supported.
1) USBC_OS_CRE_USE_PP: Task Creation System call support
2) USBC_OS_CRE_NOTUSE_PP: No Task Creation System call support

Example: No Task Creation System call support
  #define     USBC_OS_CRE_MODE_PP               USBC_OS_CRE_NOTUSE_PP



5.2.13      CPU Byte Endian Designation
The CPU byte endian may be specified as either of the following two options.
This setting is for CPU access to FIFO.
1) USBC_BYTE_LITTLE_PP: Little Endian (Definition from upper byte)
2) USBC_BYTE_BIG_PP: Big Endian (Definition from under byte)

Example: Little endian
  #define     USBC_CPUBYTE_PP              USBC_BYTE_LITTLE_PP



5.2.14      DTC/DMA Designation
The DTC/DMA may be specified as either of the following two options.
1) USBC_TRANS_DMA_PP: DMA
2) USBC_TRANS_DTC_PP: DTC

Example: DTC
  #define     USBC_TRANS_MODE_PP           USBC_TRANS_DTC_PP

The RX62N and RX630 support only DTC. Use the USBC_TRANS_DTC_PP setting.


5.2.15      Low Power Mode Designation
The low power mode may be specified as either of the following two options.
1) USBC_LPWR_NOT_USE_PP: Not low power mode
2) USBC_ LPWR_USE_PP: Low power mode

Example: Not low power mode
  #define     USBC_LPWR_MODE_PP            USBC_LPWR_NOT_USE_PP

For the R8A66597, use the USBC_LPWR_NOT_USE_PP setting.


5.2.16      PID = NAK Setting at Transfer End Enable Designation (Peripheral Function Mode)
It may be specified as either of the following two options that the PID = NAK set or not set at transfer end enable.
1) USBC_NONPERIODIC_PP: PID = NAK
2) USBC_PERIODIC_PP: No PID = NAK

Example: PID = NAK
  #define     USBC_PERIODIC_MODE_PP             USBC_PERIODIC_PP




R01AN0512EJ0110 Rev.1.10                                                                                Page 20 of 126
Jun 10, 2011
USB Basic Firmware
5.2.17       Software Retry Count at Pipe No-Response (Host Function Mode)
It is necessary to specify the number of software retries when a no-response condition occurs during a transfer.
Example: Up to one retry by USB-BASIC-F/W at pipe no-response
  #define       USBC_PIPEERR 1u



5.2.18       Control Read Data Buffer Size (Host Function Mode)
It is necessary to specify the data buffer size when a control read transfer is received.
Example: 20-byte device descriptor, 256-byte configuration descriptor
  #define       USBC_DEVICESIZE         20u
  #define       USBC_CONFIGSIZE         256u



5.2.19       Device Address (Host Function Mode)
It is necessary to specify the device address of the device connected to PORT0.
Example: Device address starts from 2.
  #define       USBC_DEVICEADDR         2u

For the RX62N, addresses in the range 1 to 5 may be specified.
For the R8A66597, addresses in the range 1 to 10 may be specified.


5.2.20       Hub Down Port Count (Host Function Mode)
It is necessary to specify the number of hub down ports that can be connected.
Example: Connected hub has 4 down ports.
  #define     USBC_HUBDOWNPORT          4u




R01AN0512EJ0110 Rev.1.10                                                                                Page 21 of 126
Jun 10, 2011
USB Basic Firmware

5.2.21        User System Definition Information for Each Devices
The user system definition information for each device is shown below.


Table 5.1      For the RX62N, the user system definition information (r_usbc_cDefUsr.h)
Section        Flag   Set Object                        Set Value                      Remarks
Number         *                                        (o: default setting)
5.2.1          -      USBC_TARGET_CHIP_PP               o USBC_RX600_PP                This setting is
                                                                                       selected by the
                                                                                       macro definition
                                                                                       of HEW project.
5.2.2          -      USBC_IPSEL_PP                     o   USBC_597IP_PP
5.2.3          -      USBC_IP_PIPE_PP                   o   USBC_IP_PIPE_9_PP
5.2.4          -      USBC_IP_DEVADD_PP                 o   USBC_IP_DEVADD_5_PP
5.2.5          -      USBC_PIPEBUF_MODE_PP              o   USBC_PIPEBUF_FIX_PP
5.2.6          -      USBC_SPEEDSEL_PP                  o   USBC_FS_PP
5.2.7          -      USBC_BUSSIZE_PP                   o   USBC_BUSSIZE_16_PP
5.2.8          -      USBC_PORTSEL_PP                   o   USBC_1PORT_PP
5.2.9          -      USBC_LDRVSEL                      o   USBC_VIF3
                      (NOT_USED)
5.2.10         -      USBC_XINSEL                       o USBC_XTAL24
5.2.11         O      USBC_FW_PP                          USBC_FW_NONOS_PP             This setting is
                                                          USBC_FW_OS_PP                selected by the
                                                                                       macro definition
                                                                                       of HEW project.
5.2.12         O      USBC_OS_CRE_MODE_PP               o USBC_OS_CRE_NOTUSE_PP        If
                                                          USBC_OS_CRE_USE_PP           USB_C_FW_NO
                                                                                       NOS_PP setting
                                                                                       in 5,2,11, use
                                                                                       the default
                                                                                       setting.
                                                                                       If RI600 is used,
                                                                                       use the default
                                                                                       setting.
5.2.13         O      USBC_CPUBYTE_PP                         o USBC_BYTE_LITTLE_PP
                                                                  USBC_BYTE_BIG_PP
5.2.14          -         USBC_TRANS_MODE_PP                  o USBC_TRANS_DTC_PP
5.2.15          O         USBC_LPWR_MODE_PP                   o USBC_LPWR_NOT_USE_PP
                                                                  USBC_LPWR_USE_PP
5.2.16          O         USBC_PERIODIC_MODE_P o USBC_NONPERIODIC_PP
                          P                                       USBC_PERIODIC_PP
5.2.17          O         USBC_PIPEERROR                      o 1u
5.2.18          O         USBC_DEVICESIZE                     o 20u
                O         USBC_CONFIGSIZE                     o 256u
5.2.19          O         USBC_DEVICEADDR                     o 1u
5.2.20          O         USBC_HUBDOWNPORT                    o 4u
* : Flag   - : Not selected(Use the default setting.), O: Select from Set Value.




R01AN0512EJ0110 Rev.1.10                                                                  Page 22 of 126
Jun 10, 2011
USB Basic Firmware
Table 5.2      For the RX630, the user system definition information (r_usbc_cDefUsr.h)
Section        Flag   Set Object                    Set Value                          Remarks
Number         *                                    (o: default setting)
5.2.1          -      USBC_TARGET_CHIP_PP           o USBC_RX600_PP                    This setting is
                                                                                       selected by the
                                                                                       macro definition
                                                                                       of HEW project.
5.2.2          -      USBC_IPSEL_PP                 o   USBC_597IP_PP
5.2.3          -      USBC_IP_PIPE_PP               o   USBC_IP_PIPE_9_PP
5.2.4          -      USBC_IP_DEVADD_PP             o   USBC_IP_DEVADD_5_PP
5.2.5          -      USBC_PIPEBUF_MODE_PP          o   USBC_PIPEBUF_FIX_PP
5.2.6          -      USBC_SPEEDSEL_PP              o   USBC_FS_PP
5.2.7          -      USBC_BUSSIZE_PP               o   USBC_BUSSIZE_16_PP
5.2.8          -      USBC_PORTSEL_PP               o   USBC_1PORT_PP
5.2.9          -      USBC_LDRVSEL                  o   USBC_VIF3
                      (NOT_USED)
5.2.10         -      USBC_XINSEL                   o USBC_XTAL24
5.2.11         O      USBC_FW_PP                      USBC_FW_NONOS_PP                 This setting is
                                                      USBC_FW_OS_PP                    selected by the
                                                                                       macro definition
                                                                                       of HEW project.
5.2.12         O      USBC_OS_CRE_MODE_PP           o USBC_OS_CRE_NOTUSE_PP            If
                                                      USBC_OS_CRE_USE_PP               USB_C_FW_NO
                                                                                       NOS_PP setting
                                                                                       in 5,2,11, use
                                                                                       the default
                                                                                       setting.
                                                                                       If RI600 is used,
                                                                                       use the default
                                                                                       setting.
5.2.13         O      USBC_CPUBYTE_PP                         o USBC_BYTE_LITTLE_PP
                                                                  USBC_BYTE_BIG_PP
5.2.14          -         USBC_TRANS_MODE_PP                  o USBC_TRANS_DTC_PP
5.2.15          O         USBC_LPWR_MODE_PP                   o USBC_LPWR_NOT_USE_PP
                                                                  USBC_LPWR_USE_PP
5.2.16          O         USBC_PERIODIC_MODE_P o USBC_NONPERIODIC_PP
                          P                                       USBC_PERIODIC_PP
5.2.17          -         USBC_PIPEERROR                      o 1u
5.2.18          -         USBC_DEVICESIZE                     o 20u
                -         USBC_CONFIGSIZE                     o 256u
5.2.19          -         USBC_DEVICEADDR                     o 1u
5.2.20          -         USBC_HUBDOWNPORT                    o 4u
* : Flag   - : Not selected(Use the default setting.), O: Select from Set Value.




R01AN0512EJ0110 Rev.1.10                                                                  Page 23 of 126
Jun 10, 2011
USB Basic Firmware
Table 5.3      For the R8A66597, the user system definition information (r_usbc_cDefUsr.h)
Section       Flag    Set Object                    Set Value                           Remarks
Number        *                                     (o: default setting)
5.2.1         -       USBC_TARGET_CHIP_PP           o USBC_ASSP_PP                      This setting is
                                                                                        selected by the
                                                                                        macro definition
                                                                                        of HEW project.
5.2.2         -       USBC_IPSEL_PP                 o USBC_597IP_PP
5.2.3         -       USBC_IP_PIPE_PP               o USBC_IP_PIPE_9_PP
5.2.4         -       USBC_IP_DEVADD_PP             o USBC_IP_DEVADD_A_PP
5.2.5         -       USBC_PIPEBUF_MODE_PP          o USBC_PIPEBUF_CHANGE_PP
5.2.6         -       USBC_SPEEDSEL_PP              o USBC_HS_PP
5.2.7         -       USBC_BUSSIZE_PP               o USBC_BUSSIZE_16_PP
5.2.8         O       USBC_PORTSEL_PP               o USBC_2PORT_PP
                                                      USBC_1PORT_PP
5.2.9         O       USBC_LDRVSEL                    USBC_VIF1
                      (NOT_USED)                    o USBC_VIF3
5.2.10        O       USBC_XINSEL                     USBC_XTAL12
                                                    o USBC_XTAL24
                                                      USBC_XTAL48
5.2.11        -       USBC_FW_PP                    o USBC_FW_NONOS_PP                  This setting is
                                                                                        selected by the
                                                                                        macro definition
                                                                                        of HEW project.
5.2.12        -       USBC_OS_CRE_MODE_PP                     o USBC_OS_CRE_NOTUSE_PP
5.2.13        O       USBC_CPUBYTE_PP                         o USBC_BYTE_LITTLE_PP
                                                                  USBC_BYTE_BIG_PP
5.2.14          -         USBC_TRANS_MODE_PP                  o USBC_TRANS_DTC_PP
5.2.15          -         USBC_LPWR_MODE_PP                   o USBC_LPWR_NOT_USE_PP
5.2.16          O         USBC_PERIODIC_MODE_P o USBC_NONPERIODIC_PP
                          P                                       USBC_PERIODIC_PP
5.2.17          O         USBC_PIPEERROR                      o 1u
5.2.18          O         USBC_DEVICESIZE                     o 20u
                O         USBC_CONFIGSIZE                     o 256u
5.2.19          O         USBC_DEVICEADDR                     o 1u
5.2.20          O         USBC_HUBDOWNPORT                    o 4u
* : Flag   - : Not selected(Use the default setting.), O: Select from Set Value.




R01AN0512EJ0110 Rev.1.10                                                                  Page 24 of 126
Jun 10, 2011
USB Basic Firmware

     5.3       User-Defined Information File (r_usb_cDefUsr.h)
1.   USB Function designation
2.   Power Consumption Control Function designation
3.   Auto Clock Mode designation
4.   Sleep Mode designation
5.   Hardware address designation
6.   Hi-speed operation enable/disable


5.3.1          USB Function Designation
The hardware function may be specified as one of the following three options.
1) USBC_HOST_PP: Used as USB host.
2) USBC_PERI_PP: Used as USB peripheral.
3) USBC_HOST_PERI_PP: Used as both USB host and USB peripheral.

Example: USB peripheral
     #define   USBC_FUNCSEL_PP             USBC_PERI_PP



5.3.2          Power Consumption Control Function Designation
It is necessary to specify the power consumption control function.
Reference: The power consumption control function may be specified as one of the following three options.
1) USBC_NOT_STOP_PP: The power consumption control is not used (clock does not stop).
2) USBC_XCKE_USE_PP: The power consumption control function is used with the clock in the stopped state.
3) USBC_PCUT_USE_PP: The low-power sleep state is used. (This setting is for M66592 and M66596.)
Example: The power consumption control is not used
     #define   USBC_OSCSEL_PP         USBC_CLK_NOT_STOP_PP

This function is not used by the RX62N and RX630. Use the USBC_CLK_NOT_STOP_PP setting.
For the R8A66597, use the USBC_NOT_STOP_PP or the USBC_XCKE_USE_PP setting.


5.3.3          Auto Clock Mode Designation
The hardware function may be specified as one of the following two options.
1) USBC_ATCKM_NOT_USE_PP: No auto clock mode
2) USBC_ATCKM_USE_PP: Auto clock mode (This setting is for M66592 and M66596.)

Example: No auto clock mode
     #define   USBC_ATCKMSEL_PP            USBC_ATCKM_NOT_USE_PP

This function is not used by the RX62N, RX630 and R8A66597. Use the USBC_ATCKM_NOT_USE_PP setting.




R01AN0512EJ0110 Rev.1.10                                                                            Page 25 of 126
Jun 10, 2011
USB Basic Firmware

5.3.4        Sleep Mode Designation
The sleep mode may be specified as one of the following two options.
1) USBC_LPSM_DISABLE_PP: No sleep mode
2) USBC_LPSM_ENABLE_PP: Sleep mode (The setting is for R8A66597.)

Example: No sleep mode
  #define     USBC_LPWRSEL_PP               USBC_LPSM_DISABLE_PP

This function is not used by the RX62N and RX630. Use the USBC_LPSM_DISABLE_PP setting.


5.3.5        Hardware Address Designation
It is necessary to specify the standard address for accessing the hardware.
For each register, the address is specified as an offset from the designated standard address.
Example: 0x05000000
  #define     USBC_BASE (uint32_t)(0x05000000)

This setting is not used by the RX62N and RX630.
(#define USB0 specifies the address.)


5.3.6        Hi-Speed Operation Enable/Disable
Either of the following two options may be selected for hi-speed operation.
1) USBC_HS_DISABLE: Full- or low-speed operation will be selected automatically according to the connected
   device.
2) USBC_HS_ENABLE: Hi-, full-, or low-speed operation will be selected automatically according to the connected
   device.

Example: Disabled
  #define     USBC_HSESEL         USBC_HS_DISABLE

For the RX62N and RX630, select USBC_HS_DISABLE.




R01AN0512EJ0110 Rev.1.10                                                                            Page 26 of 126
Jun 10, 2011
USB Basic Firmware

5.3.7       User System Definition Information for Each Device
The user system definition information for each device is shown below.


Table 5.4    For the RX62N, the user system definition information (r_usb_cDefUsr.h)
Section      Flag    Set Object                         Set Value                      Remarks
Number       *                                          (o: default setting)
5.3.1        O       USBC_FUNCSEL_PP                        USBC_HOST_PP               This setting is
                                                            USBC_PERI_PP               selected by the
                                                            USBC_HOST_PERI_PP          macro definition
                                                                                       of HEW project.
5.3.2         -         USBC_OSCSEL_PP                      o USBC_CLK_NOT_STOP_PP
5.3.3         -         USBC_ATCKMSEL_PP                    o USBC_ATCKM_NOT_USE_PP
5.3.4         -         USBC_LPWRSEL_PP                     o USBC_LPWR_DISABLE_PP
5.3.5         -         USB_BASE                            o 0x000A0000
5.3.6         -         USB_HSESEL                          o USBC_HS_DISABLE
* : Flag - : Not selected(Use the default setting.), O: Select from Set Value.


Table 5.5    For the RX630, the user system definition information (r_usb_cDefUsr.h)
Section      Flag    Set Object                         Set Value                      Remarks
Number       *                                          (o: default setting)
5.3.1        -       USBC_FUNCSEL_PP                        USBC_PERI_PP               This setting is
                                                                                       selected by the
                                                                                       macro definition
                                                                                       of HEW project.
5.3.2         -         USBC_OSCSEL_PP                      o USBC_CLK_NOT_STOP_PP
5.3.3         -         USBC_ATCKMSEL_PP                    o USBC_ATCKM_NOT_USE_PP
5.3.4         -         USBC_LPWRSEL_PP                     o USBC_LPWR_DISABLE_PP
5.3.5         -         USB_BASE                            o 0x000A0000
5.3.6         -         USB_HSESEL                          o USBC_HS_DISABLE
* : Flag - : Not selected(Use the default setting.), O: Select from Set Value.


Table 5.6    For the R8A66597, the user system definition information (r_usb_cDefUsr.h)
Section      Flag    Set Object                         Set Value                      Remarks
Number       *                                          (o: default setting)
5.3.1        O       USBC_FUNCSEL_PP                        USBC_HOST_PP               This setting is
                                                            USBC_PERI_PP               selected by the
                                                                                       macro definition
                                                                                       of HEW project.
5.3.2        O       USBC_OSCSEL_PP                         o USBC_CLK_NOT_STOP_PP
                                                                USBC_CLK_XCKE_USE_PP
5.3.3         -         USBC_ATCKMSEL_PP                    o USBC_ATCKM_NOT_USE_PP
5.3.4         O         USBC_LPWRSEL_PP                     o USBC_LPWR_DISABLE_PP
                                                                USBC_LPWR_ENABLE_PP
5.3.5         O         USB_BASE                            o 0x05000000
5.3.6         O         USB_HSESEL                          o USBC_HS_ENABLE
                                                                USBC_HS_DISABLE
* : Flag - : Not selected(Use the default setting.), O: Select from Set Value.




R01AN0512EJ0110 Rev.1.10                                                                 Page 27 of 126
Jun 10, 2011
USB Basic Firmware

6.     Workspace
     6.1      Overview
The workspace of USB-BASIC-F/W is described below.
Workspace of USB-BASIC-F/W includes two projects.
1. NonOS_StdFw: non-OS
2. Itron_StdFw: uITRON (R8A66597 is not supported)
And, USB-BASIC-F/W includes build configurations.
[For the RX62N]
1. PORT0_P: PORT0 is Peripheral mode
2. PORT1_H: PORT1 is Host mode
3. PORT0_P_PORT1_H:USB0 is Peripheral mode and USB1 is Host mode

[For the RX630]
4. RX630_PORT0_P: PORT0 is Peripheral mode

[For the R8A66597]
5. ASSP_PERI: PORT0 is Peripheral mode
6. ASSP_HOST: PORT1 is Host mode

Each configuration selects source files as compiled.
In peripheral function mode, USB-BASIC-F/W comprises two tasks, PCD and sample application, and a scheduler. In
host function mode, it comprises four tasks, HCD, MGR, HUB, and sample application, and a scheduler. Sample
application is run as tasks.




R01AN0512EJ0110 Rev.1.10                                                                        Page 28 of 126
Jun 10, 2011
USB Basic Firmware

  6.2        Structure of Files and folders
6.2.1       Folder Structure
The folder structure in which the files are provided in USB-BASIC-F/W is shown below. These provided files in USB-
BASIC-F/W include sample application and sample code of resource for hardware.
< HEW workspace: USBSTDFW >
(USB-BASIC-F/W)
    +⎯⎯⎯ USBSTDFW                                For USB0
    |     +⎯⎯⎯ class
    |     |       +⎯⎯⎯ hubd                      Sample hub driver
    |     |       +⎯⎯⎯ smpl                      USB standard request sample
    |     +⎯⎯⎯ include                           Common header file
    |     +⎯⎯⎯ USB20
    |             +⎯⎯⎯ HCD                       Host control driver
    |             +⎯⎯⎯ PCD                       Peripheral control driver
    |             +⎯⎯⎯ LIB                       Common library
    +⎯⎯⎯ USB2STDFW                               For USB1 (RX630 and R8A66597 are not used.)
     |                                           Structure is same to USBSTDFW
    +⎯⎯⎯ USBCSTDFW                               For USB0 and USB1
     |          +⎯⎯⎯ include                     Common header file
(The following is sample code)
    +⎯⎯⎯ RI600_4                                 For uITRON
     |          +⎯⎯⎯ config_Pstd                 For PORT0_P and RX630_PORT0_P
     |          +⎯⎯⎯ config_Hstd                 For PORT1_H
     |          +⎯⎯⎯ config_Cstd                 For PORT0_P_PORT1_H
    +⎯⎯⎯ HwResourceForUSB                        Resource for hardware
     |          +⎯⎯⎯ RX62N                       For RX62N
     |          +⎯⎯⎯ RX630                       For RX630
   +⎯⎯⎯ SmplMain
                +⎯⎯⎯ APL                         Sample application
                +⎯⎯⎯ Project                     Each projects




R01AN0512EJ0110 Rev.1.10                                                                          Page 29 of 126
Jun 10, 2011
USB Basic Firmware

6.2.2       List of Files
The files provided in USB-BASIC-F/W are listed below. The files of USB2STDFW folder are left out.


Table 6.1    List of Files
Folder           File Name                Description                                 Project
                                                                                      (O: Selected )
                                                                                      1) 2) 3) 4) 5) 6)
                                                                                      * * * * * *
HCD              r_usb_hControlRW.c  Control read/write processing                        O O        O
HCD              r_usb_hDriver.c     HCD task                                             O O        O
HCD              r_usb_hDriverAPI.c  HCD/MGR API functions                                O O        O
HCD              r_usb_hIntFIFO.c    INTR, INTN, BEMP interrupt                           O O        O
                                     processing
HCD              r_usb_hManager.c    MGR task                                             O    O              O
HCD              r_usb_hSignal.c     USB signal control, oscillation control              O    O              O
                                     processing
HCD              r_usb_hStdFunction. USB function extension library                       O    O              O
                 c                   functions
HCD              r_usb_hLibUSBIP.c   USB library functions                                O    O              O
PCD              r_usb_pControlRW.c Control read/write processing                     O        O      O   O
PCD              r_usb_pDriver.c     PCD task                                         O        O      O   O
PCD              r_usb_pDriverAPI.c  PCD API functions                                O        O      O   O
PCD              r_usb_pIntFIFO.c    INTR, INTN, BEMP interrupt                       O        O      O   O
                                     processing
PCD              r_usb_pSignal.c     USB signal control, oscillation control          O        O      O   O
                                     processing
PCD              r_usb_pStdRequest.c USB standard request responses                   O        O      O   O
PCD              r_usb_pStdFunction. USB function extension library                   O        O      O   O
                 c                   functions
PCD              r_usb_pLibUSBIP.c   USB library functions                            O        O      O   O
LIB              r_usb_cDataIO.c     Data read/write, FIFO access                     O   O    O      O   O   O
                                     processing
LIB              r_usb_cIntFIFO.c    INTR, INTN, BEMP interrupt                       O   O    O      O   O   O
                                     processing
LIB              r_usb_cIntHandler.c USB interrupt handler                            O   O    O      O   O   O
LIB              r_usb_cLibUSBIP.c   USB library functions                            O   O    O      O   O   O
LIB              r_usb_cSignal.c     USB signal control, oscillation control          O   O    O      O   O   O
                                     processing
LIB              r_usb_cStdFunction. USB function extension library                   O   O    O      O   O   O
                 c                   functions (host/peripheral mixed)
USBCSTDFW        r_usbc_cScheduler.c Scheduler control                                O   O    O      O   O   O
include          r_usbc_cDefUSBIP.h USB driver definitions                            O   O    O      O   O   O
include          r_usbc_cItron.h     System header file                               O   O    O      O   O   O
include          r_usbc_cKernelID.h  ID definitions (Task ID, etc.)                   O   O    O      O   O   O
include          r_usbc_cMacSystem Macro definitions (scheduler macros)               O   O    O      O   O   O
                 call.h
include          r_usbc_cMacPrint.h  Macro definitions                                O   O    O      O   O   O
                                     (macros for displaying debug
                                     information)
include          r_usbc_cTypedef.h   Variable type definitions                        O   O    O      O   O   O
include          r_usbc_cDef592IP.h  Register definitions for 592IP
                                     (not used by RX62N)


R01AN0512EJ0110 Rev.1.10                                                                            Page 30 of 126
Jun 10, 2011
USB Basic Firmware
                                                                               Project
                                                                               (O: Selected )
include       r_usbc_cDef596IP.h    Register definitions for 596IP
                                    (not used by RX62N)
include       r_usbc_cDef597IP.h    Register definitions for 597IP                               O   O
                                    (not used by RX62N)
include       r_usbc_cUsbDefBitD    USB register definitions for RX600         O   O   O     O
              efine.h               series
include       r_usb_cDefUsr.h       User setting (hardware operation           O   O   O     O   O   O
                                    designation) definitions
include       r_usbc_cDefUsrPp.h    USB driver definitions                     O   O   O     O   O   O
include       r_usb_cExtern.h       USB-BASIC-F/W external reference           O   O   O     O   O   O
                                    definitions
include       r_usb_cMacUsr.h       Macro definitions (register access         O   O   O     O   O   O
                                    macros)
include       r_usb_cRevision.h     Common library revision designations       O   O   O     O   O   O
hubd          r_usb_hHubsys.c       HUBCD functions (non-OS)                       O   O             O
hubd          r_usb_hHubsys_uitro   HUBCD functions (uITRON)                       O   O
              n.c
SMPL          r_usb_pClassVendor.   Peripheral class requests                  O       O     O   O
              c
SMPL          r_usb_smp_cSub.c      Common library functions                   O   O   O     O   O   O
SMPL          r_usb_smp_hSub.c      Host standard requests                         O   O             O
SmplMain      main.c                Sample main program                        O   O   O     O   O   O
SmplMain      RX62NRSK.c            RX62N RSK processing                       O   O   O         O   O
SmplMain      RX630RSK.c            RX630 RSK processing                                     O
SmplMain      RX62NRSK_Extern.h     RX62N RSK external reference               O   O   O         O   O
                                    definitions
SmplMain      RX630RSK_Extern.h     RX630 RSK external reference                             O
                                    definitions
APL           r_usbc_PHSMPL_apl     Host and Peripheral sample application             O
              .c
APL           r_usbc_PHSMPL_dat     Data for Host and Peripheral sample                O
              a.c                   application
APL           r_usbc_cdata.c        Data transfer data for port 0 and port 1           O
                                    sample application
APL           r_usbc_cdata.h        Data transfer settings for port 0 and              O
                                    port 1 sample application
APL           r_usb2_HSMPL_apl.     Host port 1 sample application                 O
              c
APL           r_usb_HSMPL_apl.c     Host sample application for R8A66597                             O
APL           r_usb2_cdata.c        Data transfer data for port 1 sample           O
                                    application
APL           r_usb2_cdata.h        Data transfer settings for port 1 sample       O
                                    application
APL           r_usb_PSMPL_apl.c     Peripheral port 0 sample application       O             O   O
APL           r_usb_PSMPL_data.     Data for peripheral port 0 sample          O             O   O
              c                     application
APL           r_usb_cdata.c         Data transfer data for port 0 sample       O             O   O   O
                                    application
APL           r_usb_cdata.h         Data transfer settings for port 0 sample   O             O   O   O
                                    application
config_Pstd   r_usb_RX62N.cfg       Configuration file                         O
config_Pstd   ritable_pstd.src      Vector table setting                       O


R01AN0512EJ0110 Rev.1.10                                                                   Page 31 of 126
Jun 10, 2011
USB Basic Firmware
                                                                            Project
                                                                            (O: Selected )
config_Pstd    r_usb_RX630.cfg         Configuration file                               O
config_Pstd    ritable_rx630_pstd.sr   Vector table setting                             O
               c
config_Hstd    r_usb_RX62N.cfg         Configuration file                       O
config_Hstd    ritable_hstd.src        Vector table setting                     O
config_Cstd    r_usb_RX62N.cfg         Configuration file                            O
config_Cstd    ritable_cstd.src        Vector table setting                          O
HwResourceF    ritable_rx62n.src       Vector table setting for RX62N (non-   O O O
orUSB                                  OS only)
HwResourceF ritable_rx630.src          Vector table setting for RX630 (non-OS             O
orUSB                                  only)
HwResourceF ritable_assp.src           Vector table setting for R8A66597                     O O
orUSB                                  (non-OS only)
HwResourceF dbsct.c                    Section setting                        O O O O O O
orUSB
HwResourceF resetprg.c                 Reset program                          O O O O O O
orUSB
HwResourceF                            Output file of HEW                     O O O O O O
orUSB
RX62N            iodefine.h            IO definition file for RX62N           O O O          O O
RX630            iodefine.h            IO definition file for RX630                       O
* 1): PORT0_P, 2): PORT1_H, 3): PORT0_P_PORT1_H, 4): RX630_PORT0_P , 5): ASSP_PERI , 6): ASSP_HOST




R01AN0512EJ0110 Rev.1.10                                                              Page 32 of 126
Jun 10, 2011
USB Basic Firmware

7.     Sample Applications
     7.1     Sample application for Data transfer (APL)
USB-BASIC-F/W supports the sample application (APL) that can transfer data using pipes 1, 2, 6, and 7 in host or
peripheral function mode as vendor specific class. When writing custom applications, refer to r_usb2_HSMPL_apl.c
and r_usb_PSMPL_apl.c and make the applications.

7.1.1       APL Sequence
The APL sequence in USB-BASIC-F/W is shown below.

                                                                    Host function mode
                     Peripheral function mode
                                                                           APL
                               APL

                                                                      R_usb2_hstd_
                           Initialize data                             SetPipeInfo
                        transfer processing

                                                                      R_usb2_hstd_
                                                                    SetPipeRegistration


                                                                       Initialize data
                                                                    transfer processing
                           Data transfer           ERROR
                            complete ?
                                                                      R_usb2_hstd_
                                       YES                            TransferStart

                        Reset data transfer
                           processing
                                                                       Data transfer           ERROR
                                                                        complete ?
                           R_usb_pstd_
                           TransferStart                                         YES

                                                                    Count down of data
                                                                     transfer counter


                              return                                   Data transfer         NO
                                                                     counter is not 0 ?
                                                                                  YES

                                                                      R_usb2_hstd_
                                                                      TransferStart



                                                                      All data transfer        NO
                                                                       counter is 0 ?
                                                                                      YES

                                                                    Reset data transfer
                                                                       processing


                                                                      R_usb2_hstd_
                                                                      TransferStart



                                                Figure 7.1 APL sequence




R01AN0512EJ0110 Rev.1.10                                                                               Page 33 of 126
Jun 10, 2011
USB Basic Firmware

7.1.2      APL Global Area
The APL global area in USB-BASIC-F/W is shown below.
Table 7.1 List of APL global area (Peripheral function mode)
     Type            Variable                           Description
1    USBC_UTR_t      usb_gcstd_SmplTrnMsg[ ]            Message area of pipes for data transfer
                                                        request
2    uint32_t        usb_gcstd_SmplTrnCnt[ ]            Data transfer counter of pipes
3    uint32_t        usb_gcstd_SmplTrnSize[ ]           Data transfer size of pipes
4    uint8_t *       usb_gcstd_SmplTrnPtr[ ]            Data address pointer of pipes for data transfer
5    uint8_t         usb_gcstd_SmplTrnData1[ ]          Data address of pipe1 for data transfer
6    uint8_t         usb_gcstd_SmplTrnData2[ ]          Data address of pipe2 for data transfer
7    uint8_t         usb_gcstd_SmplTrnData3[ ]          Data address of pipe3 for data transfer
8    uint8_t         usb_gcstd_SmplTrnData4[ ]          Data address of pipe4 for data transfer
9    uint8_t         usb_gcstd_SmplTrnData5[ ]          Data address of pipe5 for data transfer
10   uint8_t         usb_gcstd_SmplTrnData6[ ]          Data address of pipe6 for data transfer
11   uint8_t         usb_gcstd_SmplTrnData7[ ]          Data address of pipe7 for data transfer
12   uint8_t         usb_gcstd_SmplTrnData8[ ]          Data address of pipe8 for data transfer
13   uint8_t         usb_gcstd_SmplTrnData9[ ]          Data address of pipe9 for data transfer
14   uint16_t        usb_gpstd_SmplEpTbl1[ ]            Pipe information table for data transfer
                                                        application
15   uint16_t        usb_gpstd_SmplEpTbl2[ ]            Dummy of pipe information table
16   uint16_t        usb_gpstd_SmplEpTbl3[ ]            Dummy of pipe information table
17   uint16_t        usb_gpstd_SmplEpTbl4[ ]            Dummy of pipe information table
18   uint16_t        usb_gpstd_SmplEpTbl5[ ]            Dummy of pipe information table
19   uint16_t *      usb_gpstd_SmplEpPtr[ ]             Pointer table of pipe information table
20   uint8_t         usb_gpstd_SmplDeviceDescriptor[ ] Device descriptor for data transfer application
21   uint8_t         usb_gpstd_SmplQualifierDescriptor[ Qualifier descriptor for data transfer
                      ]                                 application
22   uint8_t         usb_gpstd_SmplConfigurationH_1[    Configuration descriptor of hi-speed for data
                     ]                                  transfer application
23   uint8_t         usb_gpstd_SmplConfigurationF_1[ ] Configuration descriptor of full-speed for data
                                                        transfer application
24   uint8_t *       usb_gpstd_SmplConPtr[ ]            Pointer table of configuration descriptor for
                                                        data transfer application
25   uint8_t *       usb_gpstd_SmplConPtrOther[ ]       Pointer table of other speed configuration
                                                        descriptor for data transfer application
26   uint8_t         usb_gpstd_StringDescriptor0[ ]     String Descriptor0 for data transfer application
27   uint8_t         usb_gpstd_StringDescriptor1[ ]     String Descriptor1 for data transfer application
28   uint8_t         usb_gpstd_StringDescriptor2[ ]     String Descriptor2 for data transfer application
29   uint8_t         usb_gpstd_StringDescriptor3[ ]     String Descriptor3 for data transfer application
30   uint8_t         usb_gpstd_StringDescriptor4[ ]     String Descriptor4 for data transfer application
31   uint8_t         usb_gpstd_StringDescriptor5[ ]     String Descriptor5 for data transfer application
32   uint8_t *       usb_gpstd_StrPtr[ ]                Pointer table of string descriptor for data
                                                        transfer descriptor




R01AN0512EJ0110 Rev.1.10                                                                   Page 34 of 126
Jun 10, 2011
USB Basic Firmware
Table 7.2 List of APL global area (Host function mode)
     Type             Variable                           Description
1    USBC_UTR_t       usb2_gcstd_SmplTrnMsg[ ]           Message area of pipes for data transfer
                                                         request
2    uint32_t         usb2_gcstd_SmplTrnCnt[ ]           Data transfer counter of pipes
3    uint32_t         usb2_gcstd_SmplTrnSize[ ]          Data transfer size of pipes
4    uint8_t *        usb2_gcstd_SmplTrnPtr[ ]           Data address pointer of pipes for data transfer
5    uint8_t          usb2_gcstd_SmplTrnData1[ ]         Data address of pipe1 for data transfer
6    uint8_t          usb2_gcstd_SmplTrnData2[ ]         Data address of pipe2 for data transfer
7    uint8_t          usb2_gcstd_SmplTrnData3[ ]         Data address of pipe3 for data transfer
8    uint8_t          usb2_gcstd_SmplTrnData4[ ]         Data address of pipe4 for data transfer
9    uint8_t          usb2_gcstd_SmplTrnData5[ ]         Data address of pipe5 for data transfer
10   uint8_t          usb2_gcstd_SmplTrnData6[ ]         Data address of pipe6 for data transfer
11   uint8_t          usb2_gcstd_SmplTrnData7[ ]         Data address of pipe7 for data transfer
12   uint8_t          usb2_gcstd_SmplTrnData8[ ]         Data address of pipe8 for data transfer
13   uint8_t          usb2_gcstd_SmplTrnData9[ ]         Data address of pipe9 for data transfer
14   uint16_t         usb2_gpstd_SmplDefEpTbl[ ]         Pipe information table for data transfer
                                                         application
15   uint16_t         usb2_gpstd_SmplTmpEpTbl[ ]         Pipe information table for data transfer
                                                         application
16   const uint16_t   usb2_gpstd_SmplTpl[ ]              Target peripheral list(TPL) for data transfer
                                                         application
17   uint16_t         usb2_gpstd_SmplAdr                 Temporary area of device address for data
                                                         transfer application
18   uint16_t         usb2_gpstd_SmplClassSeq            Sequence control data for data transfer
                                                         application
19   uint8_t *        usb2_hcls_SmplDeviceTable          Temporary area of pointer of device descriptor
                                                         data for data transfer application
20   uint8_t *        usb2_hcls_SmplConfigTable          Temporary area of pointer of configuration
                                                         descriptor data for data transfer application
21   uint8_t *        usb2_hcls_SmplInterfaceTable       Temporary area of pointer of interface
                                                         descriptor data for data transfer application
22   uint16_t         usb2_hcls_SmplDevaddr              Temporary area of pointer of device address
                                                         data for data transfer application
23   uint16_t         usb2_hcls_SmplSpeed                Temporary area of pointer of device speed
                                                         data for data transfer application




R01AN0512EJ0110 Rev.1.10                                                                  Page 35 of 126
Jun 10, 2011
USB Basic Firmware

7.1.3      APL Constant Definition
The APL constant definition in USB-BASIC-F/W is shown below.
Table 7.3 List of APL constant definition (Peripheral function mode)
     Constant Name                             Value           Description
1    Data length of descriptors
     USB_SMPLCONFLEN                           46              Data length of
                                                               usb_gpstd_SmplConfigurationH_1[ ]/
                                                               usb_gpstd_SmplConfigurationF_1[ ]
     USB_SD1LEN                                32              Data length of
                                                               usb_gpstd_StringDescriptor1[ ]
     USB_SD2LEN                                28              Data length of
                                                               usb_gpstd_StringDescriptor2[ ]
2    Select using pipe for data transfer
     application
     USBC_USEPIPE_ALL_PP                       1               Use pipe1 to pipe9
     USBC_USEPIPE_1267_PP                      2               Use pipe 1,2,6 and 7
     USBC_USEPIPE_MODE_PP                      2               Set to use pipe 1,2,6 and 7
3    Table size of
     usb_gcstd_SmplTrnMsg[ ]
     usb_gcstd_SmplTrnCnt[ ]
     usb_gcstd_SmplTrnSize[ ]
     *usb_gcstd_SmplTrnPtr[ ]
     USB_TBL_MAX                               10              Use area between pipe0 and pipe9
                                                               (This value is index of the tables.)
4    Data transfer size
     USB_SMPL_TRNSIZE1                         512             Data transfer size of pipe1 are 512 bytes
     USB_SMPL_TRNSIZE2                         512             Data transfer size of pipe2 are 512 bytes
     USB_SMPL_TRNSIZE3                         512             Data transfer size of pipe3 are 512 bytes
     USB_SMPL_TRNSIZE4                         512             Data transfer size of pipe4 are 512 bytes
     USB_SMPL_TRNSIZE5                         512             Data transfer size of pipe5 are 512 bytes
     USB_SMPL_TRNSIZE6                         512             Data transfer size of pipe6 are 512 bytes
     USB_SMPL_TRNSIZE7                         512             Data transfer size of pipe7 are 512 bytes
     USB_SMPL_TRNSIZE8                         0               Data transfer size of pipe8 are 0 byte
     USB_SMPL_TRNSIZE9                         0               Data transfer size of pipe9 are 0 byte
5    Data transfer times
     USB_SMPL_TRNCNT1                          512             Data transfer times of pipe1 are 512 times
     USB_SMPL_TRNCNT2                          512             Data transfer times of pipe2 are 512 times
     USB_SMPL_TRNCNT3                          512             Data transfer times of pipe3 are 512 times
     USB_SMPL_TRNCNT4                          512             Data transfer times of pipe4 are 512 times
     USB_SMPL_TRNCNT5                          512             Data transfer times of pipe5 are 512 times
     USB_SMPL_TRNCNT6                          512             Data transfer times of pipe6 are 512 times
     USB_SMPL_TRNCNT7                          512             Data transfer times of pipe7 are 512 times
     USB_SMPL_TRNCNT8                          0               Pipe8 do not transfer
     USB_SMPL_TRNCNT9                          0               Pipe9 do not transfer




R01AN0512EJ0110 Rev.1.10                                                                       Page 36 of 126
Jun 10, 2011
USB Basic Firmware
Table 7.4 List of APL constant definition (Host function mode)
     Constant Name                             Value        Description
1    Select using pipe for data transfer
     application
     USBC_USEPIPE_ALL_PP                       1            Use pipe1 to pipe9
     USBC_USEPIPE_1267_PP                      2            Use pipe 1,2,6 and 7
     USBC_USEPIPE_MODE_PP                      2            Set to use pipe 1,2,6 and 7
3    Table size of
     usb2_gcstd_SmplTrnMsg[ ]
     usb2_gcstd_SmplTrnCnt[ ]
     usb2_gcstd_SmplTrnSize[ ]
     *usb2_gcstd_SmplTrnPtr[ ]
     USB2_TBL_MAX                              10           Use area between pipe0 and pipe9
                                                            (This value is index of the tables.)
4    Data transfer size
     USB2_SMPL_TRNSIZE1                        512          Data transfer size of pipe1 are 512 bytes
     USB2_SMPL_TRNSIZE2                        512          Data transfer size of pipe2 are 512 bytes
     USB2_SMPL_TRNSIZE3                        512          Data transfer size of pipe3 are 512 bytes
     USB2_SMPL_TRNSIZE4                        512          Data transfer size of pipe4 are 512 bytes
     USB2_SMPL_TRNSIZE5                        512          Data transfer size of pipe5 are 512 bytes
     USB2_SMPL_TRNSIZE6                        512          Data transfer size of pipe6 are 512 bytes
     USB2_SMPL_TRNSIZE7                        512          Data transfer size of pipe7 are 512 bytes
     USB2_SMPL_TRNSIZE8                        0            Data transfer size of pipe8 are 0 byte
     USB2_SMPL_TRNSIZE9                        0            Data transfer size of pipe9 are 0 byte
5    Data transfer times
     USB2_SMPL_TRNCNT1                         512          Data transfer times of pipe1 are 512 times
     USB2_SMPL_TRNCNT2                         512          Data transfer times of pipe2 are 512 times
     USB2_SMPL_TRNCNT3                         512          Data transfer times of pipe3 are 512 times
     USB2_SMPL_TRNCNT4                         512          Data transfer times of pipe4 are 512 times
     USB2_SMPL_TRNCNT5                         512          Data transfer times of pipe5 are 512 times
     USB2_SMPL_TRNCNT6                         512          Data transfer times of pipe6 are 512 times
     USB2_SMPL_TRNCNT7                         512          Data transfer times of pipe7 are 512 times
     USB2_SMPL_TRNCNT8                         0            Pipe8 do not transfer
     USB2_SMPL_TRNCNT9                         0            Pipe9 do not transfer


7.1.4      List of APL function
The list of APL function in USB-BASIC-F/W is shown below.




R01AN0512EJ0110 Rev.1.10                                                                    Page 37 of 126
Jun 10, 2011
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01
Eekol 2012 jan04_int_ems_an_01

Contenu connexe

Tendances

Direct Memory Access(DMA)
Direct Memory Access(DMA)Direct Memory Access(DMA)
Direct Memory Access(DMA)Page Maker
 
Direct memory access
Direct memory accessDirect memory access
Direct memory accessshubham kuwar
 
Hibernation in Linux 2.6.29
Hibernation in Linux 2.6.29Hibernation in Linux 2.6.29
Hibernation in Linux 2.6.29Varun Mahajan
 
Embedded networking
Embedded networkingEmbedded networking
Embedded networkingArul Kumar
 
Embedded systems notes
Embedded systems notesEmbedded systems notes
Embedded systems notesShikha Sharma
 
Chapter 6 input output
Chapter 6 input outputChapter 6 input output
Chapter 6 input outputrisal07
 
Unit 1 intro-embedded
Unit 1 intro-embeddedUnit 1 intro-embedded
Unit 1 intro-embeddedPavithra S
 
Drives Software Programming – using PLC or Drive bespoke programming?
Drives Software Programming – using PLC or Drive bespoke programming?Drives Software Programming – using PLC or Drive bespoke programming?
Drives Software Programming – using PLC or Drive bespoke programming?Optima Control Solutions
 
DMA Versus Polling or Interrupt Driven I/O
DMA Versus Polling or Interrupt Driven I/ODMA Versus Polling or Interrupt Driven I/O
DMA Versus Polling or Interrupt Driven I/Osathish sak
 
Power Management in Embedded Systems
Power Management in Embedded Systems Power Management in Embedded Systems
Power Management in Embedded Systems mentoresd
 
Direct Memory Access
Direct Memory AccessDirect Memory Access
Direct Memory AccessTuqa Rmahi
 
IO Techniques in Computer Organization
IO Techniques in Computer OrganizationIO Techniques in Computer Organization
IO Techniques in Computer OrganizationOm Prakash
 
Device drivers and interrupt service mechanism
Device drivers and interrupt service mechanismDevice drivers and interrupt service mechanism
Device drivers and interrupt service mechanismVijay Kumar
 
Embedded systems 101 final
Embedded systems 101 finalEmbedded systems 101 final
Embedded systems 101 finalKhalid Elmeadawy
 

Tendances (20)

I/O System
I/O SystemI/O System
I/O System
 
Linux_swspnd_v0.3_pub1
Linux_swspnd_v0.3_pub1Linux_swspnd_v0.3_pub1
Linux_swspnd_v0.3_pub1
 
Direct Memory Access(DMA)
Direct Memory Access(DMA)Direct Memory Access(DMA)
Direct Memory Access(DMA)
 
Baseband processor final rev
Baseband processor final revBaseband processor final rev
Baseband processor final rev
 
Direct memory access
Direct memory accessDirect memory access
Direct memory access
 
Ch13 annotated
Ch13 annotatedCh13 annotated
Ch13 annotated
 
Hibernation in Linux 2.6.29
Hibernation in Linux 2.6.29Hibernation in Linux 2.6.29
Hibernation in Linux 2.6.29
 
Embedded networking
Embedded networkingEmbedded networking
Embedded networking
 
Computer hardware
Computer hardwareComputer hardware
Computer hardware
 
Embedded systems notes
Embedded systems notesEmbedded systems notes
Embedded systems notes
 
Chapter 6 input output
Chapter 6 input outputChapter 6 input output
Chapter 6 input output
 
Unit 1 intro-embedded
Unit 1 intro-embeddedUnit 1 intro-embedded
Unit 1 intro-embedded
 
Drives Software Programming – using PLC or Drive bespoke programming?
Drives Software Programming – using PLC or Drive bespoke programming?Drives Software Programming – using PLC or Drive bespoke programming?
Drives Software Programming – using PLC or Drive bespoke programming?
 
DMA Versus Polling or Interrupt Driven I/O
DMA Versus Polling or Interrupt Driven I/ODMA Versus Polling or Interrupt Driven I/O
DMA Versus Polling or Interrupt Driven I/O
 
Power Management in Embedded Systems
Power Management in Embedded Systems Power Management in Embedded Systems
Power Management in Embedded Systems
 
Direct Memory Access
Direct Memory AccessDirect Memory Access
Direct Memory Access
 
IO Techniques in Computer Organization
IO Techniques in Computer OrganizationIO Techniques in Computer Organization
IO Techniques in Computer Organization
 
IO hardware
IO hardwareIO hardware
IO hardware
 
Device drivers and interrupt service mechanism
Device drivers and interrupt service mechanismDevice drivers and interrupt service mechanism
Device drivers and interrupt service mechanism
 
Embedded systems 101 final
Embedded systems 101 finalEmbedded systems 101 final
Embedded systems 101 final
 

Similaire à Eekol 2012 jan04_int_ems_an_01

Usb Wp Implementing Usb
Usb Wp Implementing UsbUsb Wp Implementing Usb
Usb Wp Implementing Usballankliu
 
Pendrive to pendrive data transfer without pc
Pendrive to pendrive data transfer without pcPendrive to pendrive data transfer without pc
Pendrive to pendrive data transfer without pcVishnu Kudumula
 
Principles of I/O Hardware and Software
Principles of I/O Hardware and SoftwarePrinciples of I/O Hardware and Software
Principles of I/O Hardware and SoftwareKarandeep Singh Sehgal
 
Paper id 252014121
Paper id 252014121Paper id 252014121
Paper id 252014121IJRAT
 
USB TO USB Data Transfer without PC
USB TO USB Data Transfer without PCUSB TO USB Data Transfer without PC
USB TO USB Data Transfer without PCIJERD Editor
 
USB Specification 2.0 - Chapter 9 - Device Framework
USB Specification 2.0 - Chapter 9 - Device FrameworkUSB Specification 2.0 - Chapter 9 - Device Framework
USB Specification 2.0 - Chapter 9 - Device FrameworkMacpaul Lin
 
Hardware software
Hardware softwareHardware software
Hardware softwareSaheli Aich
 
Standalone_USB_Transfer_Device_ijariie2074.pdf
Standalone_USB_Transfer_Device_ijariie2074.pdfStandalone_USB_Transfer_Device_ijariie2074.pdf
Standalone_USB_Transfer_Device_ijariie2074.pdfShashank Jadhav
 
Useful USB Gadgets on Linux
Useful USB Gadgets on LinuxUseful USB Gadgets on Linux
Useful USB Gadgets on LinuxGary Bisson
 
Hostless : Simple Connectivity For WiMax Devices
Hostless : Simple Connectivity For WiMax DevicesHostless : Simple Connectivity For WiMax Devices
Hostless : Simple Connectivity For WiMax DevicesGreen Packet
 

Similaire à Eekol 2012 jan04_int_ems_an_01 (20)

An1003 usb
An1003 usbAn1003 usb
An1003 usb
 
Un se-bu
Un se-buUn se-bu
Un se-bu
 
Usb Wp Implementing Usb
Usb Wp Implementing UsbUsb Wp Implementing Usb
Usb Wp Implementing Usb
 
Usb old
Usb oldUsb old
Usb old
 
Usb In-a-Nutshell
Usb In-a-NutshellUsb In-a-Nutshell
Usb In-a-Nutshell
 
Usb Overview
Usb OverviewUsb Overview
Usb Overview
 
Pendrive to pendrive data transfer without pc
Pendrive to pendrive data transfer without pcPendrive to pendrive data transfer without pc
Pendrive to pendrive data transfer without pc
 
Cp33551556
Cp33551556Cp33551556
Cp33551556
 
Cp33551556
Cp33551556Cp33551556
Cp33551556
 
Lesson 9 Device Management
Lesson 9 Device ManagementLesson 9 Device Management
Lesson 9 Device Management
 
Principles of I/O Hardware and Software
Principles of I/O Hardware and SoftwarePrinciples of I/O Hardware and Software
Principles of I/O Hardware and Software
 
Paper id 252014121
Paper id 252014121Paper id 252014121
Paper id 252014121
 
USB TO USB Data Transfer without PC
USB TO USB Data Transfer without PCUSB TO USB Data Transfer without PC
USB TO USB Data Transfer without PC
 
Linux Usb overview
Linux Usb  overviewLinux Usb  overview
Linux Usb overview
 
Manual
ManualManual
Manual
 
USB Specification 2.0 - Chapter 9 - Device Framework
USB Specification 2.0 - Chapter 9 - Device FrameworkUSB Specification 2.0 - Chapter 9 - Device Framework
USB Specification 2.0 - Chapter 9 - Device Framework
 
Hardware software
Hardware softwareHardware software
Hardware software
 
Standalone_USB_Transfer_Device_ijariie2074.pdf
Standalone_USB_Transfer_Device_ijariie2074.pdfStandalone_USB_Transfer_Device_ijariie2074.pdf
Standalone_USB_Transfer_Device_ijariie2074.pdf
 
Useful USB Gadgets on Linux
Useful USB Gadgets on LinuxUseful USB Gadgets on Linux
Useful USB Gadgets on Linux
 
Hostless : Simple Connectivity For WiMax Devices
Hostless : Simple Connectivity For WiMax DevicesHostless : Simple Connectivity For WiMax Devices
Hostless : Simple Connectivity For WiMax Devices
 

Dernier

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 

Dernier (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 

Eekol 2012 jan04_int_ems_an_01

  • 1. APPLICATION NOTE Renesas USB Device R01AN0512EJ0110 Rev.1.10 USB Basic Firmware Jun 10, 2011 Introduction This document is an instruction manual for the Renesas USB Device USB basic firmware, a sample program for USB interface control using the Renesas USB Device. Target Device RX62N, RX630 and R8A66597 Contents 1. Document Overview .......................................................................................................................... 2 2. Overview ........................................................................................................................................... 3 3. Using USB-BASIC-F/W................................................................................................................... 10 4. User-Defined Macros ...................................................................................................................... 13 5. User-Defined Information ................................................................................................................ 17 6. Workspace ...................................................................................................................................... 28 7. Sample Applications........................................................................................................................ 33 8. Peripheral Driver (PCD) .................................................................................................................. 41 9. Peripheral Control Transfer............................................................................................................. 53 10. Host Driver (HCD) ........................................................................................................................... 56 11. Host Control Transfer ...................................................................................................................... 65 12. Host Manager (MGR) ...................................................................................................................... 74 13. Non-OS Scheduler .......................................................................................................................... 89 14. uITRON System .............................................................................................................................. 97 15. HUB class driver(HUBCD) .............................................................................................................. 99 16. Data Transfer ................................................................................................................................ 105 17. DTC Transfer................................................................................................................................. 116 18. EXDMA Transfer ........................................................................................................................... 121 19. Restrictions.................................................................................................................................... 125 R01AN0512EJ0110 Rev.1.10 Page 1 of 126 Jun 10, 2011
  • 2. USB Basic Firmware 1. Document Overview 1.1 Overview This document is an instruction manual for the Renesas USB Devices USB basic firmware, a sample program for USB interface control using the Renesas USB Devices. This firmware includes uITRON ver. and OS less ver. This document is intended to be used together with the device’s data sheet. 1.2 Related Documents [1] Universal Serial Bus Revision 2.0 Specification [http://www.usb.org/developers/docs/] [2] Renesas USB Device Hardware Manual Available from the Renesas website Renesas Website [http://www.renesas.com/index.html] USB Device Page [http://www.renesas.com/prod/usb/] 1.3 List of Terms Terms and abbreviations used in this document are listed below. USB: Universal Serial Bus USB-BASIC-F/W: USB basic firmware for Renesas USB Device (non-OS/uITRON) non-OS: USB basic firmware for OS less system uITRON: USB basic firmware for uITRON system HEW: High-performance Embedded Workshop PCD: Peripheral control driver of USB-BASIC-F/W PDCD: Peripheral device class driver (device driver and USB class driver) HCD: Host control driver of USB-BASIC-F/W MGR: Peripheral device state manager of HCD HDCD: Host device class driver (device driver and USB class driver) HUBCD: Hub class sample driver APL: Application program HTST: Host electrical test Task: Processing unit scheduler: Used to schedule functions, like a simplified OS Scheduler macro: Used to call a scheduler function (non-OS) R01AN0512EJ0110 Rev.1.10 Page 2 of 126 Jun 10, 2011
  • 3. USB Basic Firmware 2. Overview 2.1 Features of USB-BASIC-F/W The main features of USB-BASIC-F/W are as follows. [Overall] • Can control RX62N, RX630 and R8A66597 by common source code. • Can use same source code in uITRON or non-OS. • Can operate in either host function or peripheral function mode. • Multiple device class drivers may be installed without the need to customize USB-BASIC-F/W. (Device class drivers can be registered up to the maximum number of devices that can be connected.) [Host function mode] • When a no-response condition is detected during data transfer, the transfer is retried (n retries per transfer on the same pipe: specified by user in file r_usbc_cDefUsr.h). • Common API for control transfer, bulk transfer and interrupt transfer is provided. • API for devices connect/disconnect processing is provided. • API for suspend/resume processing is provided. • HUBCD sample program code is provided. • Sample application for data transfer is added. (This application operates as Vendor class.) • A single pipe can perform multiple exclusive data communication tasks in order to manage HDCD pipe information tables. [Peripheral function mode] • Operation can be confirmed by using USBCommandVerifier.exe. (USBCV is available for download from http://www.usb.org/developers/developers/tools/.) • API for control transfer is provided. • Common API for bulk transfer and interrupt transfer is provided. • API for devices connect/disconnect processing is provided. • API for suspend/resume processing is provided. • Sample application for data transfer is added. (This application operates as Vendor class.) The following functions must be provided by the customer to match the system under development. • Overcurrent detection processing when connecting USB cables (host function mode). • Descriptor analysis (host function mode). • Device class driver 2.2 Development Goals USB-BASIC-F/W was developed with the following goals in mind. • To simplify the development of USB communication programs by customers using Renesas USB Device. • To provide source code examples for hardware control of USB. 2.3 Functions The functions provided by USB-BASIC-F/W are as follows. • In host function mode, enumeration as low-speed/full-speed/high-speed device (However, operating speed is different by devices ability.) • In peripheral function mode, enumeration as USB1.1/2.0/3.0 host • Device connect/disconnect, suspend/resume, and USB bus reset processing • Control transfer on pipe 0 • Data transfer on pipes 1 to 9 (bulk or interrupt transfer: CPU access/DTC or DMA access) • Transfer error determination and transfer retry R01AN0512EJ0110 Rev.1.10 Page 3 of 126 Jun 10, 2011
  • 4. USB Basic Firmware 2.4 Task Configuration In peripheral function mode, USB-BASIC-F/W comprises the peripheral driver, which controls H/W, and the application. In host function mode, USB-BASIC-F/W comprises the host driver, which controls H/W, the manager, which manages device states, the hub class driver, which controls devices connected to the down ports of the USB hub, and the application. Peripheral driver and host driver initiate hardware control according to messages from the various tasks or interrupt handler. They also notify the appropriate task when hardware control ends, of processing results, and of hardware requests. Manager manages the states of devices connected and performs enumeration. In addition, manager issues a message to host driver or hub class driver when the application changes the device state. Hub class driver is sample program code for managing the states of devices connected to the down ports of the USB hub and performing enumeration. uITRON Scheduler Function non-OS Figure 2.1 Task Configuration of USB-BASIC-F/W R01AN0512EJ0110 Rev.1.10 Page 4 of 126 Jun 10, 2011
  • 5. USB Basic Firmware Table 2.1 Task Functions No. Module Name Function 1 USB interrupt handler • USB interrupt handler void usb_cstd_UsbHandler(void) (USB packet transmit/receive end and special signal detection) 2 Peripheral driver (PCD) • Hardware control in peripheral function mode void • Peripheral transaction management usb_pstd_PcdTask(USBC_VP_INT_t) 3 Host driver (HCD) • Hardware control in host function mode void • Host transaction management usb_hstd_HcdTask(USBC_VP_INT_t) 4 Host manager (MGR) • Device state management void • Enumeration usb_hstd_MgrTask(USBC_VP_INT_t) • HCD/HUBCD control message determination 5 Hub class driver (HUBCD) • HUB down port device state management void usb_hhub_Task(USBC_VP_INT_t) • HUB down port enumeration 6 Device class driver (PDCD/HDCD) Provided by the customer as appropriate for the system. 7 Device driver (HDD) Provided by the customer as appropriate for the system. 8 Application (APL) Provided by the customer as appropriate for the system. 2.5 Non-OS Scheduler Function A scheduler function manages requests generated by the tasks and hardware according to the relative priority of the tasks. When multiple requests are generated by tasks with the same priority, they are executed using a FIFO configuration. To assure commonality with non-OS and uITRON-compatible firmware, requests between tasks are implemented by transmitting and receiving messages. In addition, call-back functions are used for responses to tasks indicating the end of a request, so the customer need only install appropriate class drivers for the system and there is no need to modify the scheduler itself. 2.6 Sequence Outline Like USB-BASIC-F/W comprises usbc_cstd_MainTask, MainInit, MainLoop and usb_cstd_UsbHandler. In non-OS, the compositions add scheduler. When an interrupt occurs, the function mode that is selected by USB operational mode setting is checked and notification is sent by means of a message to PCD/HCD. When the PCD or HCD task receives a message from the USB interrupt handler, it determines the interrupt source and executes the appropriate processing. (For a sequence outline of PCD/HCD task, see sections 8 and 10.) The PCD or HCD is selected by USB function setting. (For a USB function setting, see sections 5.) R01AN0512EJ0110 Rev.1.10 Page 5 of 126 Jun 10, 2011
  • 6. USB Basic Firmware usbc_cstd_Main MainInit Task Initialize USB MainInit() function Register driver Start Idle Task usb_cstd_UsbHandler Initialize scheduler function USBC_HOST_PP Operating mode? MainLoop() Set priority USBC_PERI_PP Set USB Clear interrupt Clear interrupt Idle Task operating mode source source Send message Send message Return to PCD to HCD Return USB_FUNCSEL_PP == USB_FUNCSEL_PP == Task USBC_PERI_PP USBC_HOST_PP No USBC_TRCV_MSG? MainLoop MainLoop Yes Application Application Processing No No Tasks starting is Task processing Task processing Return controlled flag set? flag set? by scheduler Yes Yes Scheduler PCD task HCD task No PDCD task MGR task Processing request? HUB task Yes Select request with Scheduler HDCD task top priority Return Set task Scheduler processing flag Return Return Figure 2.2 Sequence Outline (non-OS) R01AN0512EJ0110 Rev.1.10 Page 6 of 126 Jun 10, 2011
  • 7. USB Basic Firmware usbc_cstd_Main MainInit Task Initialize USB MainInit() function Start Idle task Start PCD task Start MGR task Start HCD task MainLoop() Register driver Set USB operating mode Return Task usb_cstd_UsbHandler USBC_HOST_PP Operating mode? USBC_TRCV_MSG? USBC_PERI_PP Clear interrupt Clear interrupt Processing source source Send message Send message to PCD to HCD Return Figure 2.3 Sequence Outline (uITRON) R01AN0512EJ0110 Rev.1.10 Page 7 of 126 Jun 10, 2011
  • 8. USB Basic Firmware 2.7 Non-OS Task Operation Example An example of the operation of a USB-BASIC-F/W task is shown below. Execution request received by MGR task in host function mode Note: Operation is the same in peripheral function mode. Execution request MainLoop HCD task MGR task execution Application No USBC_TRCV_MSG? No Yes Flag set ? Processing Yes HCD task Return MGR task MGR task HUB task No USBC_TRCV_MSG? HDCD task Yes Processing Scheduler Return return HUB task No USBC_TRCV_MSG? Yes Processing Return HDCD task No USBC_TRCV_MSG? Yes Processing Return Figure 2.4 Task Operation Example (non-OS) R01AN0512EJ0110 Rev.1.10 Page 8 of 126 Jun 10, 2011
  • 9. USB Basic Firmware 2.8 uITRON Task-Related Operation Operation related to USB-BASIC-F/W tasks is shown below. Figure 2.5 Task-Related Operation (uITRON) R01AN0512EJ0110 Rev.1.10 Page 9 of 126 Jun 10, 2011
  • 10. USB Basic Firmware 3. Using USB-BASIC-F/W 3.1 Overview USB-BASIC-F/W is a USB driver that is adapted for the customer’s system by making changes to the non-OS scheduler macros or uITRON system control macros (r_usbc_cItron.h, r_usbc_cMacSystemcall.h), user information (r_usbc_cDefUsr.h, r_usb_cDefUsr.h), and non-OS settings (r_usbc_cKernelId.h, main.c, r_usb_PSMPL_apl.c, r_usb2_HSMPL_apl.c) to add HDCD and PDCD tasks. 3.2 Changing USB-BASIC-F/W In order to use USB-BASIC-F/W, it is necessary to make changes to the following program code and header files. 1. It is necessary select the project and the build configuration in USB-BASIC-F/W. ⎯ Select the project of the non-OS or uITRON from HEW project, and select the build configuration of the appropriate function (Host mode or Peripheral mode) for the system under development from HEW build configuration in USB-BASIC-F/W and set the selected project in the active condition. 2. Sample application source code for executing data transfer is provided. These should be changed as needed to match the system under development. ⎯ Initialization of the control MCU, interrupt handlers, interrupt control, DTC or DMA control, etc. (See table 3.1.) ⎯ For the non-OS, adjustments to the duration of the specified wait time functions (usbc_cpu_DelayXms() function, usbc_cpu_Delay1us() function) ⎯ For the non-OS, settings of functions that disable or enable USB-related interrupts in order to use the scheduler function (usb_cstd_IntDisable() function, usb_cstd_IntEnable() function) The USB interrupt disable function (usb_cstd_IntDisable() function) and USB interrupt enable function (usb_cstd_IntEnable() function) disable and enable, respectively. Make any necessary changes to the settings to match the MCU being used. 3. For using R8A66597, it is necessary to make changes to the hardware settings in the usb_cstd_Pinconfig function in r_usb_cSignal.c to match the system under development. Make sure to refer to section 5 regarding the definitions for the settings. ⎯ External bus operating voltage (set by user-defined information) ⎯ FIFO access endian specification (common with CPU endian mode: set by user-defined information) ⎯ Interrupt pin operation level ⎯ DMA pin operation level ⎯ BRDY interrupt operating mode ⎯ SOF pin operating mode ⎯ Low-power sleep operation specification (set by user-defined information) 4. Some files must be customized by the customer. ⎯ Refer to 5, User-Defined Information, and make appropriate changes to the user settings. 5. Debug Information Output Function ⎯ Make the appropriate settings in the file r_usbc_cMacPrint.h to enable or disable output of debug information. (Debug information can be output by creating a serial driver, or the like.) R01AN0512EJ0110 Rev.1.10 Page 10 of 126 Jun 10, 2011
  • 11. USB Basic Firmware Table 3.1 List of Functions Type Function Description void usb_cstd_TargetInit(void) System initialization void usb_cstd_UsbIntHand(void) USB interrupt handler void usb_cstd_Dma0/1IntHand(void) DTC/DMA interrupt handler void usbc_cpu_UsbintInit(void) USB interrupt enable void usbc_cpu_DmaintInit(void) DTC/DMA interrupt enable uint16_t usb_cstd_D0fifo2BufStartDma(uint32_t SourceAddr) DTC/DMA read start uint16_t usb_cstd_Buf2D0fifoStartDma(uint32_t DistAddr) DTC/DMA write start void usb_cstd_StopDma(void) DTC/DMA stop void usb_cstd_IntEnable(void) USB interrupt enable for scheduler function of non-OS void usb_cstd_IntDisable(void) USB interrupt disable for scheduler function of non-OS void usbc_cpu_Delay1us(uint16_t time) 1us delay void usbc_cpu_DelayXns(uint16_t time) 1ms delay 3.3 Creating HDCD and PDCD Tasks USB-BASIC-F/W includes sample application source code for executing data transfer, it is necessary to create HDCD or PDCD tasks to match the system under development. It must also be configured to enable control of the scheduler function of the non-OS firmware. For the non-OS, HDCD or PDCD tasks should be configured to run USBC_TRCV_MSG at the start of processing, and in case of USBC_NG, to end the function. For the non-OS, the following processing routines must be added to HDCD to enable control by the scheduler function. Refer to the sample application function (usb2_hstd_MainTask() function). 1. Class check processing (to check the class driver during enumeration) 2. Initialization processing 3. Enumeration waits processing (so that when multiple devices are attached, the other devices wait until enumeration of the current device ends) Note: RX62N does not require this processing. 4. Task processing (created to match the system) For non-OS, the following processing routines must be added to PDCD to enable control by the scheduler function. Refer to the sample function (usb_pstd_MainTask() function). 5. Task processing (created to match the system) R01AN0512EJ0110 Rev.1.10 Page 11 of 126 Jun 10, 2011
  • 12. USB Basic Firmware HDCD_Task No USBC_TRCV_MSG? Yes R8A66597 only Processing contents USB_MSG USB_MSG USB_MSG USB_MSG_CLS_ _CLS_INIT _CLS_WAIT _CLS_TASK CHECKREQUEST 1. Class check 2. Initialization 3. Enumeration 4. Task processing processing wait processing processing enumeration Return PDCD_Task USBC_TRCV_MSG ? 5. Task processing Return Figure 3.1 PDCD/HDCD Sequence for non-OS 3.4 Note The customer will need to make a variety of customizations, for example designating classes, issuing vendor-specific requests, making settings with regard to the communication speed or program capacity, or making individual settings that affect the user interface. Note: USB-BASIC-F/W is not guaranteed to provide USB communication operation. The customer should verify operation when utilizing it in a system and confirm the ability to connect to a variety of different types of devices. R01AN0512EJ0110 Rev.1.10 Page 12 of 126 Jun 10, 2011
  • 13. USB Basic Firmware 4. User-Defined Macros 4.1 Overview USB-BASIC-F/W includes macros for hardware register access (including FIFO access), so an executable file customized to the customer’s requirements can be generated by rewriting the macro header files. Make appropriate changes to the macros for accessing the registers and FIFOs to match the system under development. The macros comprise the six types listed below. Scheduler macros are defined in (r_usbc_cMacSystemcall.h), debug output macros in (r_usbc_cMacPrint.h), and register access macros in (r_usb_cMacUsr.h). 1. Non-OS scheduler macros 2. uITRON system call macros 3. Debug output macros 4. Register and FIFO data register read/write macros 5. Register bit set/clear/modify macros 6. Status register bit clear macro 7. Status register bit set macro 4.1.1 Non-OS Scheduler Macros USB-BASIC-F/W includes the file r_usbc_cScheduler.c, which contains functions for registering the scheduler macros USBC_SND_MSG, USBC_ISND_MSG, USBC_WAI_MSG, USBC_TRCV_MSG, USBC_PGET_BLK, and USBC_REL_BLK. Functions are registered to scheduler macros in r_usbc_cMacSystemcall.h. [Function registration example] #define USBC_SND_MSG(ID, MESS) usbc_cstd_SndMsg((uint8_t)ID,(USBC_MSG_t*)MESS) #define USBC_ISND_MSG(ID, MESS) usbc_cstd_iSndMsg((uint8_t)ID,(USBC_MSG_t*)MESS) #define USBC_WAI_MSG(ID, MESS, TM) usbc_cstd_WaiMsg((uint8_t)ID, (USBC_MSG_t*)MESS, (uint16_t)TM) #define USBC_TRCV_MSG(ID, MESS, TM) usbc_cstd_RecMsg((uint8_t)ID,(USBC_MSG_t**)MESS,(USBC_TM_t)TM) #define USBC_PGET_BLK(ID, BLK) usbc_cstd_PgetBlk((uint8_t)ID,(USBC_MH_t*)BLK) #define USBC_REL_BLK(ID, BLK) usbc_cstd_RelBlk((uint8_t)ID,(USBC_MH_t)BLK) [USB_NG registration example] #define USBC_CRE_TSK(ID,INFO) USBC_NG R01AN0512EJ0110 Rev.1.10 Page 13 of 126 Jun 10, 2011
  • 14. USB Basic Firmware 4.1.2 uITRON System Call Macro The uITRON system call macro is shown below. Modify the code as necessary to match the ITRON version used. Note that ITRON macros are redefined for USB-BASIC-F/W in the file r_usbc_cMacSystemcall.h, so the ITRON macros are defined by conditional compilation even when ITRON is not used. Therefore, this file should be also be modified to match the ITRON version used. #define USBC_CRE_TSK(ID,INFO) cre_tsk( (USBC_ID_t)ID, (USBC_TSK_t*)INFO ) #define USBC_DEL_TSK(ID) del_tsk( (USBC_ID_t)ID ) #define USBC_STA_TSK(ID,CODE) sta_tsk( (USBC_ID_t)ID, (USBC_VI_t)CODE ) #define USBC_ACT_TSK(ID) act_tsk( (USBC_ID_t)ID ) #define USBC_TER_TSK(ID) ter_tsk( (USBC_ID_t)ID ) #define USBC_EXT_TSK() ext_tsk( ) #define USBC_REF_TST(ID, STS) ref_tst( (USBC_ID_t)ID, (USBC_RTST_t*)STS ) #define USBC_DLY_TSK(TIME) dly_tsk( (USBC_RT_t)TIME ) #define USBC_CRE_MBX(ID, INFO) cre_mbx( (USBC_ID_t)ID, (USBC_MBX_t*)INFO ) #define USBC_DEL_MBX(ID) del_mbx( (USBC_ID_t)ID ) #define USBC_SND_MSG(ID, MESS) snd_mbx( (USBC_ID_t)ID, (USBC_MSG_t*)MESS ) #define USBC_ISND_MSG(ID, MESS) isnd_mbx( (USBC_ID_t)ID, (USBC_MSG_t*)MESS ) #define USBC_RCV_MSG(ID, MESS) rcv_mbx( (USBC_ID_t)ID, (USBC_MSG_t**)MESS ) #define USBC_PRCV_MSG(ID, MESS) prcv_mbx( (USBC_ID_t)ID, (USBC_MSG_t**)MESS ) #define USBC_TRCV_MSG(ID, MESS, TM) trcv_mbx( (USBC_ID_t)ID, (USBC_MSG_t**)MESS, (USBC_TM_t)TM ) #define USBC_CRE_MPL(ID, INFO) cre_mpf( (USBC_ID_t)ID, (USBC_MPL_t*)INFO ) #define USBC_DEL_MPL(ID) del_mpf( (USBC_ID_t)ID ) #define USBC_PGET_BLK(ID, BLK) pget_mpf( (USBC_ID_t)ID, (USBC_MH_t*)BLK ) #define USBC_IPGET_BLK(ID, BLK) ipget_mpf( (USBC_ID_t)ID, (USBC_MH_t*)BLK ) #define USBC_REL_BLK(ID, BLK) rel_mpf( (USBC_ID_t)ID, (USBC_MH_t)BLK ) #define USBC_CRE_SEM(ID, INFO) cre_sem( (USBC_ID_t)ID, (USBC_SEM_t*)INFO ) #define USBC_WAI_SEM(ID) wai_sem( (USBC_ID_t)ID ) #define USBC_POL_SEM(ID) pol_sem( (USBC_ID_t)ID ) #define USBC_SIG_SEM(ID) sig_sem( (USBC_ID_t)ID ) #define USBC_CRE_ALM(ID, INFO) cre_alm( (USBC_ID_t)ID, (USBC_ALM_t*)INFO ) #define USBC_STA_ALM(ID, TIME) sta_alm( (USBC_ID_t)ID, (USBC_RT_t)TIME ) #define USBC_STP_ALM(ID) stp_alm( (USBC_ID_t)ID ) #define USBC_DEL_ALM(ID) del_alm( (USBC_ID_t)ID ) R01AN0512EJ0110 Rev.1.10 Page 14 of 126 Jun 10, 2011
  • 15. USB Basic Firmware 4.1.3 Debug Information Output Macros This type of macro outputs debug information to a UART or display device. A serial driver or display device driver is required. #define USBC_SPRINTF0(FORM) fprintf(stderr,FORM) #define USBC_SPRINTF1(FORM,x1) fprintf(stderr,FORM,x1) #define USBC_SPRINTF2(FORM,x1,x2) fprintf(stderr,FORM,x1,x2) #define USBC_SPRINTF3(FORM,x1,x2,x3) fprintf(stderr,FORM,x1,x2,x3) #define USBC_SPRINTF4(FORM,x1,x2,x3,x4) fprintf(stderr,FORM,x1,x2,x3,x4) #define USBC_SPRINTF5(FORM,x1,x2,x3,x4,x5) fprintf(stderr,FORM,x1,x2,x3,x4,x5) #define USBC_SPRINTF6(FORM,x1,x2,x3,x4,x5,x6) fprintf(stderr,FORM,x1,x2,x3,x4,x5,x6) #define USBC_SPRINTF7(FORM,x1,x2,x3,x4,x5,x6,x7) fprintf(stderr,FORM,x1,x2,x3,x4,x5,x6,x7) #define USBC_SPRINTF8(FORM,x1,x2,x3,x4,x5,x6,x7,x8) fprintf(stderr,FORM,x1,x2,x3,x4,x5,x6,x7,x8) #define USBC_PRINTF0(FORM) printf(FORM) #define USBC_PRINTF1(FORM,x1) printf(FORM,x1) #define USBC_PRINTF2(FORM,x1,x2) printf(FORM,x1,x2) #define USBC_PRINTF3(FORM,x1,x2,x3) printf(FORM,x1,x2,x3) #define USBC_PRINTF4(FORM,x1,x2,x3,x4) printf(FORM,x1,x2,x3,x4) #define USBC_PRINTF5(FORM,x1,x2,x3,x4,x5) printf(FORM,x1,x2,x3,x4,x5) #define USBC_PRINTF6(FORM,x1,x2,x3,x4,x5,x6) printf(FORM,x1,x2,x3,x4,x5,x6) #define USBC_PRINTF7(FORM,x1,x2,x3,x4,x5,x6,x7) printf(FORM,x1,x2,x3,x4,x5,x6,x7) #define USBC_PRINTF8(FORM,x1,x2,x3,x4,x5,x6,x7,x8) printf(FORM,x1,x2,x3,x4,x5,x6,x7,x8) If no debug information will be output, the following lines should be commented out as shown. //#define USBC_DEBUGSIO_PP /* enable serial out (printf) */ //#define USBC_DEBUGLCD_PP /* enable display out (lprintf) */ 4.1.4 Register and FIFO Data Register Read/Write Macros This type of macro performs read or write access to registers or FIFO port registers. #define USB_RD( r, v ) do { (( v ) = ( USB_IP.r.WORD )); } while(0) #define USB_WR( r, v ) do { (( USB_IP.r.WORD ) = ( v )); } while(0) #define USB_RDW( r, v ) do { (( v ) = ( USB_IP.r )); } while(0) #define USB_WRW( r, v ) do { (( USB_IP.r ) = ( v )); } while(0) #define USB_RD_FF( r, v ) do { (( v ) = ( USB_IP.r )); } while(0) #define USB_WR_FF( r, v ) do { (( USB_IP.r ) = ( v )); } while(0) R01AN0512EJ0110 Rev.1.10 Page 15 of 126 Jun 10, 2011
  • 16. USB Basic Firmware 4.1.5 Register Bit Set/Clear/Modify Macros This type of macro sets, clears, or modifies the value of bits in registers. Each macro is written to accommodate the RMW (Read Modify Write) instruction, and it uses a register and FIFO data register read/write macro of the type mentioned above. Notes: 1. These macros do not need to be modified by the customer. 2. Do not use the bit clear macro to clear bits in status registers. /* set bit(s) of USB register */ /* r : USB register */ /* v : value to set */ #define USB_SET_PAT( r, v ) do { (( USB_IP.r.WORD ) |= ( v )); } while(0) /* reset bit(s) of USB register */ /* r : USB register */ /* m : bit pattern to reset */ #define USB_CLR_PAT( r, m ) do { (( USB_IP.r.WORD ) &= ( (uint16_t)(~(m)) )); } while(0) /* modify bit(s) of USB register */ /* r : USB register */ /* v : value to set */ /* m : bit pattern to modify */ #define USB_MDF_PAT( r, v, m ) do { uint16_t mtmp; USB_RD( r, mtmp ); mtmp &= ( (uint16_t)(~(m)) ); mtmp |= ( (uint16_t)(v & m) ); USB_WR( r, mtmp ); } while(0) 4.1.6 Status Register Bit Clear Macro This macro clears bits in status registers. This macro is written to accommodate the RMW (Read Modify Write) instruction, and it uses a register and FIFO data register read/write macro of the type mentioned above. This macro is designed to avoid deleting status bits that have changed during the execution of the RMW instruction. Notes: 1. This macro does not need to be modified by the customer. 2. This macro should only be used for status registers where writing 1 has no effect. /* reset bit(s) of USB status */ /* r : USB register */ /* m : bit pattern to reset */ #define USB_CLR_STS( r, m ) USB_WR( r, ( (uint16_t)(~(m)) ) ) R01AN0512EJ0110 Rev.1.10 Page 16 of 126 Jun 10, 2011
  • 17. USB Basic Firmware 5. User-Defined Information 5.1 Overview An executable file customized to the customer’s requirements can be generated by rewriting the user system definition information file (r_usbc_cDefUsr.h) and user-defined information file (r_usb_cDefUsr.h) included in USB-BASIC-F/W. The items listed below should be changed to match the system under development. 5.2 User System Definition Information File (r_usbc_cDefUsr.h) 1. Target device designation 2. Installed USB-IP type designation 3. 597IP function designation (number of Pipe) 4. 597IP function designation (number of Device Address) 5. 597IP function designation (buffer size) 6. Transfer speed designation 7. Bus width designation 8. USB port designation 9. External bus operating voltage designation 10. Oscillating frequency of connected resonator 11. Operating environment designation 12. Create Systemcall designation (uITRON) 13. CPU byte endian designation 14. DTC/DMA designation 15. Low Power Mode designation 16. PID = NAK setting at transfer end enable designation (peripheral function mode) 17. Software retry count at pipe no-response (host function mode) 18. Control read data buffer size (host function mode) 19. Device address initial value (host function mode) 20. Hub down port count (host function mode) 5.2.1 Target Device Designation The target device may be specified as either of the following two options. 1) USBC_ASSP_PP: R8A66597 2) USBC_RX600_PP: RX62N or RX630 Example: RX62N or RX630 #define USBC_TARGET_CHIP_PP USBC_RX600_PP This setting is selected by the macro definition of HEW project in USB-BASIC-F/W. The macro definition is selected from option category in Standard toolchain of compiler tab. 5.2.2 Installed USB-IP Type Designation The USB-IP type may be specified as either of the following three options. 1) USBC_592IP_PP: Installed 592IP 2) USBC_596IP_PP: Installed 596IP 3) USBC_597IP_PP: Installed 597IP Example: Installed 597IP #define USBC_IPSEL_PP USBC_597IP_PP R01AN0512EJ0110 Rev.1.10 Page 17 of 126 Jun 10, 2011
  • 18. USB Basic Firmware 5.2.3 597IP Function Designation (Number of Pipe) The number of pipe may be specified as either of the following two options. 1) USBC_IP_PIPE_9_PP: 1-9 of PIPE use 2) USBC_IP_PIPE_7_PP: 1-7 of PIPE use Example: 1-9 of PIPE use #define USBC_IP_PIPE_PP USBC_IP_PIPE_9_PP 5.2.4 597IP Function Designation (Number of Device Address) The number of device address may be specified as either of the following two options. 1) USBC_IP_DEVADD_A_PP: 10 device address use 2) USBC_IP_DEVADD_5_PP: 5 device address use Example: 5 device address use #define USBC_IP_DEVADD_PP USBC_IP_DEVADD_5_PP 5.2.5 597IP Function Designation (Buffer Size) The buffer type may be specified as either of the following two options. 1) USBC_PIPEBUFF_FIX_PP: PIPEBUF is fixation 2) USBC_PIPEBUFF_CHANGE_PP: PIPEBUF is changeable Example: PIPEBUF is fixation #define USBC_PIPEBUF_MODE_PP USBC_PIPEBUF_CHANGE_PP 5.2.6 Transfer Speed Designation The target speed may be specified as either of the following two options. 1) USBC_HS_PP: High-Speed support 2) USBC_FS_PP: Full-Speed support Example: Full-Speed support #define USBC_SPEEDSEL_PP USBC_FS_PP 5.2.7 Bus Width Designation The bus width may be specified as either of the following two options. 1) USBC_BUSSIZE_16_PP: 16 bits 2) USBC_BUSSIZE_32_PP: 32 bits Example: 16 bits #define USBC_BUSSIZE_PP USBC_BUSSIZE_16_PP R01AN0512EJ0110 Rev.1.10 Page 18 of 126 Jun 10, 2011
  • 19. USB Basic Firmware 5.2.8 USB Port Designation The USB port may be specified as either of the following two options. 1) USBC_1PORT_PP: 1 USB Port use 2) USBC_2PORT_PP: 2 USB Ports use Example: 1 USB Port use #define USBC_PORTSEL_PP USBC_1PORT_PP 5.2.9 Operating Environment Designation The operating environment may be specified as either of the following two options. 1) USBC_FW_OS_PP: OS support 2) USBC_FW_NONOS_PP: No OS support Example: No OS support #define USBC_FW_PP USBC_FW_NONOS_PP This setting is selected by the macro definition of HEW project in USB-BASIC-F/W. The macro definition is selected from option category in Standard toolchain of compiler tab. 5.2.10 External Bus Operating Voltage Designation The external bus operating voltage may be specified as either of the following two options. 1) USBC_VIF1: 1.8 V applied to external bus pins. 2) USBC_VIF3: 3.3 V external bus pins. Example: 3.3 V #define USB_LDRVSEL USBC_VIF3 For the RX62N and RX630, use the USBC_VIF3 setting. 5.2.11 Oscillating Frequency of Connected Resonator Oscillating frequency of connected resonator may be specified as one of the following three options. 1) USBC_XTAL48: 48 MHz resonator connected. 2) USBC_XTAL24: 24 MHz resonator connected. 3) USBC_XTAL12: 12 MHz resonator connected. Example: 24 MHz resonator #define USBC_XINSEL USBC_XTAL24 For the RX62N and RX630. Use the USBC_XTAL24 setting. R01AN0512EJ0110 Rev.1.10 Page 19 of 126 Jun 10, 2011
  • 20. USB Basic Firmware 5.2.12 Create System call Designation (uITRON) It may be specified as either of the following two options that the Task Creation System call is supported or not supported. 1) USBC_OS_CRE_USE_PP: Task Creation System call support 2) USBC_OS_CRE_NOTUSE_PP: No Task Creation System call support Example: No Task Creation System call support #define USBC_OS_CRE_MODE_PP USBC_OS_CRE_NOTUSE_PP 5.2.13 CPU Byte Endian Designation The CPU byte endian may be specified as either of the following two options. This setting is for CPU access to FIFO. 1) USBC_BYTE_LITTLE_PP: Little Endian (Definition from upper byte) 2) USBC_BYTE_BIG_PP: Big Endian (Definition from under byte) Example: Little endian #define USBC_CPUBYTE_PP USBC_BYTE_LITTLE_PP 5.2.14 DTC/DMA Designation The DTC/DMA may be specified as either of the following two options. 1) USBC_TRANS_DMA_PP: DMA 2) USBC_TRANS_DTC_PP: DTC Example: DTC #define USBC_TRANS_MODE_PP USBC_TRANS_DTC_PP The RX62N and RX630 support only DTC. Use the USBC_TRANS_DTC_PP setting. 5.2.15 Low Power Mode Designation The low power mode may be specified as either of the following two options. 1) USBC_LPWR_NOT_USE_PP: Not low power mode 2) USBC_ LPWR_USE_PP: Low power mode Example: Not low power mode #define USBC_LPWR_MODE_PP USBC_LPWR_NOT_USE_PP For the R8A66597, use the USBC_LPWR_NOT_USE_PP setting. 5.2.16 PID = NAK Setting at Transfer End Enable Designation (Peripheral Function Mode) It may be specified as either of the following two options that the PID = NAK set or not set at transfer end enable. 1) USBC_NONPERIODIC_PP: PID = NAK 2) USBC_PERIODIC_PP: No PID = NAK Example: PID = NAK #define USBC_PERIODIC_MODE_PP USBC_PERIODIC_PP R01AN0512EJ0110 Rev.1.10 Page 20 of 126 Jun 10, 2011
  • 21. USB Basic Firmware 5.2.17 Software Retry Count at Pipe No-Response (Host Function Mode) It is necessary to specify the number of software retries when a no-response condition occurs during a transfer. Example: Up to one retry by USB-BASIC-F/W at pipe no-response #define USBC_PIPEERR 1u 5.2.18 Control Read Data Buffer Size (Host Function Mode) It is necessary to specify the data buffer size when a control read transfer is received. Example: 20-byte device descriptor, 256-byte configuration descriptor #define USBC_DEVICESIZE 20u #define USBC_CONFIGSIZE 256u 5.2.19 Device Address (Host Function Mode) It is necessary to specify the device address of the device connected to PORT0. Example: Device address starts from 2. #define USBC_DEVICEADDR 2u For the RX62N, addresses in the range 1 to 5 may be specified. For the R8A66597, addresses in the range 1 to 10 may be specified. 5.2.20 Hub Down Port Count (Host Function Mode) It is necessary to specify the number of hub down ports that can be connected. Example: Connected hub has 4 down ports. #define USBC_HUBDOWNPORT 4u R01AN0512EJ0110 Rev.1.10 Page 21 of 126 Jun 10, 2011
  • 22. USB Basic Firmware 5.2.21 User System Definition Information for Each Devices The user system definition information for each device is shown below. Table 5.1 For the RX62N, the user system definition information (r_usbc_cDefUsr.h) Section Flag Set Object Set Value Remarks Number * (o: default setting) 5.2.1 - USBC_TARGET_CHIP_PP o USBC_RX600_PP This setting is selected by the macro definition of HEW project. 5.2.2 - USBC_IPSEL_PP o USBC_597IP_PP 5.2.3 - USBC_IP_PIPE_PP o USBC_IP_PIPE_9_PP 5.2.4 - USBC_IP_DEVADD_PP o USBC_IP_DEVADD_5_PP 5.2.5 - USBC_PIPEBUF_MODE_PP o USBC_PIPEBUF_FIX_PP 5.2.6 - USBC_SPEEDSEL_PP o USBC_FS_PP 5.2.7 - USBC_BUSSIZE_PP o USBC_BUSSIZE_16_PP 5.2.8 - USBC_PORTSEL_PP o USBC_1PORT_PP 5.2.9 - USBC_LDRVSEL o USBC_VIF3 (NOT_USED) 5.2.10 - USBC_XINSEL o USBC_XTAL24 5.2.11 O USBC_FW_PP USBC_FW_NONOS_PP This setting is USBC_FW_OS_PP selected by the macro definition of HEW project. 5.2.12 O USBC_OS_CRE_MODE_PP o USBC_OS_CRE_NOTUSE_PP If USBC_OS_CRE_USE_PP USB_C_FW_NO NOS_PP setting in 5,2,11, use the default setting. If RI600 is used, use the default setting. 5.2.13 O USBC_CPUBYTE_PP o USBC_BYTE_LITTLE_PP USBC_BYTE_BIG_PP 5.2.14 - USBC_TRANS_MODE_PP o USBC_TRANS_DTC_PP 5.2.15 O USBC_LPWR_MODE_PP o USBC_LPWR_NOT_USE_PP USBC_LPWR_USE_PP 5.2.16 O USBC_PERIODIC_MODE_P o USBC_NONPERIODIC_PP P USBC_PERIODIC_PP 5.2.17 O USBC_PIPEERROR o 1u 5.2.18 O USBC_DEVICESIZE o 20u O USBC_CONFIGSIZE o 256u 5.2.19 O USBC_DEVICEADDR o 1u 5.2.20 O USBC_HUBDOWNPORT o 4u * : Flag - : Not selected(Use the default setting.), O: Select from Set Value. R01AN0512EJ0110 Rev.1.10 Page 22 of 126 Jun 10, 2011
  • 23. USB Basic Firmware Table 5.2 For the RX630, the user system definition information (r_usbc_cDefUsr.h) Section Flag Set Object Set Value Remarks Number * (o: default setting) 5.2.1 - USBC_TARGET_CHIP_PP o USBC_RX600_PP This setting is selected by the macro definition of HEW project. 5.2.2 - USBC_IPSEL_PP o USBC_597IP_PP 5.2.3 - USBC_IP_PIPE_PP o USBC_IP_PIPE_9_PP 5.2.4 - USBC_IP_DEVADD_PP o USBC_IP_DEVADD_5_PP 5.2.5 - USBC_PIPEBUF_MODE_PP o USBC_PIPEBUF_FIX_PP 5.2.6 - USBC_SPEEDSEL_PP o USBC_FS_PP 5.2.7 - USBC_BUSSIZE_PP o USBC_BUSSIZE_16_PP 5.2.8 - USBC_PORTSEL_PP o USBC_1PORT_PP 5.2.9 - USBC_LDRVSEL o USBC_VIF3 (NOT_USED) 5.2.10 - USBC_XINSEL o USBC_XTAL24 5.2.11 O USBC_FW_PP USBC_FW_NONOS_PP This setting is USBC_FW_OS_PP selected by the macro definition of HEW project. 5.2.12 O USBC_OS_CRE_MODE_PP o USBC_OS_CRE_NOTUSE_PP If USBC_OS_CRE_USE_PP USB_C_FW_NO NOS_PP setting in 5,2,11, use the default setting. If RI600 is used, use the default setting. 5.2.13 O USBC_CPUBYTE_PP o USBC_BYTE_LITTLE_PP USBC_BYTE_BIG_PP 5.2.14 - USBC_TRANS_MODE_PP o USBC_TRANS_DTC_PP 5.2.15 O USBC_LPWR_MODE_PP o USBC_LPWR_NOT_USE_PP USBC_LPWR_USE_PP 5.2.16 O USBC_PERIODIC_MODE_P o USBC_NONPERIODIC_PP P USBC_PERIODIC_PP 5.2.17 - USBC_PIPEERROR o 1u 5.2.18 - USBC_DEVICESIZE o 20u - USBC_CONFIGSIZE o 256u 5.2.19 - USBC_DEVICEADDR o 1u 5.2.20 - USBC_HUBDOWNPORT o 4u * : Flag - : Not selected(Use the default setting.), O: Select from Set Value. R01AN0512EJ0110 Rev.1.10 Page 23 of 126 Jun 10, 2011
  • 24. USB Basic Firmware Table 5.3 For the R8A66597, the user system definition information (r_usbc_cDefUsr.h) Section Flag Set Object Set Value Remarks Number * (o: default setting) 5.2.1 - USBC_TARGET_CHIP_PP o USBC_ASSP_PP This setting is selected by the macro definition of HEW project. 5.2.2 - USBC_IPSEL_PP o USBC_597IP_PP 5.2.3 - USBC_IP_PIPE_PP o USBC_IP_PIPE_9_PP 5.2.4 - USBC_IP_DEVADD_PP o USBC_IP_DEVADD_A_PP 5.2.5 - USBC_PIPEBUF_MODE_PP o USBC_PIPEBUF_CHANGE_PP 5.2.6 - USBC_SPEEDSEL_PP o USBC_HS_PP 5.2.7 - USBC_BUSSIZE_PP o USBC_BUSSIZE_16_PP 5.2.8 O USBC_PORTSEL_PP o USBC_2PORT_PP USBC_1PORT_PP 5.2.9 O USBC_LDRVSEL USBC_VIF1 (NOT_USED) o USBC_VIF3 5.2.10 O USBC_XINSEL USBC_XTAL12 o USBC_XTAL24 USBC_XTAL48 5.2.11 - USBC_FW_PP o USBC_FW_NONOS_PP This setting is selected by the macro definition of HEW project. 5.2.12 - USBC_OS_CRE_MODE_PP o USBC_OS_CRE_NOTUSE_PP 5.2.13 O USBC_CPUBYTE_PP o USBC_BYTE_LITTLE_PP USBC_BYTE_BIG_PP 5.2.14 - USBC_TRANS_MODE_PP o USBC_TRANS_DTC_PP 5.2.15 - USBC_LPWR_MODE_PP o USBC_LPWR_NOT_USE_PP 5.2.16 O USBC_PERIODIC_MODE_P o USBC_NONPERIODIC_PP P USBC_PERIODIC_PP 5.2.17 O USBC_PIPEERROR o 1u 5.2.18 O USBC_DEVICESIZE o 20u O USBC_CONFIGSIZE o 256u 5.2.19 O USBC_DEVICEADDR o 1u 5.2.20 O USBC_HUBDOWNPORT o 4u * : Flag - : Not selected(Use the default setting.), O: Select from Set Value. R01AN0512EJ0110 Rev.1.10 Page 24 of 126 Jun 10, 2011
  • 25. USB Basic Firmware 5.3 User-Defined Information File (r_usb_cDefUsr.h) 1. USB Function designation 2. Power Consumption Control Function designation 3. Auto Clock Mode designation 4. Sleep Mode designation 5. Hardware address designation 6. Hi-speed operation enable/disable 5.3.1 USB Function Designation The hardware function may be specified as one of the following three options. 1) USBC_HOST_PP: Used as USB host. 2) USBC_PERI_PP: Used as USB peripheral. 3) USBC_HOST_PERI_PP: Used as both USB host and USB peripheral. Example: USB peripheral #define USBC_FUNCSEL_PP USBC_PERI_PP 5.3.2 Power Consumption Control Function Designation It is necessary to specify the power consumption control function. Reference: The power consumption control function may be specified as one of the following three options. 1) USBC_NOT_STOP_PP: The power consumption control is not used (clock does not stop). 2) USBC_XCKE_USE_PP: The power consumption control function is used with the clock in the stopped state. 3) USBC_PCUT_USE_PP: The low-power sleep state is used. (This setting is for M66592 and M66596.) Example: The power consumption control is not used #define USBC_OSCSEL_PP USBC_CLK_NOT_STOP_PP This function is not used by the RX62N and RX630. Use the USBC_CLK_NOT_STOP_PP setting. For the R8A66597, use the USBC_NOT_STOP_PP or the USBC_XCKE_USE_PP setting. 5.3.3 Auto Clock Mode Designation The hardware function may be specified as one of the following two options. 1) USBC_ATCKM_NOT_USE_PP: No auto clock mode 2) USBC_ATCKM_USE_PP: Auto clock mode (This setting is for M66592 and M66596.) Example: No auto clock mode #define USBC_ATCKMSEL_PP USBC_ATCKM_NOT_USE_PP This function is not used by the RX62N, RX630 and R8A66597. Use the USBC_ATCKM_NOT_USE_PP setting. R01AN0512EJ0110 Rev.1.10 Page 25 of 126 Jun 10, 2011
  • 26. USB Basic Firmware 5.3.4 Sleep Mode Designation The sleep mode may be specified as one of the following two options. 1) USBC_LPSM_DISABLE_PP: No sleep mode 2) USBC_LPSM_ENABLE_PP: Sleep mode (The setting is for R8A66597.) Example: No sleep mode #define USBC_LPWRSEL_PP USBC_LPSM_DISABLE_PP This function is not used by the RX62N and RX630. Use the USBC_LPSM_DISABLE_PP setting. 5.3.5 Hardware Address Designation It is necessary to specify the standard address for accessing the hardware. For each register, the address is specified as an offset from the designated standard address. Example: 0x05000000 #define USBC_BASE (uint32_t)(0x05000000) This setting is not used by the RX62N and RX630. (#define USB0 specifies the address.) 5.3.6 Hi-Speed Operation Enable/Disable Either of the following two options may be selected for hi-speed operation. 1) USBC_HS_DISABLE: Full- or low-speed operation will be selected automatically according to the connected device. 2) USBC_HS_ENABLE: Hi-, full-, or low-speed operation will be selected automatically according to the connected device. Example: Disabled #define USBC_HSESEL USBC_HS_DISABLE For the RX62N and RX630, select USBC_HS_DISABLE. R01AN0512EJ0110 Rev.1.10 Page 26 of 126 Jun 10, 2011
  • 27. USB Basic Firmware 5.3.7 User System Definition Information for Each Device The user system definition information for each device is shown below. Table 5.4 For the RX62N, the user system definition information (r_usb_cDefUsr.h) Section Flag Set Object Set Value Remarks Number * (o: default setting) 5.3.1 O USBC_FUNCSEL_PP USBC_HOST_PP This setting is USBC_PERI_PP selected by the USBC_HOST_PERI_PP macro definition of HEW project. 5.3.2 - USBC_OSCSEL_PP o USBC_CLK_NOT_STOP_PP 5.3.3 - USBC_ATCKMSEL_PP o USBC_ATCKM_NOT_USE_PP 5.3.4 - USBC_LPWRSEL_PP o USBC_LPWR_DISABLE_PP 5.3.5 - USB_BASE o 0x000A0000 5.3.6 - USB_HSESEL o USBC_HS_DISABLE * : Flag - : Not selected(Use the default setting.), O: Select from Set Value. Table 5.5 For the RX630, the user system definition information (r_usb_cDefUsr.h) Section Flag Set Object Set Value Remarks Number * (o: default setting) 5.3.1 - USBC_FUNCSEL_PP USBC_PERI_PP This setting is selected by the macro definition of HEW project. 5.3.2 - USBC_OSCSEL_PP o USBC_CLK_NOT_STOP_PP 5.3.3 - USBC_ATCKMSEL_PP o USBC_ATCKM_NOT_USE_PP 5.3.4 - USBC_LPWRSEL_PP o USBC_LPWR_DISABLE_PP 5.3.5 - USB_BASE o 0x000A0000 5.3.6 - USB_HSESEL o USBC_HS_DISABLE * : Flag - : Not selected(Use the default setting.), O: Select from Set Value. Table 5.6 For the R8A66597, the user system definition information (r_usb_cDefUsr.h) Section Flag Set Object Set Value Remarks Number * (o: default setting) 5.3.1 O USBC_FUNCSEL_PP USBC_HOST_PP This setting is USBC_PERI_PP selected by the macro definition of HEW project. 5.3.2 O USBC_OSCSEL_PP o USBC_CLK_NOT_STOP_PP USBC_CLK_XCKE_USE_PP 5.3.3 - USBC_ATCKMSEL_PP o USBC_ATCKM_NOT_USE_PP 5.3.4 O USBC_LPWRSEL_PP o USBC_LPWR_DISABLE_PP USBC_LPWR_ENABLE_PP 5.3.5 O USB_BASE o 0x05000000 5.3.6 O USB_HSESEL o USBC_HS_ENABLE USBC_HS_DISABLE * : Flag - : Not selected(Use the default setting.), O: Select from Set Value. R01AN0512EJ0110 Rev.1.10 Page 27 of 126 Jun 10, 2011
  • 28. USB Basic Firmware 6. Workspace 6.1 Overview The workspace of USB-BASIC-F/W is described below. Workspace of USB-BASIC-F/W includes two projects. 1. NonOS_StdFw: non-OS 2. Itron_StdFw: uITRON (R8A66597 is not supported) And, USB-BASIC-F/W includes build configurations. [For the RX62N] 1. PORT0_P: PORT0 is Peripheral mode 2. PORT1_H: PORT1 is Host mode 3. PORT0_P_PORT1_H:USB0 is Peripheral mode and USB1 is Host mode [For the RX630] 4. RX630_PORT0_P: PORT0 is Peripheral mode [For the R8A66597] 5. ASSP_PERI: PORT0 is Peripheral mode 6. ASSP_HOST: PORT1 is Host mode Each configuration selects source files as compiled. In peripheral function mode, USB-BASIC-F/W comprises two tasks, PCD and sample application, and a scheduler. In host function mode, it comprises four tasks, HCD, MGR, HUB, and sample application, and a scheduler. Sample application is run as tasks. R01AN0512EJ0110 Rev.1.10 Page 28 of 126 Jun 10, 2011
  • 29. USB Basic Firmware 6.2 Structure of Files and folders 6.2.1 Folder Structure The folder structure in which the files are provided in USB-BASIC-F/W is shown below. These provided files in USB- BASIC-F/W include sample application and sample code of resource for hardware. < HEW workspace: USBSTDFW > (USB-BASIC-F/W) +⎯⎯⎯ USBSTDFW For USB0 | +⎯⎯⎯ class | | +⎯⎯⎯ hubd Sample hub driver | | +⎯⎯⎯ smpl USB standard request sample | +⎯⎯⎯ include Common header file | +⎯⎯⎯ USB20 | +⎯⎯⎯ HCD Host control driver | +⎯⎯⎯ PCD Peripheral control driver | +⎯⎯⎯ LIB Common library +⎯⎯⎯ USB2STDFW For USB1 (RX630 and R8A66597 are not used.) | Structure is same to USBSTDFW +⎯⎯⎯ USBCSTDFW For USB0 and USB1 | +⎯⎯⎯ include Common header file (The following is sample code) +⎯⎯⎯ RI600_4 For uITRON | +⎯⎯⎯ config_Pstd For PORT0_P and RX630_PORT0_P | +⎯⎯⎯ config_Hstd For PORT1_H | +⎯⎯⎯ config_Cstd For PORT0_P_PORT1_H +⎯⎯⎯ HwResourceForUSB Resource for hardware | +⎯⎯⎯ RX62N For RX62N | +⎯⎯⎯ RX630 For RX630 +⎯⎯⎯ SmplMain +⎯⎯⎯ APL Sample application +⎯⎯⎯ Project Each projects R01AN0512EJ0110 Rev.1.10 Page 29 of 126 Jun 10, 2011
  • 30. USB Basic Firmware 6.2.2 List of Files The files provided in USB-BASIC-F/W are listed below. The files of USB2STDFW folder are left out. Table 6.1 List of Files Folder File Name Description Project (O: Selected ) 1) 2) 3) 4) 5) 6) * * * * * * HCD r_usb_hControlRW.c Control read/write processing O O O HCD r_usb_hDriver.c HCD task O O O HCD r_usb_hDriverAPI.c HCD/MGR API functions O O O HCD r_usb_hIntFIFO.c INTR, INTN, BEMP interrupt O O O processing HCD r_usb_hManager.c MGR task O O O HCD r_usb_hSignal.c USB signal control, oscillation control O O O processing HCD r_usb_hStdFunction. USB function extension library O O O c functions HCD r_usb_hLibUSBIP.c USB library functions O O O PCD r_usb_pControlRW.c Control read/write processing O O O O PCD r_usb_pDriver.c PCD task O O O O PCD r_usb_pDriverAPI.c PCD API functions O O O O PCD r_usb_pIntFIFO.c INTR, INTN, BEMP interrupt O O O O processing PCD r_usb_pSignal.c USB signal control, oscillation control O O O O processing PCD r_usb_pStdRequest.c USB standard request responses O O O O PCD r_usb_pStdFunction. USB function extension library O O O O c functions PCD r_usb_pLibUSBIP.c USB library functions O O O O LIB r_usb_cDataIO.c Data read/write, FIFO access O O O O O O processing LIB r_usb_cIntFIFO.c INTR, INTN, BEMP interrupt O O O O O O processing LIB r_usb_cIntHandler.c USB interrupt handler O O O O O O LIB r_usb_cLibUSBIP.c USB library functions O O O O O O LIB r_usb_cSignal.c USB signal control, oscillation control O O O O O O processing LIB r_usb_cStdFunction. USB function extension library O O O O O O c functions (host/peripheral mixed) USBCSTDFW r_usbc_cScheduler.c Scheduler control O O O O O O include r_usbc_cDefUSBIP.h USB driver definitions O O O O O O include r_usbc_cItron.h System header file O O O O O O include r_usbc_cKernelID.h ID definitions (Task ID, etc.) O O O O O O include r_usbc_cMacSystem Macro definitions (scheduler macros) O O O O O O call.h include r_usbc_cMacPrint.h Macro definitions O O O O O O (macros for displaying debug information) include r_usbc_cTypedef.h Variable type definitions O O O O O O include r_usbc_cDef592IP.h Register definitions for 592IP (not used by RX62N) R01AN0512EJ0110 Rev.1.10 Page 30 of 126 Jun 10, 2011
  • 31. USB Basic Firmware Project (O: Selected ) include r_usbc_cDef596IP.h Register definitions for 596IP (not used by RX62N) include r_usbc_cDef597IP.h Register definitions for 597IP O O (not used by RX62N) include r_usbc_cUsbDefBitD USB register definitions for RX600 O O O O efine.h series include r_usb_cDefUsr.h User setting (hardware operation O O O O O O designation) definitions include r_usbc_cDefUsrPp.h USB driver definitions O O O O O O include r_usb_cExtern.h USB-BASIC-F/W external reference O O O O O O definitions include r_usb_cMacUsr.h Macro definitions (register access O O O O O O macros) include r_usb_cRevision.h Common library revision designations O O O O O O hubd r_usb_hHubsys.c HUBCD functions (non-OS) O O O hubd r_usb_hHubsys_uitro HUBCD functions (uITRON) O O n.c SMPL r_usb_pClassVendor. Peripheral class requests O O O O c SMPL r_usb_smp_cSub.c Common library functions O O O O O O SMPL r_usb_smp_hSub.c Host standard requests O O O SmplMain main.c Sample main program O O O O O O SmplMain RX62NRSK.c RX62N RSK processing O O O O O SmplMain RX630RSK.c RX630 RSK processing O SmplMain RX62NRSK_Extern.h RX62N RSK external reference O O O O O definitions SmplMain RX630RSK_Extern.h RX630 RSK external reference O definitions APL r_usbc_PHSMPL_apl Host and Peripheral sample application O .c APL r_usbc_PHSMPL_dat Data for Host and Peripheral sample O a.c application APL r_usbc_cdata.c Data transfer data for port 0 and port 1 O sample application APL r_usbc_cdata.h Data transfer settings for port 0 and O port 1 sample application APL r_usb2_HSMPL_apl. Host port 1 sample application O c APL r_usb_HSMPL_apl.c Host sample application for R8A66597 O APL r_usb2_cdata.c Data transfer data for port 1 sample O application APL r_usb2_cdata.h Data transfer settings for port 1 sample O application APL r_usb_PSMPL_apl.c Peripheral port 0 sample application O O O APL r_usb_PSMPL_data. Data for peripheral port 0 sample O O O c application APL r_usb_cdata.c Data transfer data for port 0 sample O O O O application APL r_usb_cdata.h Data transfer settings for port 0 sample O O O O application config_Pstd r_usb_RX62N.cfg Configuration file O config_Pstd ritable_pstd.src Vector table setting O R01AN0512EJ0110 Rev.1.10 Page 31 of 126 Jun 10, 2011
  • 32. USB Basic Firmware Project (O: Selected ) config_Pstd r_usb_RX630.cfg Configuration file O config_Pstd ritable_rx630_pstd.sr Vector table setting O c config_Hstd r_usb_RX62N.cfg Configuration file O config_Hstd ritable_hstd.src Vector table setting O config_Cstd r_usb_RX62N.cfg Configuration file O config_Cstd ritable_cstd.src Vector table setting O HwResourceF ritable_rx62n.src Vector table setting for RX62N (non- O O O orUSB OS only) HwResourceF ritable_rx630.src Vector table setting for RX630 (non-OS O orUSB only) HwResourceF ritable_assp.src Vector table setting for R8A66597 O O orUSB (non-OS only) HwResourceF dbsct.c Section setting O O O O O O orUSB HwResourceF resetprg.c Reset program O O O O O O orUSB HwResourceF Output file of HEW O O O O O O orUSB RX62N iodefine.h IO definition file for RX62N O O O O O RX630 iodefine.h IO definition file for RX630 O * 1): PORT0_P, 2): PORT1_H, 3): PORT0_P_PORT1_H, 4): RX630_PORT0_P , 5): ASSP_PERI , 6): ASSP_HOST R01AN0512EJ0110 Rev.1.10 Page 32 of 126 Jun 10, 2011
  • 33. USB Basic Firmware 7. Sample Applications 7.1 Sample application for Data transfer (APL) USB-BASIC-F/W supports the sample application (APL) that can transfer data using pipes 1, 2, 6, and 7 in host or peripheral function mode as vendor specific class. When writing custom applications, refer to r_usb2_HSMPL_apl.c and r_usb_PSMPL_apl.c and make the applications. 7.1.1 APL Sequence The APL sequence in USB-BASIC-F/W is shown below. Host function mode Peripheral function mode APL APL R_usb2_hstd_ Initialize data SetPipeInfo transfer processing R_usb2_hstd_ SetPipeRegistration Initialize data transfer processing Data transfer ERROR complete ? R_usb2_hstd_ YES TransferStart Reset data transfer processing Data transfer ERROR complete ? R_usb_pstd_ TransferStart YES Count down of data transfer counter return Data transfer NO counter is not 0 ? YES R_usb2_hstd_ TransferStart All data transfer NO counter is 0 ? YES Reset data transfer processing R_usb2_hstd_ TransferStart Figure 7.1 APL sequence R01AN0512EJ0110 Rev.1.10 Page 33 of 126 Jun 10, 2011
  • 34. USB Basic Firmware 7.1.2 APL Global Area The APL global area in USB-BASIC-F/W is shown below. Table 7.1 List of APL global area (Peripheral function mode) Type Variable Description 1 USBC_UTR_t usb_gcstd_SmplTrnMsg[ ] Message area of pipes for data transfer request 2 uint32_t usb_gcstd_SmplTrnCnt[ ] Data transfer counter of pipes 3 uint32_t usb_gcstd_SmplTrnSize[ ] Data transfer size of pipes 4 uint8_t * usb_gcstd_SmplTrnPtr[ ] Data address pointer of pipes for data transfer 5 uint8_t usb_gcstd_SmplTrnData1[ ] Data address of pipe1 for data transfer 6 uint8_t usb_gcstd_SmplTrnData2[ ] Data address of pipe2 for data transfer 7 uint8_t usb_gcstd_SmplTrnData3[ ] Data address of pipe3 for data transfer 8 uint8_t usb_gcstd_SmplTrnData4[ ] Data address of pipe4 for data transfer 9 uint8_t usb_gcstd_SmplTrnData5[ ] Data address of pipe5 for data transfer 10 uint8_t usb_gcstd_SmplTrnData6[ ] Data address of pipe6 for data transfer 11 uint8_t usb_gcstd_SmplTrnData7[ ] Data address of pipe7 for data transfer 12 uint8_t usb_gcstd_SmplTrnData8[ ] Data address of pipe8 for data transfer 13 uint8_t usb_gcstd_SmplTrnData9[ ] Data address of pipe9 for data transfer 14 uint16_t usb_gpstd_SmplEpTbl1[ ] Pipe information table for data transfer application 15 uint16_t usb_gpstd_SmplEpTbl2[ ] Dummy of pipe information table 16 uint16_t usb_gpstd_SmplEpTbl3[ ] Dummy of pipe information table 17 uint16_t usb_gpstd_SmplEpTbl4[ ] Dummy of pipe information table 18 uint16_t usb_gpstd_SmplEpTbl5[ ] Dummy of pipe information table 19 uint16_t * usb_gpstd_SmplEpPtr[ ] Pointer table of pipe information table 20 uint8_t usb_gpstd_SmplDeviceDescriptor[ ] Device descriptor for data transfer application 21 uint8_t usb_gpstd_SmplQualifierDescriptor[ Qualifier descriptor for data transfer ] application 22 uint8_t usb_gpstd_SmplConfigurationH_1[ Configuration descriptor of hi-speed for data ] transfer application 23 uint8_t usb_gpstd_SmplConfigurationF_1[ ] Configuration descriptor of full-speed for data transfer application 24 uint8_t * usb_gpstd_SmplConPtr[ ] Pointer table of configuration descriptor for data transfer application 25 uint8_t * usb_gpstd_SmplConPtrOther[ ] Pointer table of other speed configuration descriptor for data transfer application 26 uint8_t usb_gpstd_StringDescriptor0[ ] String Descriptor0 for data transfer application 27 uint8_t usb_gpstd_StringDescriptor1[ ] String Descriptor1 for data transfer application 28 uint8_t usb_gpstd_StringDescriptor2[ ] String Descriptor2 for data transfer application 29 uint8_t usb_gpstd_StringDescriptor3[ ] String Descriptor3 for data transfer application 30 uint8_t usb_gpstd_StringDescriptor4[ ] String Descriptor4 for data transfer application 31 uint8_t usb_gpstd_StringDescriptor5[ ] String Descriptor5 for data transfer application 32 uint8_t * usb_gpstd_StrPtr[ ] Pointer table of string descriptor for data transfer descriptor R01AN0512EJ0110 Rev.1.10 Page 34 of 126 Jun 10, 2011
  • 35. USB Basic Firmware Table 7.2 List of APL global area (Host function mode) Type Variable Description 1 USBC_UTR_t usb2_gcstd_SmplTrnMsg[ ] Message area of pipes for data transfer request 2 uint32_t usb2_gcstd_SmplTrnCnt[ ] Data transfer counter of pipes 3 uint32_t usb2_gcstd_SmplTrnSize[ ] Data transfer size of pipes 4 uint8_t * usb2_gcstd_SmplTrnPtr[ ] Data address pointer of pipes for data transfer 5 uint8_t usb2_gcstd_SmplTrnData1[ ] Data address of pipe1 for data transfer 6 uint8_t usb2_gcstd_SmplTrnData2[ ] Data address of pipe2 for data transfer 7 uint8_t usb2_gcstd_SmplTrnData3[ ] Data address of pipe3 for data transfer 8 uint8_t usb2_gcstd_SmplTrnData4[ ] Data address of pipe4 for data transfer 9 uint8_t usb2_gcstd_SmplTrnData5[ ] Data address of pipe5 for data transfer 10 uint8_t usb2_gcstd_SmplTrnData6[ ] Data address of pipe6 for data transfer 11 uint8_t usb2_gcstd_SmplTrnData7[ ] Data address of pipe7 for data transfer 12 uint8_t usb2_gcstd_SmplTrnData8[ ] Data address of pipe8 for data transfer 13 uint8_t usb2_gcstd_SmplTrnData9[ ] Data address of pipe9 for data transfer 14 uint16_t usb2_gpstd_SmplDefEpTbl[ ] Pipe information table for data transfer application 15 uint16_t usb2_gpstd_SmplTmpEpTbl[ ] Pipe information table for data transfer application 16 const uint16_t usb2_gpstd_SmplTpl[ ] Target peripheral list(TPL) for data transfer application 17 uint16_t usb2_gpstd_SmplAdr Temporary area of device address for data transfer application 18 uint16_t usb2_gpstd_SmplClassSeq Sequence control data for data transfer application 19 uint8_t * usb2_hcls_SmplDeviceTable Temporary area of pointer of device descriptor data for data transfer application 20 uint8_t * usb2_hcls_SmplConfigTable Temporary area of pointer of configuration descriptor data for data transfer application 21 uint8_t * usb2_hcls_SmplInterfaceTable Temporary area of pointer of interface descriptor data for data transfer application 22 uint16_t usb2_hcls_SmplDevaddr Temporary area of pointer of device address data for data transfer application 23 uint16_t usb2_hcls_SmplSpeed Temporary area of pointer of device speed data for data transfer application R01AN0512EJ0110 Rev.1.10 Page 35 of 126 Jun 10, 2011
  • 36. USB Basic Firmware 7.1.3 APL Constant Definition The APL constant definition in USB-BASIC-F/W is shown below. Table 7.3 List of APL constant definition (Peripheral function mode) Constant Name Value Description 1 Data length of descriptors USB_SMPLCONFLEN 46 Data length of usb_gpstd_SmplConfigurationH_1[ ]/ usb_gpstd_SmplConfigurationF_1[ ] USB_SD1LEN 32 Data length of usb_gpstd_StringDescriptor1[ ] USB_SD2LEN 28 Data length of usb_gpstd_StringDescriptor2[ ] 2 Select using pipe for data transfer application USBC_USEPIPE_ALL_PP 1 Use pipe1 to pipe9 USBC_USEPIPE_1267_PP 2 Use pipe 1,2,6 and 7 USBC_USEPIPE_MODE_PP 2 Set to use pipe 1,2,6 and 7 3 Table size of usb_gcstd_SmplTrnMsg[ ] usb_gcstd_SmplTrnCnt[ ] usb_gcstd_SmplTrnSize[ ] *usb_gcstd_SmplTrnPtr[ ] USB_TBL_MAX 10 Use area between pipe0 and pipe9 (This value is index of the tables.) 4 Data transfer size USB_SMPL_TRNSIZE1 512 Data transfer size of pipe1 are 512 bytes USB_SMPL_TRNSIZE2 512 Data transfer size of pipe2 are 512 bytes USB_SMPL_TRNSIZE3 512 Data transfer size of pipe3 are 512 bytes USB_SMPL_TRNSIZE4 512 Data transfer size of pipe4 are 512 bytes USB_SMPL_TRNSIZE5 512 Data transfer size of pipe5 are 512 bytes USB_SMPL_TRNSIZE6 512 Data transfer size of pipe6 are 512 bytes USB_SMPL_TRNSIZE7 512 Data transfer size of pipe7 are 512 bytes USB_SMPL_TRNSIZE8 0 Data transfer size of pipe8 are 0 byte USB_SMPL_TRNSIZE9 0 Data transfer size of pipe9 are 0 byte 5 Data transfer times USB_SMPL_TRNCNT1 512 Data transfer times of pipe1 are 512 times USB_SMPL_TRNCNT2 512 Data transfer times of pipe2 are 512 times USB_SMPL_TRNCNT3 512 Data transfer times of pipe3 are 512 times USB_SMPL_TRNCNT4 512 Data transfer times of pipe4 are 512 times USB_SMPL_TRNCNT5 512 Data transfer times of pipe5 are 512 times USB_SMPL_TRNCNT6 512 Data transfer times of pipe6 are 512 times USB_SMPL_TRNCNT7 512 Data transfer times of pipe7 are 512 times USB_SMPL_TRNCNT8 0 Pipe8 do not transfer USB_SMPL_TRNCNT9 0 Pipe9 do not transfer R01AN0512EJ0110 Rev.1.10 Page 36 of 126 Jun 10, 2011
  • 37. USB Basic Firmware Table 7.4 List of APL constant definition (Host function mode) Constant Name Value Description 1 Select using pipe for data transfer application USBC_USEPIPE_ALL_PP 1 Use pipe1 to pipe9 USBC_USEPIPE_1267_PP 2 Use pipe 1,2,6 and 7 USBC_USEPIPE_MODE_PP 2 Set to use pipe 1,2,6 and 7 3 Table size of usb2_gcstd_SmplTrnMsg[ ] usb2_gcstd_SmplTrnCnt[ ] usb2_gcstd_SmplTrnSize[ ] *usb2_gcstd_SmplTrnPtr[ ] USB2_TBL_MAX 10 Use area between pipe0 and pipe9 (This value is index of the tables.) 4 Data transfer size USB2_SMPL_TRNSIZE1 512 Data transfer size of pipe1 are 512 bytes USB2_SMPL_TRNSIZE2 512 Data transfer size of pipe2 are 512 bytes USB2_SMPL_TRNSIZE3 512 Data transfer size of pipe3 are 512 bytes USB2_SMPL_TRNSIZE4 512 Data transfer size of pipe4 are 512 bytes USB2_SMPL_TRNSIZE5 512 Data transfer size of pipe5 are 512 bytes USB2_SMPL_TRNSIZE6 512 Data transfer size of pipe6 are 512 bytes USB2_SMPL_TRNSIZE7 512 Data transfer size of pipe7 are 512 bytes USB2_SMPL_TRNSIZE8 0 Data transfer size of pipe8 are 0 byte USB2_SMPL_TRNSIZE9 0 Data transfer size of pipe9 are 0 byte 5 Data transfer times USB2_SMPL_TRNCNT1 512 Data transfer times of pipe1 are 512 times USB2_SMPL_TRNCNT2 512 Data transfer times of pipe2 are 512 times USB2_SMPL_TRNCNT3 512 Data transfer times of pipe3 are 512 times USB2_SMPL_TRNCNT4 512 Data transfer times of pipe4 are 512 times USB2_SMPL_TRNCNT5 512 Data transfer times of pipe5 are 512 times USB2_SMPL_TRNCNT6 512 Data transfer times of pipe6 are 512 times USB2_SMPL_TRNCNT7 512 Data transfer times of pipe7 are 512 times USB2_SMPL_TRNCNT8 0 Pipe8 do not transfer USB2_SMPL_TRNCNT9 0 Pipe9 do not transfer 7.1.4 List of APL function The list of APL function in USB-BASIC-F/W is shown below. R01AN0512EJ0110 Rev.1.10 Page 37 of 126 Jun 10, 2011