- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How does the function CyFx3BootRegisterSetupCallback get 'setupdat1' and 'setupdat0'?
I use debugger found the value is 0x00010000 and 0xe600a0c0 in the UsbI2cRegMode example.
But I do not know where does those value comes from.
Does anybody know that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The setup0 and setup1 contain the different fields of a USB Setup requests: You can decode the same using:
bReqType = (setupdat0 & CY_U3P_USB_REQUEST_TYPE_MASK);
bType = (bReqType & CY_U3P_USB_TYPE_MASK);
bTarget = (bReqType & CY_U3P_USB_TARGET_MASK);
bRequest = ((setupdat0 & CY_U3P_USB_REQUEST_MASK) >> CY_U3P_USB_REQUEST_POS);
wValue = ((setupdat0 & CY_U3P_USB_VALUE_MASK) >> CY_U3P_USB_VALUE_POS);
wIndex = ((setupdat1 & CY_U3P_USB_INDEX_MASK) >> CY_U3P_USB_INDEX_POS);
Where the masks and positions are defined as:
#define CY_U3P_USB_REQUEST_TYPE_MASK (0x000000FF)
/** \def CY_U3P_USB_REQUEST_TYPE_POS
\brief Position of the bmRequestType field in the USB setup request.
*/
#define CY_U3P_USB_REQUEST_TYPE_POS (0)
/** \def CY_U3P_USB_REQUEST_MASK
\brief Mask to get the bRequest field from the USB setup request.
*/
#define CY_U3P_USB_REQUEST_MASK (0x0000FF00)
/** \def CY_U3P_USB_REQUEST_POS
\brief Position of the bRequest field in the USB setup request.
*/
#define CY_U3P_USB_REQUEST_POS (8)
/** \def CY_U3P_USB_VALUE_MASK
\brief Mask to get the wValue field from the USB setup request.
*/
#define CY_U3P_USB_VALUE_MASK (0xFFFF0000)
/** \def CY_U3P_USB_VALUE_POS
\brief Position of the wValue field in the USB setup request.
*/
#define CY_U3P_USB_VALUE_POS (16)
/** \def CY_U3P_USB_INDEX_MASK
\brief Mask to get the wIndex field from the USB setup request.
*/
#define CY_U3P_USB_INDEX_MASK (0x0000FFFF)
/** \def CY_U3P_USB_INDEX_POS
\brief Position of the wIndex field in the USB setup request.
*/
#define CY_U3P_USB_INDEX_POS (0)
/** \def CY_U3P_USB_LENGTH_MASK
\brief Mask to get the wLength field from the USB setup request.
*/
#define CY_U3P_USB_LENGTH_MASK (0xFFFF0000)
/** \def CY_U3P_USB_LENGTH_POS
\brief Position of the wLength field in the USB setup request.
*/
#define CY_U3P_USB_LENGTH_POS (16)
For knowing about the fields like bRequest, bType, wLength, Index etc, please refer the USB Specification,
Regards,
- Madhu Sudhan