How can I access Report 1 and Report 2?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
KeMa_1120931
Level 2
Level 2
First like given

Hello,
I am using PSoC Designer 5.4 SP 1 for PSoc 1.

I want to make HID's multimedia keyboard.

I am using USBFS_LoadInEP ().

void USBFS_LoadInEP(BYTE bEPNumber, BYTE *pData, WORD wLength, BYTE bToggle)

I want to know how to access Report ID 2.

How can I access Report 1 and Report 2?

HID_ReportID.jpg

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.

Adding custom code to the USB Component and handling the Control Message is not straightforward. It would be easy to understand with an example.

I have attached a document and an example project. Please have to look to understand how to override the USB Component and handle the data ourselves in application layer.

View solution in original post

0 Likes
2 Replies
KeMa_1120931
Level 2
Level 2
First like given

  I got it from the datasheet.

I tried it but I can not understand it.

/-----

Specify Your Device and Generate Application

Use the USB setup wizard to specify your device description, endpoints, and HID reports. Click the Generate Application button in PSoC Designer.

Disable the Wizard Defined Report Storage Area

In the USB_descr.asm file, disable the wizard defined storage area by uncommenting the WIZARD_DEFINED_REPORT_STORAGE line in the custom code area as shown.

WIZARD: equ 1

WIZARD_DEFINED_REPORT_STORAGE: equ 1

   ;---------------------------------------------------

;@PSoC_UserCode_BODY_1@ (Do not change this line.)

   ;---------------------------------------------------

   ; Insert your custom code below this banner

   ;---------------------------------------------------

   ; Redefine the WIZARD equate to 0 below by

; uncommenting the WIZARD: equ 0 line

; to allow your custom descriptor to take effect

   ;---------------------------------------------------

; WIZARD: equ 0

   WIZARD_DEFINED_REPORT_STORAGE: equ 0

   ;---------------------------------------------------

   ; Insert your custom code above this banner

   ;---------------------------------------------------

   ;@PSoC_UserCode_END@ (Do not change this line.)

Copy the Wizard Created Code

Find this code in USB_descr.asm.

;----------------------------------------------------------------------

; HID IN Report Transfer Descriptor Table for ()

;----------------------------------------------------------------------

IF WIZARD_DEFINED_REPORT_STORAGE

AREA  UserModules     (ROM,REL,CON)

.LITERAL

USB_D0_C1_I0_IN_RPTS:                         

TD_START_TABLE 1                               ; Only 1 Transfer Descriptor

  TD_ENTRY       USB_DS_RAM, USB_HID_RPT_3_IN_RPT_SIZE, USB_INTERFACE_0_IN_RPT_DATA, NULL_PTR

.ENDLITERAL

ENDIF ; WIZARD_DEFINED_REPORT_STORAGE

There are three sections, one each for the IN, OUT, and FEATURE reports. Copy all three sections.

Paste the Code Into the Protected User Code Area

You can paste the code into the protected user code area of USB_descr.asm shown or a separate assembly language file.

   ;---------------------------------------------------

   ;@PSoC_UserCode_BODY_2@ (Do not change this line.)

   ;---------------------------------------------------

   ; Redefine your descriptor table below. You might

   ; cut and paste code from the WIZARD descriptor

   ; above and then make your changes.

   ;---------------------------------------------------

   ;---------------------------------------------------

   ; Insert your custom code above this banner

   ;---------------------------------------------------

   ;@PSoC_UserCode_END@ (Do not change this line.)

; End of File USB_descr.asm

Customize the Code to Define the Report Storage Area

To define the report storage area, you will write your own transfer descriptor table entries. The table contains entries to define storage space for the required data items. Each transfer descriptor entry in the table creates a new Report ID. IDs are numbered consecutively, starting with zero. Report ID 0 is not used; you cannot specify a Report ID of 0, but the transfer descriptor entry specified for the ID 0 will be used in the case that no Report IDs are present in the Report descriptor. For the sake of code efficiency, you should use Report IDs in order starting with ID 1.

Table 6. Transfer Descriptor Table Entries Table Entry

Required Data Items

Description

TD_START_TABLE

USBFS_NumberOfTableEntries

Number of Report IDs defined. IDs are numbered consecutively from 0. Report ID 0 is not used.

TD_ENTRY

USBFS_DataSource

The data source is RAM or ROM (USBFS_DS_RAM or USBFS_DS_ROM).

USBFS_TransferSize

Size of the data transfer in bytes. The first byte is the Report ID.

USBFS_DataPtr

RAM or ROM address of the data transfer.

USBFS_StatusBlockPtr

Address of a status block allocated with the USBFS_XFER_STATUS_BLOCK macro.

The following example sets up the unused Report ID 0, and two other IN reports with different sizes. Note Conditional assembly statements are only necessary if you place the code in the protected user code area of USB_descr.asm.

;----------------------------------------------------------------------

; HID IN Report Transfer Descriptor Table for ()

;----------------------------------------------------------------------

IF WIZARD_DEFINED_REPORT_STORAGE

ELSE

_ID0_RPT_SIZE:   EQU 8       ; 7 data bytes + report ID = 8 bytes (unused)

_SM_RPT_SIZE:    EQU 3       ; 2 data bytes + report ID = 3 bytes

_LG_RPT_SIZE:    EQU 5       ; 4 data bytes + report ID = 5 bytes

AREA data (RAM, REL, CON)

EXPORT _ID0_RPT_PTR

_ID0_RPT_PTR: BLK 8         ; Allocates space for report ID0 (unused)

EXPORT _SM_RPT_PTR

_SM_RPT_PTR:    BLK 3       ; Allocates space for report ID1

EXPORT _LG_RPT_PTR

_LG_RPT_PTR:    BLK 5       ; Allocates space for report ID2

AREA bss (RAM, REL, CON)

EXPORT _SM_RPT_STS_PTR

_SM_RPT_STS_PTR: USBFS_XFER_STATUS_BLOCK

EXPORT _LG_RPT_STS_PTR

_LG_RPT_STS_PTR: USBFS_XFER_STATUS_BLOCK

AREA  UserModules

0 Likes
lock attach
Attachments are accessible only for community members.

Adding custom code to the USB Component and handling the Control Message is not straightforward. It would be easy to understand with an example.

I have attached a document and an example project. Please have to look to understand how to override the USB Component and handle the data ourselves in application layer.

0 Likes