Enable each USB interface independently depending on PHY parameters.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2025-03-22 23:25:31 +01:00
parent 4ef641b8d3
commit a08abaed0f
6 changed files with 59 additions and 52 deletions

View File

@@ -122,6 +122,9 @@ uint8_t sc_itf_to_usb_itf(uint8_t itf) {
}
void ccid_init_buffers() {
if (ITF_SC_TOTAL == 0) {
return;
}
if (ccid_rx == NULL) {
ccid_rx = (usb_buffer_t *)calloc(ITF_SC_TOTAL, sizeof(usb_buffer_t));
}
@@ -170,11 +173,6 @@ void tud_vendor_rx_cb(uint8_t itf, const uint8_t *buffer, uint16_t bufsize) {
} while (len > 0);
}
void tud_vendor_tx_cb(uint8_t itf, uint32_t sent_bytes) {
(void) sent_bytes;
tud_vendor_n_write_flush(itf);
}
int driver_write_ccid(uint8_t itf, const uint8_t *tx_buffer, uint16_t buffer_size) {
if (*tx_buffer != 0x81) {
DEBUG_PAYLOAD(tx_buffer, buffer_size);
@@ -346,16 +344,17 @@ void ccid_task() {
}
}
#ifndef ENABLE_EMULATION
#define USB_CONFIG_ATT_ONE TU_BIT(7)
#define MAX_USB_POWER 1
void ccid_init() {
ccid_init_buffers();
}
#ifndef ENABLE_EMULATION
void tud_vendor_tx_cb(uint8_t itf, uint32_t sent_bytes) {
(void) sent_bytes;
tud_vendor_n_write_flush(itf);
}
static void ccid_init_cb(void) {
vendord_init();
}