tinyusb  0.4
Click here to lend your support to tinyusb donation and make a donation at pledgie.com
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Host

Functions

bool tusbh_cdc_serial_is_mounted (uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT
 Check if device support CDC Serial interface or not. More...
 
bool tusbh_cdc_is_busy (uint8_t dev_addr, cdc_pipeid_t pipeid) ATTR_PURE ATTR_WARN_UNUSED_RESULT
 Check if the interface is currently busy or not. More...
 
tusb_error_t tusbh_cdc_send (uint8_t dev_addr, void const *p_data, uint32_t length, bool is_notify)
 Perform USB OUT transfer to device. More...
 
tusb_error_t tusbh_cdc_receive (uint8_t dev_addr, void *p_buffer, uint32_t length, bool is_notify)
 Perform USB IN transfer to get data from device. More...
 
void tusbh_cdc_mounted_cb (uint8_t dev_addr)
 Callback function that will be invoked when a device with CDC Abstract Control Model interface is mounted. More...
 
void tusbh_cdc_unmounted_cb (uint8_t dev_addr)
 Callback function that will be invoked when a device with CDC Abstract Control Model interface is unmounted. More...
 
void tusbh_cdc_xfer_isr (uint8_t dev_addr, tusb_event_t event, cdc_pipeid_t pipe_id, uint32_t xferred_bytes)
 Callback function that is invoked when an transferring event occurred. More...
 

Detailed Description

Function Documentation

bool tusbh_cdc_is_busy ( uint8_t  dev_addr,
cdc_pipeid_t  pipeid 
)

Check if the interface is currently busy or not.

Parameters
[in]dev_addrdevice address
[in]pipeidvalue from cdc_pipeid_t to indicate target pipe.
Return values
trueif the interface is busy, meaning the stack is still transferring/waiting data from/to device
falseif the interface is not busy, meaning the stack successfully transferred data from/to device
Note
This function is used to check if previous transfer is complete (success or error), so that the next transfer can be scheduled. User needs to make sure the corresponding interface is mounted (by tusbh_cdc_serial_is_mounted) before calling this function.
void tusbh_cdc_mounted_cb ( uint8_t  dev_addr)

Callback function that will be invoked when a device with CDC Abstract Control Model interface is mounted.

Parameters
[in]dev_addrAddress of newly mounted device
Note
This callback should be used by Application to set-up interface-related data
tusb_error_t tusbh_cdc_receive ( uint8_t  dev_addr,
void *  p_buffer,
uint32_t  length,
bool  is_notify 
)

Perform USB IN transfer to get data from device.

Parameters
[in]dev_addrdevice address
[in]p_bufferBuffer containing received data. Must be accessible by USB controller (see TUSB_CFG_ATTR_USBRAM)
[in]lengthNumber of bytes to be transferred via USB bus
Return values
TUSB_ERROR_NONEon success
TUSB_ERROR_INTERFACE_IS_BUSYif the interface is already transferring data with device
TUSB_ERROR_DEVICE_NOT_READYif device is not yet configured (by SET CONFIGURED request)
TUSB_ERROR_INVALID_PARAif input parameters are not correct
Note
This function is non-blocking and returns immediately. The result of USB transfer will be reported by the interface's callback function. p_data must be declared with TUSB_CFG_ATTR_USBRAM.
tusb_error_t tusbh_cdc_send ( uint8_t  dev_addr,
void const *  p_data,
uint32_t  length,
bool  is_notify 
)

Perform USB OUT transfer to device.

Parameters
[in]dev_addrdevice address
[in]p_dataBuffer containing data. Must be accessible by USB controller (see TUSB_CFG_ATTR_USBRAM)
[in]lengthNumber of bytes to be transferred via USB bus
Return values
TUSB_ERROR_NONEon success
TUSB_ERROR_INTERFACE_IS_BUSYif the interface is already transferring data with device
TUSB_ERROR_DEVICE_NOT_READYif device is not yet configured (by SET CONFIGURED request)
TUSB_ERROR_INVALID_PARAif input parameters are not correct
Note
This function is non-blocking and returns immediately. The result of USB transfer will be reported by the interface's callback function. p_data must be declared with TUSB_CFG_ATTR_USBRAM.
bool tusbh_cdc_serial_is_mounted ( uint8_t  dev_addr)

Check if device support CDC Serial interface or not.

Parameters
[in]dev_addrdevice address
Return values
trueif device supports
falseif device does not support or is not mounted
void tusbh_cdc_unmounted_cb ( uint8_t  dev_addr)

Callback function that will be invoked when a device with CDC Abstract Control Model interface is unmounted.

Parameters
[in]dev_addrAddress of newly unmounted device
Note
This callback should be used by Application to tear-down interface-related data
void tusbh_cdc_xfer_isr ( uint8_t  dev_addr,
tusb_event_t  event,
cdc_pipeid_t  pipe_id,
uint32_t  xferred_bytes 
)

Callback function that is invoked when an transferring event occurred.

Parameters
[in]dev_addrAddress of device
[in]eventan value from tusb_event_t
[in]pipe_idvalue from cdc_pipeid_t indicate the pipe
[in]xferred_bytesNumber of bytes transferred via USB bus
Note
event can be one of following
  • TUSB_EVENT_XFER_COMPLETE : previously scheduled transfer completes successfully.
  • TUSB_EVENT_XFER_ERROR : previously scheduled transfer encountered a transaction error.
  • TUSB_EVENT_XFER_STALLED : previously scheduled transfer is stalled by device.