Home

USB Host Human Interface Device Class Driver (HHID)

image

Contents

1. Figure 4 7 Interrupt IN Communication Sequence by KBD R01AN0664EJ0213 Rev 2 13 Page 15 of 39 Mar 16 2015 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID HHID USB BASIC F W Continue from startup to HID device attachment sequence OLCD display as KBD ATTACH Judgment of connected device R_usb_hhid_get_hid_protocol usb_shhid_apl_function USB_HHID_APL_INIT a Class request SetReport R_usb_hhid_class_request usb_shhid_apl_function USB_HHID_APL_KBD_OPEN USB_HID_SET_REPORT USB_HID_SET_REPORT R_usb_hsitd_TransferStart usb_shhid_apl_ function USB_HHID_APL_KBD_OPEN Class request SetProtocol R_usb_hhid_class_request _ __ _ Usb_shhid_ap _function 7 USB_HHID_APL_KBD_RX_WAIT USB_HID_SET_REPORT USB_HID_SET_PROTOCOL R_usb_hstd_TransferStart Data transmit request receive report R_usb_hhid_class_request USB_HID_GET_REPORT USB_HID_GET_REPORT R_usb_hstd_TransferStart USB_HHID_APL_KBD_RX_WAI 0O OF 0 usb_shhid_apl_function 1 T Control transfer transmit end call back Transfer eid usb hhid_smpl_get_report_result usb_shhid_apl_ function 4 USB_HHID_APL_KBD_RX usb_shhid_apl_function USB HHID_APL_KBD_RX LCD display of value acquired from input report Data transmit request receive report R_usb_hhid_class_request SET_REPORT Control transf
2. 2015 Renesas Electronics Corporation All rights reserved Colophon 5 0
3. HCD task MGR task open usb hhid registration HHID driver registration R_usb hhid DriverStart HHID Task Start Scheduler initialized R usb hstd ChangeDeviceState USB DO SETHWFUNCTION RO1ANO664EJ0213 Rev 2 13 Mar 16 2015 RENESAS Page 28 of 39 Renesas USB MCU USB Host Human Interface Device Class Driver HHID R_usb_hhid_DriverStop Stop HHID driver Format void R_usb_hhid_DriverStop void Argument Return Value Description The function stops the HHID driver task Note Example USB STATIC void usb hsmpl device state uintl6 t data uintlo t state switch state case USB STS_DETACH usb smpl set suspend flag USB NO usb shhid_ active USB NO usb _shhid_apl function USB HHID APL CLOSE R_usb hhid DriverStop break Ne RO1ANO664EJ0213 Rev 2 13 Page 29 of 39 Mar 16 2015 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID R_usb_hhid_SetPipeRegistration Pipe and Pipe Information Table setting Format void R_usb_hhid_SetPipeRegistration usb_addr_t devadr Argument devadr Device address Return Value Description This function updates the address field of the host s Pipe Information table It thereby sets the hardware pipe to be used for HID communication Note 1 Refer to USB Basic Mini Firmware application note for information on the Pipe Information Table 2 Please set another field in the Pipe I
4. HHID task R_usb_hhid_task USB BASIC F W R_usb_hstd_HcdTask R_usb_hstd_Mgr Task usb_hhid_class_check Enumeration R_usb_hhid_ClassCheck Get Device Descriptor Set Address Get Configuration Descriptor Enumeration processing usb_hhid_enumeration_sequence usb_hsmpl_device_state operates by the context of USB BASIC FW Return Get StringDescriptor etc Check OK R_usb_hstd_ReturnEnuMGR Ash at at o 1 Enumeration SET_CONFIGURATION Configuard call back usb_hsmpl_device_state USB_STS_CONFIGURED l Pipe registration Pipe configuration R_usb_hhid_SetPipeRegistration E Set three pipes J Int IN Return usb_shhid_apl_function USB_HHID_APL_INIT Return 1 Continue with data communication sequence Figure 4 6 Startup to HID Device Attachment Sequence RO1AN0664EJ0213 Rev 2 13 Mar 16 2015 Page 14 of 39 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID 4 8 2 Data Communication Figure 4 7 and Figure 4 8 show the data transfer sequence that is connected by the keyboard device The case where the report is received by the interrupt transfer is Figure 4 7 The case where the report is received by the control transfer is Figure 4 8 HHID USB BASIC F W Continue from startup to HID device attachment sequence usb_shhid_apl_function LCD display as USB_HHID_
5. Describe the processing performed when the USB receive is completed RO1ANO664EJ0213 Rev 2 13 Page 31 of 39 Mar 16 2015 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID R_usb_hhid_TransferEnd USB data transfer termination request Format usb_er_t R_usb_hhid_TransferEnd void Argument Return Value USB_E_ OK Success USB_E_ ERROR Failure argument error USB_E_QOVR Overlap transfer end request for the pipe during transfer end Description This function requests the USB BASIC F W to end a data transfer in progress The transfer end is notified using the callback function set when the data transfer is requested R_usb_hhid_PipeTransferExample R_usb_hhid_class_request The remaining data length of transmission and reception pipe control register value and transfer status USB_DATA_STOP are set using the argument of the callback function usb_utr_t The control transfer or the interrupt transfer is stopped according to how the USB_HHID_GET_REPORT_PIPEO macro in the r_usb_class_usrcfg h file is set e USB_HHID_GET_REPORT_PIPEO macro enabled Stop the control transfer e USB_HHID_GET_REPORT_PIPEO macro is disabled Stop the interrupt transfer Note 1 The data transmit process forced end result is obtained by the argument usb_utr_t of the callback function 2 Refer to USB Basic Mini Firmware application note for the Data Transfer structure usb_utr_t Example void usb smp tas
6. tranadr Transfer data buffer usb_leng_t tranlen Transfer size uint16_t duration Response interval time rate to Interrupt transfer 4ms units uint8_t set_protocol Protocol value Boot Protocol 0 Report Protocol 1 uint8_t get_protocol Protocol value stored address usb_cb t complete Class request processing end call back function 6 4 2 HHID Class Request Code Table 6 3 describes the code of the HID class requests Table 6 3 HHID Class Request code Request Type Definition Value Get_Descriptor HID USB_HID_GET_HID_DESCRIPTOR Get_Descriptor Report USB_HID_GET_REPORT_DESCRIPTOR Get_Descriptor Physical USB_HID_GET_PHYSICAL_DESCRIPTOR Set_Report USB_HID_SET_ REPORT Get_Report USB_HID_GET_ REPORT Set_Idle USB_HID_SET_IDLE Get_Idle USB_HID_GET_IDLE Set_Protocol USB_HID_SET_PROTOCOL Get_Protocol USB_HID_GET_PROTOCOL RO1ANO664EJ0213 Rev 2 13 Page 23 of 39 Mar 16 2015 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID 6 4 3 1 Receive Report Format HID Report Format Table 6 4 shows the receive report format used for notifications from the HID device Reports are received in Interrupt IN transfers or class request GetReport Table 6 4 Receive report format Offset Application Data length 0 Top Byte Keyboard Mode 8 Bytes Modifier keys Mouse Mode 3 Bytes bO Button 1 b1 Button 2 b2 7 Reserved Rese
7. when the data transfer is completed R_usb_hhid_PipeTransferExample When Interrupt IN transfer is completed this API function is executed USB_HHID_TCMD_CLASS_REQ 6 3 The HID class request is issued according to the demand of the application program shown by the argument Notifies the application when the control transfer is completed Target Peripheral List TPL R_usb_hhid_class_request This API function is called from the sample function which issues the class request A host class driver is not required to support operation of all USB peripherals of the class It is up to the manufacturer of the host to determine what peripherals to support and provide a list of those peripherals This is called the Target Peripheral List TPL TPL is composed of an array of supported VID s and PID s To not check VID PID specify USB_NOVENDOR USB_NOPRODUCT Refer to the usb_gapl_devicetpl array in the r_usb_hhid_driver c file for the determination of TPL RO1AN0664EJ0213 Rev 2 13 Mar 16 2015 RENESAS Page 22 of 39 Renesas USB MCU USB Host Human Interface Device Class Driver HHID 6 4 Structures 6 4 1 HHID Class API Function Structure Table 6 2 describes the HID class request parameter structure Table 6 2 USB_HHID_CLASS REQUEST PARM_t Structure Member Description usb_addr_t devadr Device address uint8_t bRequestCode Class request code Refer to the Table 6 3 void
8. 21 6 USB Host Human Interface Device Class Driver HHID sscccccssssssssssceessssssssccceeeesssssssseeseseesessssnaes 22 7 Limita ti ns sosis 62 cesssseceadsGcivieassecvadedesivesssccdundedesscusaaceddscevsvecuacses ddedeioeadsscaeudessssosadsacaeudeedasesadsscaseeveiseedanens 38 RO1ANO0664EJ0213 Rev 2 13 Page 1 of 39 Mar 16 2015 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID 1 Overview This application note describes the USB Host Human Interface Device Class Driver HHID and the sample application using USB Basic Mini Firmware refer to the Chapter 1 2 1 1 Functions and Features The USB Host Human Interface Device Class Driver HHID conforms to the USB Human Interface Device Class specification HID from now on and description It and enables communication with a HID peripheral device This class driver is intended to be used in combination with the USB Basic Mini Firmware provided from Renesas Electronics 1 3 Related Documents Universal Serial Bus Revision 2 0 specification USB Class Definitions for Human Interface Devices Version 1 1 HID Usage Tables Version 1 1 http www usb org developers docs User s Manual Hardware USB Basic Mini Firmware Application Note Document No RO1AN0326EJ Available from the Renesas Electronics Website Renesas Electronics Website http www renesas com USB Devices Page http www renesas com prod usb Terms and Abb
9. device Get_Protocol 0x03 Reads a protocol from the HID device Set_Protocol 0x0B Sends a protocol to the HID device Get_Report_Descriptor Standard Transmit a report descriptor Get_Hid_Descriptor Standard Transmit a HID descriptor For details concerning the Requests refer to Chapter 7 in USB Device Class Definitions for Human Interface Devices Revision 1 1 RO1ANO664EJ0213 Rev 2 13 Page 21 of 39 Mar 16 2015 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID 6 USB Host Human Interface Device Class Driver HHID 6 1 Basic Functions This software conforms to the Human Interface Device class specification See Chapter 1 2 item 2 and 3 The main functions of HHID are to 1 Send class requests to the HID peripheral 2 Transfer data from the HID peripheral 6 2 HHID Task Description This task receives messages in mailbox USB_HHID_MBX and performs processing according to the type of message Table 6 1 shows processing according to message type Table 6 1 Processing according to Received HHID Message Type Message USB_HHID_TCMD_OPEN Processing Gets the string descriptor and sets the pipe according the enumeration sequence Message Source R_usb_hhid_ClassCheck USB BASIC F W and HHID check the connected device via this callback function during the enumeration USB_HHID_TCMD_DATA_TRANS Start Interrupt IN transfer Notifies the application
10. ra USB Host Control Driver HCD LCD LED KEY H W Figure 3 1 Module Structure Table 3 1 Module Function Descriptions Module Name Description User application program Created Board RSK switches initiate communication with attached HID by the devices and control suspend resume customer The LCD displays the information received from the HID device The registered device class driver checks operation of the connected device The USB BASIC F W checks whether the connected device enables for HHID The following data transfers are requested of USB BASIC F W by the APL 1 Control of connected device by HID requests 2 Data transfer with connected device Transfer results are notified to APL by a callback function USB BASIC F W_ USB Basic Mini Firmware Host Hardware Control amp Device state Management RO1ANO664EJ0213 Rev 2 13 Page 4 of 39 Mar 16 2015 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID 3 2 Overview of Application Program Functions The main functions of the host demo application 1 Data is received from the connected USB peripheral device and is displayed on the LCD a When a USB mouse is connected Mouse mode the displacement values of the X and Y axes are shown on the LCD An LED is toggled by pressing the mouse buttons b When a USB keyboard is connected Keyboard mode show one character of the key input data from the USB keyboa
11. void R_usb_hhid_ClassCheck uint8_t table Argument table Address array of the device information table 3 Address of Device Descriptor m p Address of Configuration Descriptor j 2 Address of global variable that mean the Device Address Return Value Description This function requests the HHID task to determine whether the connected device is a HID device by studying the received descroptors Call this function when the USB BASIC F W executes the classcheck callback The HHID task references the endpoint descriptor s of the peripheral s configuration descriptor then edits the Pipe Information Table usb_ghmsc_TmpEpTbl and checks the pipe information of the pipes to be used Note Example USB_ STATIC void usb hhid class _check uint8 t table R usb hhid ClassCheck table usb shhid_smpl devaddr usb addr t table 2 R01AN0664EJ0213 Rev 2 13 Page 27 of 39 Mar 16 2015 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID R_usb_hhid_DriverStart Start HHID driver Format void R_usb_hhid_DriverStart void Argument Return Value Description The function starts the HHID driver task Note Example void usb hstd_ task start void Target board initialize usb cpu_target init USB IP initialized R usb hstd ChangeDeviceState USB DO INITHWFUNCTION HCD driver open amp registratuion R usb hstd_ HcdOpen
12. 0213 Rev 2 13 Mar 16 2015 RENESAS Page 20 of 39 Renesas USB MCU USB Host Human Interface Device Class Driver HHID 5 Human Interface Device Class HID This software conforms to the Human Interface Device Class specification as specified in the document listed in Chapter 1 2 The HID class consists primarily of devices that are used by humans to control the operation of computer input devices Typical examples of HID class devices include e Keyboards and pointing devices for example standard mouse devices trackballs and joysticks e Front panel controls for example knobs switches buttons and sliders e Controls that might be found on devices such as telephones VCR remote controls games or simulation devices for example data gloves throttles steering wheels and rudder pedals 5 1 Basic Functions The main functions are as follows Verify that connected devices are of type HID Inquire about the capabilities and state of a device Set the state of output and feature items Contro the transfer of data from the HID peripheral device Poe 5 2 HID Class Requests Host to Device The software supports the following HID class requests Table 5 1 HID Requests Request Description Get_Report 0x01 Receives a report from the HID device Set_Report 0x09 Sends a report to the HID device Get_Idle 0x02 Receives a duration time from the HID device Set_Idle Ox0A Sends a duration time to the HID
13. APL_INIT KBD ATTACH Judgment of connected device R_usb_hhid_get_hid_protocol Class request SetReport R_usb_hhid_class_request usb_shhid_apl_ function USB_HHID_APL_KBD_OPEN USB HID SET REPORT USB_HID_SET_REPORT R_usb_ h std_TransferStart usb_shhid_apl_function Class request SetProtocol USB_HHID_APL_KBD_OPEN R_usb_hhid class request _ ___ _ usb_shhid_apl_function i USB_HHID_APL_KBD_RX_WAIT USB HID SET REPORT vlna R_usb_hstd_TransferStart Data transmit request receive report R_usb_hhid_PipeTransferExample Interrupt IN transfer USB_HHID_TCMD_DATA_TRANS R_usb_hstd_TransferStart USB_DATA_OK USB_DATA_READING IN f USB_DATA_SHT transmit end call back nterrupt IN transfer Transfer end SAE eee I usb_hhid_InTransferResult usb_hhid_smpl_data_trans_result usb_shhid_apl_function 4 USB_HHID_APL_KBD_RX usb_shhid_apl_function USB_HHID_APL_KBD_RX_WAIT usb_shhid_apl_ function USB_HHID APL_KBD_RX J LCD display of value acquired from input report Data transmit request receive report R_usb_hhid_PipeTransferExample Control transfer Transfer end SET_REPORT Command notification usb_hhid_smpl_kbd_led_ctl_result transmit end call back 3 3 Continue with data communication sequence Control transfer Transfer end SET_PROTOCOL Command notification usb_cstd_DummyFunction transmit end call back
14. HHID_APL_OFFSET_RESUME Process 5 1 Report receive request usb_hhid_MainTask Figure 4 4 Application State Transitions RO1AN0664EJ0213 Rev 2 13 Mar 16 2015 RENESAS Page 12 of 39 Renesas USB MCU USB Host Human Interface Device Class Driver HHID 4 7 SW Processing Flow Graphs The following shows the application task processing flow overview usb_hhid_ AppTask Mode setting Open state neceg wall Receive state P state Data transfer Data transfer start Disol Vedat start switch OFF switch OFF pace e a a Switch dat Switch dat EE Eaa usb_hhid MseData or Data transfer State change usb_hhid_KbdData start switch ON switch ON USB data transfer Change mode setting Report length forcible termination Receive wait state acquisitionR_usb_hhid_ usb_hhid_ T ferEnd GetReportLength ransferEnd0 USB data transfer A receive report Change mode setting Change mode setting R usb hhid Receive wait state Suspend state PipeTransferExample Initial LCD message Change device state suspend R_usb_hstd_ USB data transfer ChangeDeviceState receive report R_usb_hhid_ PipeTransferExample lt a Return Else Mode setting pit transter complet Suspen
15. ID gt HHID APL gt HHID mailbox ID USB_HHID_TSK USB _HCD_ MBX HCD task mailbox ID USB_HCD_TSK USB_MGR_MBX MGR task mailbox ID USB_MGR_TSK RO1ANO664EJ0213 Rev 2 13 Page 7 of 39 Mar 16 2015 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID 4 Host HID Sample Application Program APL The host demo application performs display of received USB data when connected to a HID peripheral device The HHID application complies with the USB Human Interface Device Class specifications See Chapter 1 2 item 2 and 3 4 1 Operating Environment The Figure 4 1 and Figure 4 2 show a sample operating environment for the software HID host USB communication Peripheral HID device aN USB keyboard NumLock LED On Off HHID USB BASIC F W Figure 4 1 Example Operating Environment with a connected keyboard USB communication HID host Peripheral HID device X Y motion data RSK Board X 10 Y 20 LCD 10 Button data USB Right click port USB mouse LED Oo LED1 right click LED2 wheel click 012 OOU LEDO left click HHID USB BASIC F W Figure 4 2 Example Operating Environment with a connected mouse R01AN0664EJ0213 Rev 2 13 Page 8 of 39 Mar 16 2015 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID 4 1 1 Report reception When th
16. J0213 Rev 2 13 Page 37 of 39 Mar 16 2015 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID 7 Limitations The following limitations apply to HHID 1 Only one device can connect to HHID Please do not connect two or more devices simultaneously 2 The HID driver must analyze the report descriptor to determine the report format This HHID driver determines the report format only from the interface protocol 3 The structures contain members of different types Depending on the compiler this may cause address misalignment of structure members RO1ANO664EJ0213 Rev 2 13 Page 38 of 39 Mar 16 2015 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID Website and Support Renesas Electronics Website http www renesas com Inquiries http www renesas com contact All trademarks and registered trademarks are the property of their respective owners RO1ANO664EJ0213 Rev 2 13 Page 39 of 39 Mar 16 2015 RENESAS Revision Record Description Rev Date Page Summary 0 00 May 12 11 First edition issued 2 00 Nov 30 12 Revision of the document by firmware upgrade 2 10 Aug 01 13 RX111 is supported Error is fixed 2 11 Oct 31 13 1 4 Folder path fixed 3 3 1 Folder Structure was corrected Error is fixed 2 12 Mar 31 14 R8C is supported Error is fixed 2 13 Mar 16 15 RX111 is deleted from Target Device A 1 Gene
17. LCD RO1ANO664EJ0213 Rev 2 13 Page 11 of 39 Mar 16 2015 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID 4 6 2 State Transitions Figure 4 4 shows the application state transition Each block is a program state Process No 0 0 Process No 7 0 DETACH DETACH Power on USB DETACH 0 Initialization Process 0 1 Eoo e MSE Eoo e amp USB KBD ATTACH 1 Open configured USB_STS_CONFIGURED Process 1 1 Press the data N transfer start switch press Report receive request usb_hhid_MainTask Process 1 1 Press the stat the state Receive report change switch usb_hhid_smpl_data_trans_result Process3 1 Received data is displayed on the LCD and Report receive request usb_hhid_MainTask Process x x User oparation process number i USB keyboard or USB mouse attachment 6 Control transfer complete Data transmission started by RSK SW2 4 Suspend Press the state change switch 7 Detach USB_HHID_APL_CLOSE Frocess 6 1 Process 2 3 ugb_hhid_MainTask Control transfer complete Foe Ex usb_hhid_smpl_get_report_result Process 2 2 Data transmission terminated and peripheral device suspended RSK SWS pressed usb_hhid_MainTask Process 4 1 Peripheral device resume by RSK SW3 press or remote wakeup usb_hhid_smp_status_set USB_
18. RENESAS APPLICATION NOTE R01AN0664EJ0213 Renesas USB MCU Rev 2 13 Mar 16 2015 USB Host Human Interface Device Class Driver HHID using Basic Mini Firmware Introduction This document is an application note describing use of the USB Host Human Interface Device Class Driver HHID built using the USB Basic Mini Firmware of the Renesas USB MCU Target Device RL78 GI1C R8C 3MK R8C 34K This program can be used with other microcontrollers that have the same USB module as the above target devices When using this code in an end product or other application its operation must be tested and evaluated thoroughly This program has been evaluated using the corresponding MCU s Renesas Starter Kit board Contents 1 OVER VICW EE E stated shacceds sicatacscbicciacseendacectoatesesdendocacesseescducncecacsessssaddncuscesdssesddneucuncessseeuedacedenestoseusucae 2 2 Register Class Driver ccictscccscccscctssccscctssscstsesescoccchescscsencscncssncschcvencececdeecscaedencscecdeacscecsescscacdencscnedeatecncdeateces 4 3 Software Configuration wccccccccccccccscccccccaccescccecccseccaccseccsscecccccaccceccsacesescsaccieccsscccccccascteccsacesssssacc eccsascssscsasets 4 4 Host HID Sample Application Program APL ssesssssssssssesssssssssssssseesssssessseesssssssssessssssessseessesssesseeseneseesse 8 5 Human Interface Device Class HID s isscssescevscssesascccsecsssssecsasscssecssscssesacesssccssccsseeadectbecssecsnecodecsbecsvsssuassnces
19. SB_DATA_OK USB_DATA_READING USB_DATA_SHT transmit end call back usb_hhid_smpl_data_trans_result usb_shhid_apl_function USB_HHID_APL_MSE_RX from input report Data transmit request receive report R_usb_hhid_PipeTransferExample Continue with data communication sequence command notiticatian I usb_hhid_InTransferResult Interrupt IN transfer Transfer end Figure 4 9 Interrupt IN Communication Sequence by MSE R01AN0664EJ0213 Rev 2 13 Mar 16 2015 RENESAS Page 17 of 39 Renesas USB MCU USB Host Human Interface Device Class Driver HHID HHID Continue from startup to HID device attachment sequence USB BASIC F W usb_shhid_apl_function USB_HHID_APL_INIT LCD display as MSE ATTACH Judgment of connected device R_usb_hhid_get_hid_protocol usb_shhid_apl_function USB_HHID_APL_MSE_OPEN x usb_shhid_apl_function usb_shhid_apl_function USB_HHID_APL_MSE_OPEN Data transmit request receive report R_usb_hhid_class_request usb_shhid_apl_function USB_HHID_APL_MSE_RX_WAIT USB_HID_GET_REPORT USB_HID_GET_ REPORT R_usb_hstd_TransferStart USB HHD APL MSE Fx wa Control transfer Transfer end transmit end call back usb hhid_smpl_get_report_result usb_shhid_apl_function USB_HHID_APL_MSE_RX 3 usb_shhid_apl_function USB_HHID_APL_MSE_RX J LCD display of value acq
20. cates that a mouse device is connected else not possible to operate Not recognized as an operable HID device connection Table 4 2 Operation During Data Communication Mode Description Keyboard Mode Display of received key data key code to ASCII conversion Mouse Mode Display of received coordinate data 4 3 Endpoint Specifications The endpoints use by the HHID is shown in Table 4 3 Table 4 3 Endpoint Specifications _ Number Pipe Number Transfer Method Control In Out Standard request class request Follows Ea Interrupt In Data transfer from device to host Descriptor from attached device The Endpoint numbers are determined by the device s endpoint descriptors R01AN0664EJ0213 Rev 2 13 Page 9 of 39 Mar 16 2015 RENESAS Renesas USB MCU 4 4 Allowed HID Peripherals 4 4 1 Supported Features Full Speed Low Speed keyboard s USB Host Human Interface Device Class Driver HHID Three button mouse FullSpeed LowSpeed 4 4 2 Non supported Features Devices with built in HUB or composite devices 4 5 List of APL Functions Table 4 4 lists the functions of the sample application Table 4 4 List of Functions of Sample Application Function Name Description main Main loop processing usb_hsmpl_main_init System initialization Task start up processing for Host USB usb_hhid_MainTask Sample application main processing usb_hapl_registration HHID dri
21. d state Resume state Gh 7 State change Change mode setting ange mode setting switch OFF Receive wait state Receive wait state Switch data State change USB transfer switch ON oe report R_usb_hhid_ Change device state PipeTransferExample resume R_usb_hstd_ ChangeDeviceState lt Return Figure 4 5 Application Task Processing Flow Overview R01AN0664EJ0213 Rev 2 13 Page 13 of 39 Mar 16 2015 RENESAS Renesas USB MCU 4 8 USB Host Human Interface Device Class Driver HHID Sequences charts APL HHID HCD The operation sequence of the sample application program is described below 4 8 1 Startup to HID Device Attachment The sequence from sample application program startup through completion of enumeration application task startup and completion of pipe control register setting is illustrated in Figure 4 6 HW Reset processing MCU Initialization Start main task Start USB BASIC F W R_usb_hstd_HcdOpen HHID USB BASIC F W Explanatory O Task Start Receive Massage Send Message Task Stop Return to mainloop Processing function gt System call function Send Message Processing Program executing R_usb_hhid_DriverStart Return Register HHID class driver Return R_usb_hstd_DriverRegistration Start HHID task Return Start task scheduling main loop f HID device attach Application task usb_hhid_MainTask
22. devadr devadr class req tranadr p data class _req tranlen length class req complete complete R_usb hhid class request class_ req RO1ANO664EJ0213 Rev 2 13 Page 33 of 39 Mar 16 2015 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID R_usb_hhid_Devicelnformation Obtain USB device state and other information Format void R_usb_hhid_DeviceInformation uint16_t deviceinfo Argument deviceinfo Table address to store the device information Return Value Description Obtain the connected USB device information The following information will be stored to the address specified by the argument deviceinfo 0 Root port number port 0 USB_O port 1 USB_1 1 USB state unconnected USB_STS_DETACH enumerated USB_STS_DEFAULT USB_STS_ADDRESS connected USB_STS_CONFIGURED suspended USB_STS_SUSPEND 2 Structure number g_usb_HcdDevInfo g_usb_MgrDevAddr config 3 Connection speed FS USB_FSCONNECT LS USB_LSCONNECT unconnected USB_NOCONNECT Notes 1 Provide an area of 4 words for the argument deviceinfo 2 This function is called when the device address is 0 the following information is returned 1 When there is not a device during enumeration device is not connected table O USB_NOPORT table 1 USB_STS_DETACH 2 When there is a device during enumeration table 0 Port number table 1 USB_STS_DEFAULT Example void usb smp task void uin
23. driver SmpIMain Sample Application APL Report display application USBSTDFW Common USB code that is used by all USB firmware inc Common header file of USB driver src USB driver HwResource Hardware access layer to initialize the MCU inc Common header file of hardware resource sre Hardware resource RO1AN0664EJ0213 Rev 2 13 Page 6 of 39 Mar 16 2015 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID 3 3 2 File Structure Table 3 3 shows the file structure provided in the HHID Table 3 3 File Structure Description USB host HID user definition HHID type definitions and macro definitions HHID prototype external reference HHID APT functions HHID driver functions Main Toop function Sample application program 3 4 System Resources 3 4 1 System Resource Definitions Table 3 4 lists the Task ID and the task priority definitions used to register HHID in the scheduler These are defined in the r_usb_ckernelid h header file See 1 4 for why tasks are used Table 3 4 List of Scheduler Registration IDs Scheduler registration task Description USB_HHID_TSK HHID R_usb_hhid_task Task ID USB_HHID_TSK Task priority 2 USB_HCD_TSK HCD R_usb_hstd_HcdTask Task ID USB_HCD_TSK Task priority 0 USB_MGR_TSK MGR R_usb_hstd_MgrTask Task ID USB_MGR_TSK Task priority 1 Mailbox ID Default receive task Message description USB_HHID_MBX HH
24. e USB_HHID_GET_REPORT_PIPEO macro in the r_usb_class_usrcfg h file is made active report reception is made possible by the control transfer GET_REPORT request 4 2 Description of Application Program Processing The following lists application operation with respect to Figure 4 4 on page 12 HID peripheral device attachment Corresponding to Process No 0 1 Whether a connected device is a mouse or a keyboard is automaticallydetermined The distinction between the two is done using bInterfaceProtocol of the Configuration descriptor Refer to Table 4 1 Ther application program does not analyze the report descriptor Data Communication e Start Process 1 1 Communication with a USB device is started when SW2 is pressed Refer to Table 3 2 e Complete Process 2 1 Communication with a USB device is completed when the callback function is generated from the HHID Operation e During Data Communication Process 3 1 Analyzes reports received from the peripheral device and displays them on LCD Refer to Table 4 2 e During Suspend state Process 2 2 Data communication is terminated and the USB device is suspended when SW3 is pressed Refer to Table 3 2 e During Resume Process 4 1 USB device is resumed and data communication restarts when SW3 is pressed Refer to Table 3 2 Table 4 1 Mode Switching bInterfaceProtocol Mode Description 0x01 Keyboard Mode Indicates that a keyboard device is connected 0x02 Mouse Mode Indi
25. er Command notification transmit end call back enie end usb_hhid_smpl_kbd_led_ctl_result SET_REPORT Control transfer Command notification transmit end call back Transfer end usb_hhid_smpl_kbd_led_ctl_result Continue with data communication sequence Figure 4 8 Control transfer Communication Sequence by KBD RO1ANO664EJ0213 Rev 2 13 Page 16 of 39 Mar 16 2015 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID Figure 4 9 and Figure 4 10 show the data transfer sequence that is connected by the mouse device The case where the report is received by the interrupt transfer is Figure 4 9 The case where the report is received by the control transfer is Figure 4 10 usb_shhid_apl_ function usb_shhid_apl_function USB_HHID_APL_MSE_OPEN J Data transmit request receive report APL HHID USB BASIC F W Judgment of connected device R_usb_hhid_get_hid_protocol usb_shhid_apl_ function USB_HHID_APL_MSE_OPEN usb_shhid_apl_function R_usb_hhid_PipeTransferExample a USB_HHID_APL_MSE_RX_WAIT Interrupt IN transfer USB_HHID_TCMD_DATA_TRANS R_usb_hstd_TransferStart Continue from startup to HID device attachment sequence usb_shhid_apl_function LCD display as USB_HHID_APL_INIT MSE ATTACH USB_HHID_APL_MSE_RX wal usb_shhid_apl_function A A USB _HHID_APL_MSE_RX J LCD display of value acquired U
26. esas Electronics Europe GmbH Arcadiastrasse 10 40472 D sseldorf Germany Tel 49 211 6503 0 Fax 49 211 6503 1327 Renesas Electronics China Co Ltd Room 1709 Quantum Plaza No 27 ZhiChunLu Haidian District Beijing 100191 P R China Tel 86 10 8235 1155 Fax 86 10 8235 7679 Renesas Electronics Shanghai Co Ltd Unit 301 Tower A Central Towers 555 Langao Road Putuo District Shanghai P R China 200333 Tel 86 21 2226 0888 Fax 86 21 2226 0999 Renesas Electronics Hong Kong Limited Unit 1601 1611 16 F Tower 2 Grand Century Place 193 Prince Edward Road West Mongkok Kowloon Hong Kong Tel 852 2265 6688 Fax 852 2886 9022 Renesas Electronics Taiwan Co Ltd 13F No 363 Fu Shing North Road Taipei 10543 Taiwan Tel 886 2 8175 9600 Fax 886 2 8175 9670 Renesas Electronics Singapore Pte Ltd i 80 Bendemeer Road Unit 06 02 Hyflux Innovation Centre Singapore 339949 Tel 65 6213 0200 Fax 65 6213 0300 Renesas Electronics Malaysia Sdn Bhd Unit 1207 Block B Menara Amcorp Amcorp Trade Centre No 18 Jin Persiaran Barat 46050 Petaling Jaya Selangor Darul Ehsan Malaysia Tel 60 3 7955 9390 Fax 60 3 7955 9510 Renesas Electronics India Pvt Ltd No 777C 100 Feet Road HALII Stage Indiranagar Bangalore India Tel 91 80 67208700 Fax 91 80 67208777 Renesas Electronics Korea Co Ltd 12F 234 Teheran ro Gangnam Gu Seoul 135 080 Korea Tel 82 2 558 3737 Fax 82 2 558 5141
27. istic values operating margins immunity to noise and amount of radiated noise When changing to a product with a different part number implement a system evaluation test for the given product Notice 1 Descriptions of circuits software and other related information in this document are provided only to illustrate the operation of semiconductor products and application examples You are fully responsible for the incorporation of these circuits software and information in the design of your equipment Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from the use of these circuits software or information 2 Renesas Electronics has used reasonable care in preparing the information included in this document but Renesas Electronics does not warrant that such information is error free Renesas Electronics assumes no liability whatsoever for any damages incurred by you resulting from errors in or omissions from the information included herein 3 Renesas Electronics does not assume any liability for infringement of patents copyrights or other intellectual property rights of third parties by or arising from the use of Renesas Electronics products or technical information described in this document No license express implied or otherwise is granted hereby under any patents copyrights or other intellectual property rights of Renesas Electronics or others 4 You should not alter modif
28. ith a third party to notify such third party in advance of the contents and conditions set forth in this document Renesas Electronics assumes no responsibility for any losses incurred by you or third parties as a result of unauthorized use of Renesas Electronics products 11 This document may not be reproduced or duplicated in any form in whole or in part without prior written consent of Renesas Electronics 12 Please contact a Renesas Electronics sales office if you have any questions regarding the information contained in this document or Renesas Electronics products or if you have any other inquiries Note 1 Renesas Electronics as used in this document means Renesas Electronics Corporation and also includes its majority owned subsidiaries Note 2 Renesas Electronics product s means any product developed or manufactured by or for Renesas Electronics tENESAS SALES OFFICES Renesas Electronics Corporation http www renesas com Refer to http www renesas com for the latest and detailed information Renesas Electronics America Inc 2801 Scott Boulevard Santa Clara CA 95050 2549 U S A Tel 1 408 588 6000 Fax 1 408 588 6130 Renesas Electronics Canada Limited 9251 Yonge Street Suite 8309 Richmond Hill Ontario Canada L4C 9T3 Tel 1 905 237 2004 Renesas Electronics Europe Limited Dukes Meadow Millboard Road Bourne End Buckinghamshire SL8 5FH U K Tel 44 1628 585 100 Fax 44 1628 585 900 Ren
29. k void Transfer end request err R_usb hhid TransferEnd USB_PIPE6 USB_DO TRANSFER_STP return err RO1ANO664EJ0213 Rev 2 13 Page 32 of 39 Mar 16 2015 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID R_usb_hhid_class_request Send HID class request Format usb_er_t R_usb_hhid_class_request USB_HHID_CLASS_REQUEST_PARM_t pram Argument pram HID class request structure Refer to Chapter 6 4 for the USB_HHID_CLASS_REQUEST_PARM_t argument structure Return Value Error code USB_E_OK USB_E_ ERROR Description The following HID class requests can be sent to the HHID driver Judges the request type by the structure member bRequestCode of argument parm Get_Descriptor HID Get_Descriptor Report Get_Descriptor Physical Set_Report Get_Report Set_Idle Get_Idle Set_Protocol Get_Protocol pO CO ON ag Gian Please refer to the sample application in r_usb_hhid_apl c for details on how to use Note 1 The class request transmission result is obtained via the argument usb_utr_t of the callback function 2 Refer to USB Basic Mini Firmware application note for the Data Transfer structure usb_utr_t Example void usb hhid smpl_ set _report uintl6 t devadr uint8 t p data uintlo t length usb cb t complete USB HHID CLASS REQUEST PARM t class req SET REPORT class req bRequestCode USB HID SET REPORT class req
30. mputer software alone is very difficult please evaluate the safety of the final products or systems manufactured by you 8 Please contact a Renesas Electronics sales office for details as to environmental matters such as the environmental compatibility of each Renesas Electronics product Please use Renesas Electronics products in compliance with all applicable laws and regulations that regulate the inclusion or use of controlled substances including without limitation the EU RoHS Directive Renesas Electronics assumes no liability for damages or losses occurring as a result of your noncompliance with applicable laws and regulations 9 Renesas Electronics products and technology may not be used for or incorporated into any products or systems whose manufacture use or sale is prohibited under any applicable domestic or foreign laws or regulations You should not use Renesas Electronics products or technology described in this document for any purpose relating to military applications or use by the military including but not limited to the development of weapons of mass destruction When exporting the Renesas Electronics products or technology described in this document you should comply with the applicable export control laws and regulations and follow the procedures required by such laws and regulations 10 It is the responsibility of the buyer or distributor of Renesas Electronics products who distributes disposes of or otherwise places the product w
31. nformation Table usb_ghmsc_TmpEpTbl beforehand by referring to the endpoint descriptor Example void usb smp _task void R_usb hhid SetPipeRegistration devadr RO1ANO664EJ0213 Rev 2 13 Page 30 of 39 Mar 16 2015 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID R_usb_hhid_PipeTransferExample USB data transfer request Format usb_er_t R_usb_hhid_TransferExample uint8_t table usb_leng_t size usb_cb_t complete Argument table Pointer to the data buffer area size Transfer data size complete Process completion callback function Return Value USB_E_ OK Success USB_E_ ERROR Failure argument error Description This function requests a data transfer of the USB BASIC F W The data of argument size byte is received at the address shown in argument table When the data reception processing is complete data reception of size byte or short packet reception the callback function is called Note 1 The data transfer process results are obtained by the argument usb_utr_t of the callback function 2 Refer to USB Basic Mini Firmware application note for the Data Transfer structure usb_utr_t Example usb er t usb smp task void uint8 t data 64 Data buff usb lenguintl6 t size 64 Data size R_usb hhid TransferExample data size usb_cb t usb data_ received Callback function void usb data_received usb utr t mess
32. nformation on functionality and interfaces as needed for your particular solution Chapter 4 explains how the default host HID demo application works You will change this to create your own solution Understand how all code modules are divided into tasks and that these tasks pass messages to one another This is so that functions tasks can execute in the order determined by a scheduler and not strictly in a predetermined order This way more important tasks can have priority This plus the use of a function callback mechanism enables the USB code to be non blocking The task mechanism is described in Chapter 1 2 above USB Basic Mini Firmware Application Note All HID tasks are listed in Chapter 3 4 RO1ANO664EJ0213 Rev 2 13 Page 3 of 39 Mar 16 2015 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID 2 Register Class Driver A class driver must be registered with the USB BASIC F W Please consult function usb_hapl_registration in r_usb_hhid_apl on how to register a class driver with USB BASIC F W For details please refer to USB Basic Mini Firmware application note 3 Software Configuration 3 1 Module Configuration The HHID comprises the HID class driver and the device drivers for mouse and keyboard Figure 3 1 shows the structure of the HHID software modules Table 3 1 lists the modules and an overview of each User application APL USB BASIC F W l Manager MGR i l l
33. ng the API function R_usb_hstd_DriverRegistration is not called Example void usb smp task void R_usb_ hhid ChangeDeviceState USB_DO_ GLOBAL SUSPEND USB_PORTO usb_hsmpl_status_result RO1ANO664EJ0213 Rev 2 13 Page 35 of 39 Mar 16 2015 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID R_usb_hhid_GetReportLength Gets HID Report length Format uint16_t R_usb_hhid_GetReportLength void Argument Return Value Max packet size Description This function gets the max packet size of the connected USB device Note Example void usb _ smp task void uintl6 t usb smp report length usb_smp_report_length R_usb_hhid_GetReportLength R01AN0664EJ0213 Rev 2 13 Mar 16 2015 RENESAS Page 36 of 39 Renesas USB MCU USB Host Human Interface Device Class Driver HHID R_usb_hhid_get_interfaceprotocol Get interface protocol value Format uint8_t R_usb_hhid_get_interfaceprotocol void Argument Return Value Protocol code of USB device bInterfaceProtocol Description This function gets the interface protocol value of the connected USB device Note 1 blInterfaceProtocol is included in Interface Descriptor 2 The protocol code of the first HID class is sent as response for the multi interface device Example void usb smp _task void uint8 t protocol Gets the interface protocol value protocol R_usb hhid _get_interfaceprotocol RO1ANO664E
34. not used usb_ hsmpl_class_result HID class request callback function usb_hhid_smpl_get_report_result GET REPORT request callback function usb_hhid_smpl_kbd_led_ctl_result RO1AN0664EJ0213 Rev 2 13 Mar 16 2015 SET REPORT request callback function Page 10 of 39 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID 4 6 Host Application Task Sequence The following explains how the LCD display is updated and state transition controls 4 6 1 Displayed Information The application displays the USB device connection state and the content of reports received on the LCD When a keyboard is connected the character of the last key pressed on the keyboard is displayed When a mouse is connected the X Y motion data is displayed Values between 128 to 127 are displayed right justified If the content of a received report is NULL no key press on the keyboard or no XY motion from the mouse the display on the LCD is not updated The LCD display state transition is shown in Figure 4 3 1 Initial display at power on DETACH USB keyboard USB mouse 2 USB mouse attachment 3 USB keyboard attachment USB MSE USB KBD ATTACH ATTACH Receive report Receive report 4 USB mouse receive report display 5 USB keyboard receive report display 6 Detachment display USB DETACH Figure 4 3 The Transition of the Display State on the
35. ntended Renesas Electronics shall not be in any way liable for any damages or losses incurred by you or third parties arising from the use of any Renesas Electronics product for which the product is not intended by Renesas Electronics 6 You should use the Renesas Electronics products described in this document within the range specified by Renesas Electronics especially with respect to the maximum rating operating supply voltage range movement power voltage range heat radiation characteristics installation and other product characteristics Renesas Electronics shall have no liability for malfunctions or damages arising out of the use of Renesas Electronics products beyond such specified ranges 7 Although Renesas Electronics endeavors to improve the quality and reliability of its products semiconductor products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions Further Renesas Electronics products are not subject to radiation resistance design Please be sure to implement safety measures to guard them against the possibility of physical injury and injury or damage caused by fire in the event of the failure of a Renesas Electronics product such as safety design for hardware and software including but not limited to redundancy fire control and malfunction prevention appropriate treatment for aging degradation or any other appropriate measures Because the evaluation of microco
36. rChangeDeviceState USB_HHID_APL_KBD_SUSPEND USB_HHID_APL_MSE_SUSPEND USB_DATA_STOP C dmotificati transmit end call back Interrupt IN transfer ore MANCAT usb_hhid_InTransferResult Termination end usb_hhid_smpl_data_trans_result sb_hsmpl_device_state 4 operates by the context of USB BASIC FW driver gt statediagram usb_hsmpl_device_state Return 3 Continue with data communication sequence Figure 4 12 HID Device Suspend Sequence R01AN0664EJ0213 Rev 2 13 Page 19 of 39 Mar 16 2015 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID HHID USB BASIC F W usb_shhid_apl_function Continue from startup to HID device attachment sequence usb_shhid_apl_function USB_HHID_APL_MSE_RESUM USB_HHID_APL_KBD_SUSPEND USB_HHID_APL_MSE_SUSPE D USB_HHID_APL_KBD_RESUME sb_hsmpl_device_state operates by the context of USB BASIC FW Change device state request suspended driver gt statediagram usb_hsmpl_device_state usb_shhid_apl_function USB_HHID_APL_KBD_RESUME USB_HHID_APL_MSE_RESUME Data transmit request receive report E gt eee eee usb_shhid_apl_ function USB_HHID_APL_KBD_RX_WAIT USB_HHID_APL_MSE_RX_WAIT q Return 07 0 0 Continue with data communication sequence Figure 4 13 HID Device Resume Sequence RO1AN0664EJ
37. ral Precautions in the Handling of MPU MCU Products The following usage notes are applicable to all MPU MCU products from Renesas For detailed usage notes on the products covered by this document refer to the relevant sections of the document as well as any technical updates that have been issued for the products 1 Handling of Unused Pins Handle unused pins in accordance with the directions given under Handling of Unused Pins in the manual The input pins of CMOS products are generally in the high impedance state In operation with an unused pin in the open circuit state extra electromagnetic noise is induced in the vicinity of LSI an associated shoot through current flows internally and malfunctions occur due to the false recognition of the pin state as an input signal become possible Unused pins should be handled as described under Handling of Unused Pins in the manual 2 Processing at Power on The state of the product is undefined at the moment when power is supplied The states of internal circuits in the LSI are indeterminate and the states of register settings and pins are undefined at the moment when power is supplied In a finished product where the reset signal is applied to the external reset pin the states of pins are not guaranteed from the moment when power is supplied until the reset process is completed In a similar way the states of pins in a product that is reset by an on chip power on reset function are no
38. rd report Moreover the NumLock LED is turned on when the device is in the configured state and the NumLock LED is turned off when the device is in the suspended state 2 Suspends Resume of USB device operations a The USB device is suspended and resumed alternately when SW3 on the RSK is pressed b Resume is executed when a remote wakeup signal is received from a USB device Switch input operation is described in Table 3 2 Table 3 2 User switch input operation Switch Function Description Switch Number Data transfer start Start ongoing requests for report reception State change Change the following USB state In data reception wait state resumed go to Suspend state In Suspend state go to data reception wait state Resume RO1ANO664EJ0213 Rev 2 13 Page 5 of 39 Mar 16 2015 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID 3 3 File Configuration List 3 3 1 Folder Structure The folder structure of the files supplied with the device class is shown below The source codes dependent on each MCU and evaluation board are stored in each hardware resource folder devicename src HwResource RL78 G1C R8C Integrated development environment CS HEW IAR Embedded Workbench e studio MCU name Project File HOST Build result sre HIDFW Human Interface Device Class driver See Table 3 3 T inc Common header file of HID driver T src HID
39. reviations Terms and abbreviations used in this document are listed below API APL cstd Data Transfer HCD HDCD HEW HHID RSK Scheduler Scheduler Macro SW1 SW2 SW3 Task USB USB BASIC FW Application Program Interface Application program Prefix for peripheral amp host common function of USB BASIC F W Generic name of Control transfer Bulk transfer and Interrupt transfer Host control driver of USB BASIC F W Host device class driver device driver and USB class driver High performance Embedded Workshop Host human interface device Human interface device class Hardware Manual Prefix for host function of USB BASIC F W Keyboard device Peripheral device state manager of HCD Mouse device Pre processed definition Renesas Starter Kit Used to schedule functions like a simplified OS Used to call a scheduler function User switches on RSK Processing unit Universal Serial Bus USB BASIC F W Peripheral amp Host USB Basic Mini Firmware USB low level for Renesas USB MCU R01AN0664EJ0213 Rev 2 13 Mar 16 2015 Page 2 of 39 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID 1 4 How to Read This Document To run the demo start by reading USB Host Human Interface Device Class Driver HHID Installation Guide for USB Basic Mini Firmware This document is not intended for reading straight through Use it first to gain acquaintance with the package then to look up i
40. rmation table R_usb_hhid_PipeTransferExample USB data transfer request R_usb_hhid_TransferEnd USB data transfer termination request R_usb_hhid_class_request Send HID class request R_usb_hhid_Devicelnformation Acquire the USB state of a connected device R_usb_hhid_ChangeDeviceState Request USB status change of a connected device R_usb_hhid_GetReportLength Get the report length R_usb_hhid_get_hid_protocol RO1AN0664EJ0213 Rev 2 13 Mar 16 2015 Get Interface protocol value RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID R_usb_hhid_task The HHID task Format void R_usb_hhid_task void Argument Return Value Description The HHID task function The HHID task processes requests from the application and the results are notified to the application Note Please refer to USB Basic Mini Firmware application note about task loops Example void usb_apl task switch void while 1 if USB FLGSET R usb cstd Scheduler Scheduler R_usb hstd_HcdTask HCD Task R_usb hstd MgrTask MGR Task usb hhid main _task HHID Application Task R_usb hhid task HHID Task RO1ANO664EJ0213 Rev 2 13 Page 26 of 39 Mar 16 2015 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID R_usb_hhid_ClassCheck Check connected device s descriptors Format
41. rved X displacement Keycode 1 Y displacement Keycode 2 Keycode 3 Keycode 4 Keycode 5 2 Transmit Report Format Keycode 6 Table 6 5 shows the format of the transmit report sent to the HID device Reports are sent in the class request SetReport Table 6 5 Transmit report format Offset Application Data length 0 Top Byte Keyboard Mode 1 Bytes b0 LED 0 NumLock b1 LED 1 CapsLock b2 LED 2 ScrollLock b3 LED 3 Compose b4 LED 4 Kana Mouse Mode Non support 3 Note The report format used by HID devices for data communication is based on the report descriptor This HID driver does not acquire or analyze the report descriptor rather the report format is determined by the interface protocol code User modifications must conform to the HID class specifications RO1AN0664EJ0213 Rev 2 13 Mar 16 2015 RENESAS Page 24 of 39 Renesas USB MCU 6 5 The HHID API is shown in Table 6 6 USB Host Human Interface Device Class Driver HHID List of HHID API Functions Table 6 6 List of HHID API Functions Function Description R_usb_hhid_task HHID task processing R_usb_hhid_ClassCheck This function requests the HHID task to judge whether the connected device is a HID device R_usb_hhid_DriverStart Start driver task HHID R_usb_hhid_DriverStop Stop driver task HHID R_usb_hhid_SetPipeRegistration Set pipe info
42. t guaranteed from the moment when power is supplied until the power reaches the level at which resetting has been specified 3 Prohibition of Access to Reserved Addresses Access to reserved addresses is prohibited The reserved addresses are provided for the possible future expansion of functions Do not access these addresses the correct operation of LSI is not guaranteed if they are accessed 4 Clock Signals After applying a reset only release the reset line after the operating clock signal has become stable When switching the clock signal during program execution wait until the target clock signal has stabilized When the clock signal is generated with an external resonator or from an external oscillator during a reset ensure that the reset line is only released after full stabilization of the clock signal Moreover when switching to a clock signal produced with an external resonator or by an external oscillator while program execution is in progress wait until the target clock signal is stable 5 Differences between Products Before changing from one product to another i e to a product with a different part number confirm that the change will not lead to problems The characteristics of an MPU or MCU in the same group but having a different part number may differ in terms of the internal memory capacity layout pattern and other factors which can affect the ranges of electrical characteristics such as character
43. tl6e t tbl 4 Device information check R_usb_ hhid DeviceInformation tbl RO1ANO664EJ0213 Rev 2 13 Page 34 of 39 Mar 16 2015 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID R_usb_hhid_ChangeDeviceState USB device state change request Format usb_er_t R_usb_hhid_ChangeDeviceState usb_strct_t msginfo usb_strct_t keyword usb_cb_info_t complete Arguments msginfo USB state to change into States are listed below keyword Content depends on msginfo For example it would be port number if the port is to be disabled complete Callback function executed when the USB state changing ends Return Value USB_E OK Success USB_E_ ERROR Failure argument error Description Set the following value to argument msginfo and request to change the device state to the USB BASIC F W e USB_DO_PORT_ENABLE USB_DO_PORT_DISABLE Enable or disable a port specified by a keyword on off control of VBUS output e USB_DO_GLOBAL_SUSPEND Suspend a port specified by a keyword e USB_DO_GLOBAL_RESUME Resume a port specified by a keyword e USB_DO_CLEAR_STALL Cancel STALL of the device that uses a pipe specified by a keyword Notes 1 When a connection or disconnection is detected by the USB BASIC F W USB BASIC F W automatically does enumeration or the detach sequence processing 2 When changing the USB state using this function the USB state transition callback of the driver structure registered usi
44. uired from input report Data transmit request receive report R_usb_hhid_class_request Continue with data communication sequence Figure 4 10 Control transfer Communication Sequence by MSE 4 8 3 HID Device Detach The sequence when the HID device is detached is illustrated in Figure 4 11 USB BASIC F W Continue from startup to HID device attachment sequence isb_hsmpl_device_state operates by the context of USB BASIC FW driver gt statediagram usb_hsmpl_device_state rStop Initialized pipe information table usb_shhid_apl_function USB_HHID_APL_CLOSE F r Return usb_shhid_apl_function USB_HHID_APL_CLOSE Continue with data communication sequence Figure 4 11 Device Detach Sequence R01AN0664EJ0213 Rev 2 13 Mar 16 2015 Page 18 of 39 RENESAS Renesas USB MCU USB Host Human Interface Device Class Driver HHID 4 8 4 HID Device Suspended Resumed Figure 4 12 shows the suspend sequence Figure 4 13 shows the resume sequence APL HHID USB BASIC F W Continue from startup to HID device attachment sequence usb_shhid_apl_function USB_HHID_APL_KBD_RX_WAIT Data transfer termination USB_HHID_APL_MSE_RX wait 23 transfer terminatio R_usb_hhid_TransferEnd se A R_usb_hstd_TransterEnd _ Change device state request suspended 4 usb_shhid aplfunction 77T 1 R_usb_hstd_Mg
45. ver registration usb_hhid_class_check Check that connected device is a HID usb_hsmpl_device_state Application status change callback function usb hhid smpl data_trans_result Data transfer complete processing usb hhid smpl mse_data Mouse data reception processing usb hhid smpl val_to_str 1 byte numeric data string conversion processing usb hhid smpl kbd_data Keyboard data reception processing usb hhid smp_status_set Sample application mode setting processing usb hhid smpl get_hid_descriptor HID descriptor processing not used usb hhid smpl get_report_descriptor Report descriptor getting processing not used usb hhid smpl get_physical_descriptor Physical descriptor getting processing not used usb hhid smpl kbd_led_ctl Keyboard LED ON OFF control usb hhid smpl set_report SET REPORT request processing not used usb hhid smpl get_report GET REPORT request processing not used usb hhid smpl set_idle SET IDLE request processing not used usb hhid smpl get_idle GET IDLE request processing not used usb hhid smpl set_protocol SET PROTOCOL request processing not used usb hhid smpl get_protocol GET PROTOCOL request processing
46. y copy or otherwise misappropriate any Renesas Electronics product whether in whole or in part Renesas Electronics assumes no responsibility for any losses incurred by you or third parties arising from such alteration modification copy or otherwise misappropriation of Renesas Electronics product 5 Renesas Electronics products are classified according to the following two quality grades Standard and High Quality The recommended applications for each Renesas Electronics product depends on the product s quality grade as indicated below Standard Computers office equipment communications equipment test and measurement equipment audio and visual equipment home electronic appliances machine tools personal electronic equipment and industrial robots etc High Quality Transportation equipment automobiles trains ships etc traffic control systems anti disaster systems anti crime systems and safety equipment etc Renesas Electronics products are neither intended nor authorized for use in products or systems that may pose a direct threat to human life or bodily injury artificial life support devices or systems surgical implantations etc or may cause serious property damages nuclear reactor control systems military equipment etc You must check the quality grade of each Renesas Electronics product before using it in a particular application You may not use any Renesas Electronics product for any application for which it is not i

Download Pdf Manuals

image

Related Search

Related Contents

identificação do dispositivo ne-u700 manual de instruções  Mixer WMX 60/80 - Manual de instrucciones  GBC A4, 2 x 38 micron, gloss, 200 pack    PS2A200  Uniden BC75XLT Owner's Manual  取扱説明書 - 1.01 MB  

Copyright © All rights reserved.
Failed to retrieve file