nRF52840 only: Core module that manages current USB state and process device requests. More...
Data Structures |
|
| struct | app_usbd_core_setup_data_handler_desc_t |
|
Variable type used to register EP0 transfer handler.
More...
|
|
| struct | CONCAT_2 |
|
Declare Core instance type.
More...
|
|
Macros |
|
| #define | APP_USBD_CORE_CLASS_CONFIGURATION ((0, NRF_DRV_USBD_EPOUT0 , NRF_DRV_USBD_EPIN0 )) |
|
Core interface configuration.
More...
|
|
| #define | APP_USBD_STATE_SUSPENDED_MASK 0x80 |
|
Suspend state mask.
More...
|
|
| #define | APP_USB_STATE_BASE (state) (( app_usbd_state_t )((uint32_t)(state) & (~ APP_USBD_STATE_SUSPENDED_MASK ))) |
|
Remove
APP_USBD_STATE_SUSPENDED_MASK
bit from core state.
|
|
Typedefs |
|
| typedef ret_code_t (* | app_usbd_core_setup_data_handler_t )( nrf_drv_usbd_ep_status_t status, void *p_context) |
|
EP0 handler function pointer.
More...
|
|
| typedef struct CONCAT_2 | _data_t |
Enumerations |
|
| enum |
app_usbd_state_t
{
APP_USBD_STATE_Disabled = 0x00, APP_USBD_STATE_Unattached = 0x01, APP_USBD_STATE_Powered = 0x02, APP_USBD_STATE_Default = 0x03, APP_USBD_STATE_Addressed = 0x04, APP_USBD_STATE_Configured = 0x05, APP_USBD_STATE_SuspendedPowered = 0x80 | APP_USBD_STATE_Powered, APP_USBD_STATE_SuspendedDefault = 0x80 | APP_USBD_STATE_Default, APP_USBD_STATE_SuspendedAddressed = 0x80 | APP_USBD_STATE_Addressed, APP_USBD_STATE_SuspendedConfigured = 0x80 | APP_USBD_STATE_Configured } |
|
USB Device state.
More...
|
|
Detailed Description
nRF52840 only: Core module that manages current USB state and process device requests.
Macro Definition Documentation
| #define APP_USBD_CORE_CLASS_CONFIGURATION ((0, NRF_DRV_USBD_EPOUT0 , NRF_DRV_USBD_EPIN0 )) |
Core interface configuration.
Core instance would have 2 endpoints (IN0 and OUT0). The interface number does not matter because it is not used.
| #define APP_USBD_STATE_SUSPENDED_MASK 0x80 |
Suspend state mask.
Mask used to mark suspended state, suspended state remembers also the target state after wake up
Typedef Documentation
| typedef ret_code_t (* app_usbd_core_setup_data_handler_t)( nrf_drv_usbd_ep_status_t status, void *p_context) |
EP0 handler function pointer.
Type of the variable that would hold the pointer to the handler for endpoint 0 messages processing.
- Parameters
-
p_contex Context variable configured with the transmission request.
Enumeration Type Documentation
| enum app_usbd_state_t |
USB Device state.
Possible USB Device states according to specification.
Function Documentation
| ret_code_t app_usbd_core_ep_transfer | ( | nrf_drv_usbd_ep_t | ep , |
| nrf_drv_usbd_transfer_t const *const | p_transfer | ||
| ) |
Endpoint transfer.
- Parameters
-
ep Endpoint number p_transfer Description of the transfer to be performed. The direction of the transfer is determined by the endpoint number.
- Return values
-
NRF_ERROR_INVALID_STATE The state of the USB device does not allow data transfer on the endpoint.
- Returns
- Values returned by nrf_drv_usbd_ep_transfer
- Note
- This function can work only if the USB is in Configured state. See app_usbd_core_setup_data_transfer for transfers before device configuration is done.
- See Also
- app_usbd_core_setup_data_transfer
| bool app_usbd_core_feature_state_get | ( | app_usbd_setup_stdfeature_t | feature | ) |
Check current feature state.
Function checks the state of the selected feature that was configured by the host.
- Parameters
-
feature Feature to check. Only features related to the device should be checked by this function.
- Return values
-
true Selected feature is set false Selected feature is cleared
|
inline static |
Access to core instance.
Function that returns pointer to the USBD core instance.
- Returns
- pointer to the core instance
| ret_code_t app_usbd_core_setup_data_handler_set | ( | nrf_drv_usbd_ep_t | ep , |
| app_usbd_core_setup_data_handler_desc_t const *const | p_handler_desc | ||
| ) |
Configure the handler for the nearest setup data endpoint transfer.
This function would be called on incomming setup data. The correct place to set the handler for a data is when SETUP command was received.
- Parameters
-
ep Endpoint number (only IN0 and OUT0) are supported. p_handler_desc Descriptor of the handler to be called.
- Return values
-
NRF_SUCCESS Successfully configured NRF_ERROR_INVALID_ADDR Last received setup direction does not match configured endpoint.
| ret_code_t app_usbd_core_setup_data_transfer | ( | nrf_drv_usbd_ep_t | ep , |
| nrf_drv_usbd_transfer_t const *const | p_transfer | ||
| ) |
Setup data transfer.
Function similar to app_usbd_core_ep_transfer . The only technical diference is that it should be used with setup transfers that are going to be performed before device is configured.
- Parameters
-
ep See app_usbd_core_ep_transfer . p_transfer See app_usbd_core_ep_transfer .
- Returns
- The same values like app_usbd_core_ep_transfer
| ret_code_t app_usbd_core_setup_rsp | ( | app_usbd_setup_t const * | p_setup , |
| void const * | p_data , | ||
| size_t | size | ||
| ) |
Default simple response to setup command.
This function generates default simple response. It sends ZLP when required and on takes care on allowing status stage when transfer is finished.
- Parameters
-
p_setup Pointer to original setup message p_data Pointer to the response. This has to be globaly aviable data. size Total size of the answer - The function takes care about limiting the size of transfered data to the size required by setup command.
| void* app_usbd_core_setup_transfer_buff_get | ( | size_t * | p_size | ) |
Set up a data transfer buffer.
Returns special internal buffer that can be used in setup transfer.
- Returns
- Internal buffer pointer
| app_usbd_state_t app_usbd_core_state_get | ( | void | ) |
Return internal USBD core state.
- Returns
- Check app_usbd_state_t to find possible USBD core states
| ret_code_t app_usbd_ep_handled_transfer | ( | nrf_drv_usbd_ep_t | ep , |
| nrf_drv_usbd_handler_desc_t const *const | p_handler | ||
| ) |
Set up an endpoint-handled transfer.
Configures a transfer handled by the feedback function.
- Parameters
-
ep Endpoint number. p_handler Function called when the next chunk of data is requested.
- Return values
-
NRF_ERROR_INVALID_STATE The state of the USB device does not allow data transfer on the endpoint.
- Returns
- Values returned by nrf_drv_usbd_ep_handled_transfer .
| ret_code_t app_usbd_setup_data_handled_transfer | ( | nrf_drv_usbd_ep_t | ep , |
| nrf_drv_usbd_handler_desc_t const *const | p_handler | ||
| ) |
Set up a data-handled transfer.
Function similar to app_usbd_ep_handled_transfer . The only technical diference is that it should be used with setup transfers that are performed before the device is configured.
- Parameters
-
ep Endpoint number p_handler Function called when the next chunk of data is requested.
- Return values
-
NRF_ERROR_INVALID_STATE The state of the USB device does not allow data transfer on the endpoint.
- Returns
- Values returned by nrf_drv_usbd_ep_handled_transfer .