Skip to content

Commit

Permalink
Merge pull request #2543 from IngHK/max3421_nak_retry
Browse files Browse the repository at this point in the history
MAX3421E NAK retry handling next frame
  • Loading branch information
hathach authored Apr 2, 2024
2 parents 82dfe95 + 172c9f7 commit 2265bfe
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 106 deletions.
2 changes: 1 addition & 1 deletion src/host/hcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ bool hcd_dcache_clean_invalidate(void const* addr, uint32_t data_size) TU_ATTR_W
//--------------------------------------------------------------------+

// optional hcd configuration, called by tuh_configure()
bool hcd_configure(uint8_t rhport, uint32_t cfg_id, const void* cfg_param) TU_ATTR_WEAK;
bool hcd_configure(uint8_t rhport, uint32_t cfg_id, const void* cfg_param);

// Initialize controller to host mode
bool hcd_init(uint8_t rhport);
Expand Down
13 changes: 8 additions & 5 deletions src/host/usbh.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ TU_ATTR_WEAK bool hcd_deinit(uint8_t rhport) {
return false;
}

TU_ATTR_WEAK bool hcd_configure(uint8_t rhport, uint32_t cfg_id, const void* cfg_param) {
(void) rhport;
(void) cfg_id;
(void) cfg_param;
return false;
}

TU_ATTR_WEAK void tuh_event_hook_cb(uint8_t rhport, uint32_t eventid, bool in_isr) {
(void) rhport;
(void) eventid;
Expand Down Expand Up @@ -332,11 +339,7 @@ bool tuh_rhport_reset_bus(uint8_t rhport, bool active) {
//--------------------------------------------------------------------+

bool tuh_configure(uint8_t rhport, uint32_t cfg_id, const void *cfg_param) {
if ( hcd_configure ) {
return hcd_configure(rhport, cfg_id, cfg_param);
} else {
return false;
}
return hcd_configure(rhport, cfg_id, cfg_param);
}

static void clear_device(usbh_device_t* dev) {
Expand Down
14 changes: 12 additions & 2 deletions src/host/usbh.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,21 @@ typedef struct {
tusb_desc_interface_t desc;
} tuh_itf_info_t;

// ConfigID for tuh_config()
// ConfigID for tuh_configure()
enum {
TUH_CFGID_RPI_PIO_USB_CONFIGURATION = OPT_MCU_RP2040 << 8 // cfg_param: pio_usb_configuration_t
TUH_CFGID_INVALID = 0,
TUH_CFGID_RPI_PIO_USB_CONFIGURATION = 100, // cfg_param: pio_usb_configuration_t
TUH_CFGID_MAX3421 = 200,
};

typedef union {
// For TUH_CFGID_RPI_PIO_USB_CONFIGURATION use pio_usb_configuration_t

struct {
uint8_t max_nak;
} max3421;
} tuh_configure_param_t;

//--------------------------------------------------------------------+
// APPLICATION CALLBACK
//--------------------------------------------------------------------+
Expand Down
Loading

0 comments on commit 2265bfe

Please sign in to comment.