APIs relating to endpoint management
|
| enum | cyhal_usb_dev_ep_type_t { CYHAL_USB_DEV_EP_TYPE_CTRL = 0,
CYHAL_USB_DEV_EP_TYPE_ISO = 1,
CYHAL_USB_DEV_EP_TYPE_BULK = 2,
CYHAL_USB_DEV_EP_TYPE_INT = 3
} |
| |
|
| cy_rslt_t | cyhal_usb_dev_endpoint_add (cyhal_usb_dev_t *obj, bool alloc, bool enable, cyhal_usb_dev_ep_t endpoint, uint32_t maxPacket, cyhal_usb_dev_ep_type_t type) |
| |
| cy_rslt_t | cyhal_usb_dev_endpoint_remove (cyhal_usb_dev_t *obj, cyhal_usb_dev_ep_t endpoint) |
| |
| cy_rslt_t | cyhal_usb_dev_endpoint_stall (cyhal_usb_dev_t *obj, cyhal_usb_dev_ep_t endpoint) |
| |
| cy_rslt_t | cyhal_usb_dev_endpoint_unstall (cyhal_usb_dev_t *obj, cyhal_usb_dev_ep_t endpoint) |
| |
| bool | cyhal_usb_dev_endpoint_is_stalled (cyhal_usb_dev_t *obj, cyhal_usb_dev_ep_t endpoint) |
| |
| cy_rslt_t | cyhal_usb_dev_endpoint_read (cyhal_usb_dev_t *obj, cyhal_usb_dev_ep_t endpoint, uint8_t *data, uint32_t size) |
| |
| cy_rslt_t | cyhal_usb_dev_endpoint_read_result (cyhal_usb_dev_t *obj, cyhal_usb_dev_ep_t endpoint, uint32_t *actSize) |
| |
| cy_rslt_t | cyhal_usb_dev_endpoint_write (cyhal_usb_dev_t *obj, cyhal_usb_dev_ep_t endpoint, uint8_t const *data, uint32_t size) |
| |
| cy_rslt_t | cyhal_usb_dev_endpoint_abort (cyhal_usb_dev_t *obj, cyhal_usb_dev_ep_t endpoint) |
| |
| void | cyhal_usb_dev_register_endpoint_callback (cyhal_usb_dev_t *obj, cyhal_usb_dev_ep_t endpoint, cyhal_usb_dev_endpoint_callback_t callback) |
| |
◆ CYHAL_USB_DEV_IS_IN_EP
| #define CYHAL_USB_DEV_IS_IN_EP |
( |
|
endpoint | ) |
(0U != (0x80U & (uint32_t) (endpoint))) |
Returns true if endpoint direction is IN
◆ CYHAL_USB_DEV_GET_EP_NUM
| #define CYHAL_USB_DEV_GET_EP_NUM |
( |
|
endpoint | ) |
((uint32_t) (endpoint) & 0x0FU) |
Returns endpoint number (type uint32_t)
◆ CYHAL_USB_DEV_GET_EP_IDX
Returns endpoint index (type uint32_t)
◆ cyhal_usb_dev_ep_t
USB endpoint address (consists from endpoint number and direction)
◆ cyhal_usb_dev_endpoint_callback_t
Callback handler for the transfer completion event for data endpoints (not applicable for endpoint 0)
◆ cyhal_usb_dev_ep_type_t
USB Device Endpoints types
◆ cyhal_usb_dev_endpoint_add()
Configure an endpoint.
- Parameters
-
| [in,out] | obj | The usb device object |
| [in] | alloc | True to allocates buffer for the endpoint, false to skip allocation |
| [in] | enable | True to enable endpoint operation, false to skip enablement |
| [in] | endpoint | Endpoint to configure and enable |
| [in] | maxPacket | The maximum packet size that can be sent or received |
| [in] | type | The type of endpoint (does not care when enable parameter is false) |
- Returns
- The status of the endpoint add request
- Note
- This function cannot be used to configure endpoint 0. That must be done with cyhal_usb_dev_ep0_get_max_packet.
- After endpoint was enabled it must be removed with cyhal_usb_dev_endpoint_remove and then enabled again.
◆ cyhal_usb_dev_endpoint_remove()
Disable an endpoint
- Parameters
-
| [in,out] | obj | The usb device object |
| [in] | endpoint | Endpoint to disable |
- Returns
- The status of the endpoint remove request
◆ cyhal_usb_dev_endpoint_stall()
Perform a functional stall on the given endpoint
Set the HALT feature for this endpoint so that all further communication is aborted.
- Parameters
-
| [in,out] | obj | The usb device object |
| [in] | endpoint | Endpoint to stall |
- Returns
- The status of the endpoint stall request
◆ cyhal_usb_dev_endpoint_unstall()
Unstall the endpoint
Clear the HALT feature on this endpoint so communication can resume.
- Parameters
-
| [in,out] | obj | The usb device object |
| [in] | endpoint | Endpoint to stall |
- Returns
- The status of the endpoint unstall request
◆ cyhal_usb_dev_endpoint_is_stalled()
Return the endpoint stall state
- Parameters
-
| [in,out] | obj | The usb device object |
| [in] | endpoint | Endpoint to check stall state |
- Returns
- True if endpoint stalled, false otherwise.
◆ cyhal_usb_dev_endpoint_read()
Start a read on the given endpoint
- Parameters
-
| [in,out] | obj | The usb device object |
| [in] | endpoint | Endpoint to start the read on |
| [in] | data | Buffer to fill with data |
| [in] | size | Size of the read buffer. This must be at least the max packet size for this endpoint. |
- Returns
- The status of start a read operation
◆ cyhal_usb_dev_endpoint_read_result()
Finish a read on the given endpoint
- Parameters
-
| [in,out] | obj | The usb device object |
| [in] | endpoint | Endpoint to check |
| [out] | actSize | Actual number of bytes that was read |
- Returns
- The status of a finish read
◆ cyhal_usb_dev_endpoint_write()
Start a write on the given endpoint
- Parameters
-
| [in,out] | obj | The usb device object |
| [in] | endpoint | Endpoint to write to |
| [in] | data | Buffer to write |
| [in] | size | Size of data to write |
- Returns
- The status of a write request
◆ cyhal_usb_dev_endpoint_abort()
Abort the current transfer if it has not yet been sent
- Parameters
-
| [in,out] | obj | The usb device object |
| [in] | endpoint | Endpoint to abort the transfer on. It is implementation defined if this function has an effect on receive endpoints. |
- Returns
- The status of an abort request
- Note
- For the ISOC endpoints in pending state this function does not wait for bus activity completion because these endpoints do not have handshake and are always accessible to the Host. Therefore it is safe to call this function for ISOC endpoint when the Host will not access them during abort.
◆ cyhal_usb_dev_register_endpoint_callback()
The USB Device endpoint complete callback handler registration
- Parameters
-
| [in,out] | obj | The usb device object |
| [in] | endpoint | Endpoint to registers handler |
| [in] | callback | The callback handler which will be invoked when the endpoint comp |