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... | |
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, APP_USBD_STATE_Unattached, APP_USBD_STATE_Powered, APP_USBD_STATE_Default, APP_USBD_STATE_Addressed, APP_USBD_STATE_Configured } |
USB Device state. More... | |
Functions | |
union | CONCAT_2 (app_usbd_core, _u) |
CONCAT_2 (app_usbd_core, _t) | |
static app_usbd_class_inst_t const * | app_usbd_core_instance_access (void) |
Access to core instance. More... | |
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. More... | |
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. More... | |
void * | app_usbd_core_setup_transfer_buff_get (size_t *p_size) |
Set up a data transfer buffer. More... | |
app_usbd_state_t | app_usbd_core_state_get (void) |
Return internal USBD core state. More... | |
bool | app_usbd_core_feature_state_get (app_usbd_setup_stdfeature_t feature) |
Check current feature state. More... | |
nRF52840 only: Core module that manages current USB state and process device requests.
#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.
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.
p_contex | Context variable configured with the transmission request. |
enum app_usbd_state_t |
USB Device state.
Possible USB Device states according to specification.
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.
feature | Feature to check. Only features related to the device should be checked by this function. |
true | Selected feature is set |
false | Selected feature is cleared |
|
inlinestatic |
Access to core instance.
Function that returns pointer to the USBD 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.
ep | Endpoint number (only IN0 and OUT0) are supported. |
p_handler_desc | Descriptor of the handler to be called. |
NRF_SUCCESS | Successfully configured |
NRF_ERROR_INVALID_ADDR | Last received setup direction does not match configured endpoint. |
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.
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.
app_usbd_state_t app_usbd_core_state_get | ( | void | ) |
Return internal USBD core state.