Main functions for USB Device vendor example.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
Functions | |
int | main (void) |
Main function. Execution starts here. More... | |
void | main_resume_action (void) |
Turn on a led to notify active mode Called when the USB line is resumed from the suspend state. More... | |
bool | main_setup_in_received (void) |
Manage the reception of setup request IN. More... | |
bool | main_setup_out_received (void) |
Manage the reception of setup request OUT. More... | |
void | main_sof_action (void) |
Manages the leds behaviors Called when a start of frame is received on USB line each 1ms. More... | |
void | main_suspend_action (void) |
Enters the application in low power mode Callback called when USB host sets USB line in suspend state. More... | |
void | main_vendor_bulk_in_received (udd_ep_status_t status, iram_size_t nb_transfered, udd_ep_id_t ep) |
void | main_vendor_bulk_out_received (udd_ep_status_t status, iram_size_t nb_transfered, udd_ep_id_t ep) |
void | main_vendor_disable (void) |
Notify via user interface that enumeration is disabled This is called by vendor interface when USB Host disable it. More... | |
bool | main_vendor_enable (void) |
Notify via user interface that enumeration is ok This is called by vendor interface when USB Host enable it. More... | |
void | main_vendor_int_in_received (udd_ep_status_t status, iram_size_t nb_transfered, udd_ep_id_t ep) |
void | main_vendor_int_out_received (udd_ep_status_t status, iram_size_t nb_transfered, udd_ep_id_t ep) |
void | main_vendor_iso_in_received (udd_ep_status_t status, iram_size_t nb_transfered, udd_ep_id_t ep) |
void | main_vendor_iso_out_received (udd_ep_status_t status, iram_size_t nb_transfered, udd_ep_id_t ep) |
Variables | |
static volatile bool | main_b_vendor_enable = false |
Buffer for loopback | |
#define | MAIN_LOOPBACK_SIZE 1024 |
Size of buffer used for the loopback. More... | |
static COMPILER_WORD_ALIGNED uint8_t | main_buf_loopback [MAIN_LOOPBACK_SIZE] |
static uint8_t | main_buf_iso_sel |
#define MAIN_LOOPBACK_SIZE 1024 |
Size of buffer used for the loopback.
int main | ( | void | ) |
Main function. Execution starts here.
References board_init(), cpu_irq_enable, irq_initialize_vectors, sleepmgr_enter_sleep(), sleepmgr_init(), system_init(), udc_start(), and ui_init().
void main_resume_action | ( | void | ) |
Turn on a led to notify active mode Called when the USB line is resumed from the suspend state.
References ui_wakeup().
bool main_setup_in_received | ( | void | ) |
Manage the reception of setup request IN.
true | if request accepted |
References main_buf_loopback, min, udd_ctrl_request_t::payload, udd_ctrl_request_t::payload_size, udd_ctrl_request_t::req, udd_g_ctrlreq, ui_loop_back_state(), and usb_setup_req_t::wLength.
bool main_setup_out_received | ( | void | ) |
Manage the reception of setup request OUT.
true | if request accepted |
References main_buf_loopback, min, udd_ctrl_request_t::payload, udd_ctrl_request_t::payload_size, udd_ctrl_request_t::req, udd_g_ctrlreq, ui_loop_back_state(), and usb_setup_req_t::wLength.
void main_sof_action | ( | void | ) |
Manages the leds behaviors Called when a start of frame is received on USB line each 1ms.
References main_b_vendor_enable, udd_get_frame_number(), and ui_process().
void main_suspend_action | ( | void | ) |
Enters the application in low power mode Callback called when USB host sets USB line in suspend state.
References ui_powerdown().
void main_vendor_bulk_in_received | ( | udd_ep_status_t | status, |
iram_size_t | nb_transfered, | ||
udd_ep_id_t | ep | ||
) |
References main_buf_loopback, main_vendor_bulk_out_received(), UDD_EP_TRANSFER_OK, udi_vendor_bulk_out_run(), ui_loop_back_state(), and UNUSED.
Referenced by main_vendor_bulk_out_received(), and main_vendor_enable().
void main_vendor_bulk_out_received | ( | udd_ep_status_t | status, |
iram_size_t | nb_transfered, | ||
udd_ep_id_t | ep | ||
) |
References main_buf_loopback, main_vendor_bulk_in_received(), UDD_EP_TRANSFER_OK, udi_vendor_bulk_in_run(), ui_loop_back_state(), and UNUSED.
Referenced by main_vendor_bulk_in_received().
void main_vendor_disable | ( | void | ) |
Notify via user interface that enumeration is disabled This is called by vendor interface when USB Host disable it.
References main_b_vendor_enable.
bool main_vendor_enable | ( | void | ) |
Notify via user interface that enumeration is ok This is called by vendor interface when USB Host enable it.
true | if vendor startup is successfully done |
References main_b_vendor_enable, main_buf_iso_sel, main_vendor_bulk_in_received(), main_vendor_int_in_received(), main_vendor_iso_out_received(), and UDD_EP_TRANSFER_OK.
void main_vendor_int_in_received | ( | udd_ep_status_t | status, |
iram_size_t | nb_transfered, | ||
udd_ep_id_t | ep | ||
) |
References main_buf_loopback, main_vendor_int_out_received(), UDD_EP_TRANSFER_OK, udi_vendor_interrupt_out_run(), ui_loop_back_state(), and UNUSED.
Referenced by main_vendor_enable(), and main_vendor_int_out_received().
void main_vendor_int_out_received | ( | udd_ep_status_t | status, |
iram_size_t | nb_transfered, | ||
udd_ep_id_t | ep | ||
) |
References main_buf_loopback, main_vendor_int_in_received(), UDD_EP_TRANSFER_OK, udi_vendor_interrupt_in_run(), ui_loop_back_state(), and UNUSED.
Referenced by main_vendor_int_in_received().
void main_vendor_iso_in_received | ( | udd_ep_status_t | status, |
iram_size_t | nb_transfered, | ||
udd_ep_id_t | ep | ||
) |
void main_vendor_iso_out_received | ( | udd_ep_status_t | status, |
iram_size_t | nb_transfered, | ||
udd_ep_id_t | ep | ||
) |
Referenced by main_vendor_enable().
Referenced by main_sof_action(), main_vendor_disable(), and main_vendor_enable().
|
static |
Referenced by main_vendor_enable().
|
static |