APIs relating to endpoint management.
|
#define | CYHAL_USB_DEV_IS_IN_EP(endpoint) (0U != (0x80U & (uint32_t) (endpoint))) |
| Returns true if endpoint direction is IN.
|
|
#define | CYHAL_USB_DEV_GET_EP_NUM(endpoint) ((uint32_t) (endpoint) & 0x0FU) |
| Returns endpoint number (type uint32_t)
|
|
#define | CYHAL_USB_DEV_GET_EP_IDX(endpoint) (CYHAL_USB_DEV_GET_EP_NUM(endpoint) - 1U) |
| Returns endpoint index (type uint32_t)
|
|
|
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
} |
| USB Device Endpoints types.
|
|
|
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 max_packet, cyhal_usb_dev_ep_type_t type) |
| Configure an endpoint. More...
|
|
cy_rslt_t | cyhal_usb_dev_endpoint_remove (cyhal_usb_dev_t *obj, cyhal_usb_dev_ep_t endpoint) |
| Disable an endpoint. More...
|
|
cy_rslt_t | cyhal_usb_dev_endpoint_stall (cyhal_usb_dev_t *obj, cyhal_usb_dev_ep_t endpoint) |
| Perform a functional stall on the given endpoint. More...
|
|
cy_rslt_t | cyhal_usb_dev_endpoint_unstall (cyhal_usb_dev_t *obj, cyhal_usb_dev_ep_t endpoint) |
| Unstall the endpoint. More...
|
|
bool | cyhal_usb_dev_endpoint_is_stalled (cyhal_usb_dev_t *obj, cyhal_usb_dev_ep_t endpoint) |
| Return the endpoint stall state. More...
|
|
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) |
| Start a read on the given endpoint. More...
|
|
cy_rslt_t | cyhal_usb_dev_endpoint_read_result (cyhal_usb_dev_t *obj, cyhal_usb_dev_ep_t endpoint, uint32_t *act_size) |
| Finish a read on the given endpoint. More...
|
|
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) |
| Start a write on the given endpoint. More...
|
|
cy_rslt_t | cyhal_usb_dev_endpoint_abort (cyhal_usb_dev_t *obj, cyhal_usb_dev_ep_t endpoint) |
| Abort the current transfer if it has not yet been sent. More...
|
|
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) |
| The USB Device endpoint complete callback handler registration. More...
|
|
◆ 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] | max_packet | 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] | act_size | 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 |