Revise per initial comments

Returns the RT driver to the function state of previous iteration, which
did not support the will_detach.  Behavior should be fine without this
feature.  This removes much of the added bloat to track state, and
handle requests in the APP_DETACH state which is no longer required.

Removes the optional bloat added to the RT driver, such as responding to
GETSTATE requests.

Fixes the DFU Mode to extract the attr bits from the functional
descriptor when opened.

Fixes some incorrect bitwise if checks.

Also, updates some naming of functions to be consistent with the rest of
the library.
This commit is contained in:
Jeremiah McCarthy
2021-04-07 17:05:04 -04:00
parent c39b7b8177
commit 2e2dc7bdc5
9 changed files with 55 additions and 147 deletions

View File

@@ -38,44 +38,9 @@
//--------------------------------------------------------------------+
// Application Callback API (weak is optional)
//--------------------------------------------------------------------+
// Allow the application to update the status as required.
// Is set to DFU_STATUS_OK during internal initialization and USB reset
// Value is not checked to allow for custom statuses to be used
void tud_dfu_runtime_set_status(dfu_mode_device_status_t status);
// Invoked when a DFU_DETACH request is received and bitWillDetach is set
void tud_dfu_runtime_reboot_to_dfu_cb();
// Invoked when a DFU_DETACH request is received and bitWillDetach is not set
// This should start a timer for wTimeout ms
// When the timer has elapsed, the app must call tud_dfu_runtime_detach_timer_elapsed
// If a USB reset is called while the timer is running, the class will call
// tud_dfu_runtime_reboot_to_dfu_cb.
// NOTE: This callback should return immediately, and not implement the delay
// internally, as this can will hold up the USB stack
TU_ATTR_WEAK void tud_dfu_runtime_detach_start_timer_cb(uint16_t wTimeout);
// Invoke when the dfu runtime detach timer has elapsed
void tud_dfu_runtime_detach_timer_elapsed();
// Invoked when a nonstandard request is received
// Use may be vendor specific.
// Return false to stall
TU_ATTR_WEAK bool tud_dfu_runtime_req_nonstandard_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request);
// Invoked during initialization of the dfu driver to set attributes
// Return byte set with bitmasks:
// DFU_FUNC_ATTR_CAN_DOWNLOAD_BITMASK
// DFU_FUNC_ATTR_CAN_UPLOAD_BITMASK
// DFU_FUNC_ATTR_MANIFESTATION_TOLERANT_BITMASK
// DFU_FUNC_ATTR_WILL_DETACH_BITMASK
// Note: This should match the USB descriptor
uint8_t tud_dfu_runtime_init_attrs_cb();
// Invoked during a DFU_GETSTATUS request to get for the string index
// to the status description string table.
TU_ATTR_WEAK uint8_t tud_dfu_runtime_get_status_desc_table_index_cb();
//--------------------------------------------------------------------+
// Internal Class Driver API
//--------------------------------------------------------------------+