diff options
| author | sakumisu <[email protected]> | 2025-01-22 17:46:10 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2025-01-22 17:54:54 +0800 |
| commit | c399be3ea2af9438b28ba32ed7549b8b7020b47d (patch) | |
| tree | 3bd5a0a2bd14f6551393c5db3f57d7a14eba9645 | |
| parent | 1aa2d038aacaf69d8d216007edef736db9f86e85 (diff) | |
feat(common): add usb_phyaddr2ramaddr & usb_ramaddr2phyaddr macro
Signed-off-by: sakumisu <[email protected]>
| -rw-r--r-- | cherryusb_config_template.h | 8 | ||||
| -rw-r--r-- | common/usb_util.h | 8 | ||||
| -rw-r--r-- | port/ehci/usb_hc_ehci.c | 2 |
3 files changed, 17 insertions, 1 deletions
diff --git a/cherryusb_config_template.h b/cherryusb_config_template.h index 395f9016..3a38e994 100644 --- a/cherryusb_config_template.h +++ b/cherryusb_config_template.h @@ -292,4 +292,12 @@ // #define usb_dcache_flush(addr, size) #endif +#ifndef usb_phyaddr2ramaddr +#define usb_phyaddr2ramaddr(addr) (addr) +#endif + +#ifndef usb_ramaddr2phyaddr +#define usb_ramaddr2phyaddr(addr) (addr) +#endif + #endif diff --git a/common/usb_util.h b/common/usb_util.h index 624cd9fc..b2223b2b 100644 --- a/common/usb_util.h +++ b/common/usb_util.h @@ -207,4 +207,12 @@ #define USB_ALIGN_UP(size, align) (((size) + (align)-1) & ~((align)-1)) +#ifndef usb_phyaddr2ramaddr +#define usb_phyaddr2ramaddr(addr) (addr) +#endif + +#ifndef usb_ramaddr2phyaddr +#define usb_ramaddr2phyaddr(addr) (addr) +#endif + #endif /* USB_UTIL_H */ diff --git a/port/ehci/usb_hc_ehci.c b/port/ehci/usb_hc_ehci.c index 2269746a..b40d60d5 100644 --- a/port/ehci/usb_hc_ehci.c +++ b/port/ehci/usb_hc_ehci.c @@ -281,7 +281,7 @@ static void ehci_qtd_fill(struct ehci_qtd_hw *qtd, uint32_t bufaddr, size_t bufl qtd->hw.token = token; - ehci_qtd_bpl_fill(qtd, bufaddr, buflen); + ehci_qtd_bpl_fill(qtd, usb_phyaddr2ramaddr(bufaddr), buflen); qtd->dir_in = ((token & QTD_TOKEN_PID_MASK) == QTD_TOKEN_PID_IN) ? true : false; qtd->bufaddr = bufaddr; qtd->length = buflen; |
