Skip to content

Commit

Permalink
Merge pull request #2239 from XelaRellum/bugfix_stm32_fsdev_keil
Browse files Browse the repository at this point in the history
Fixes #1018 the weak dcd_edpt0_status_complete for Keil Compiler
  • Loading branch information
hathach committed Jan 12, 2024
2 parents 71ce4b8 + 9665843 commit 8580774
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/device/dcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ void dcd_sof_enable(uint8_t rhport, bool en);

// Invoked when a control transfer's status stage is complete.
// May help DCD to prepare for next control transfer, this API is optional.
void dcd_edpt0_status_complete(uint8_t rhport, tusb_control_request_t const * request) TU_ATTR_WEAK;
void dcd_edpt0_status_complete(uint8_t rhport, tusb_control_request_t const * request);

// Configure endpoint's registers according to descriptor
bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * desc_ep);
Expand Down
11 changes: 10 additions & 1 deletion src/device/usbd_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ bool tud_control_xfer(uint8_t rhport, tusb_control_request_t const * request, vo
// USBD API
//--------------------------------------------------------------------+

TU_ATTR_WEAK void dcd_edpt0_status_complete(uint8_t rhport, tusb_control_request_t const * request)
{
(void)rhport;
(void)request;

// this is the default implementation that is called when no "real" implementation
// of the function exists
}

void usbd_control_reset(void);
void usbd_control_set_request(tusb_control_request_t const *request);
void usbd_control_set_complete_callback( usbd_control_xfer_cb_t fp );
Expand Down Expand Up @@ -173,7 +182,7 @@ bool usbd_control_xfer_cb (uint8_t rhport, uint8_t ep_addr, xfer_result_t result
TU_ASSERT(0 == xferred_bytes);

// invoke optional dcd hook if available
if (dcd_edpt0_status_complete) dcd_edpt0_status_complete(rhport, &_ctrl_xfer.request);
dcd_edpt0_status_complete(rhport, &_ctrl_xfer.request);

if (_ctrl_xfer.complete_cb)
{
Expand Down

0 comments on commit 8580774

Please sign in to comment.