Skip to content

Commit c399be3

Browse files
committed
feat(common): add usb_phyaddr2ramaddr & usb_ramaddr2phyaddr macro
Signed-off-by: sakumisu <1203593632@qq.com>
1 parent 1aa2d03 commit c399be3

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

cherryusb_config_template.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,4 +292,12 @@
292292
// #define usb_dcache_flush(addr, size)
293293
#endif
294294

295+
#ifndef usb_phyaddr2ramaddr
296+
#define usb_phyaddr2ramaddr(addr) (addr)
297+
#endif
298+
299+
#ifndef usb_ramaddr2phyaddr
300+
#define usb_ramaddr2phyaddr(addr) (addr)
301+
#endif
302+
295303
#endif

common/usb_util.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,4 +207,12 @@
207207

208208
#define USB_ALIGN_UP(size, align) (((size) + (align)-1) & ~((align)-1))
209209

210+
#ifndef usb_phyaddr2ramaddr
211+
#define usb_phyaddr2ramaddr(addr) (addr)
212+
#endif
213+
214+
#ifndef usb_ramaddr2phyaddr
215+
#define usb_ramaddr2phyaddr(addr) (addr)
216+
#endif
217+
210218
#endif /* USB_UTIL_H */

port/ehci/usb_hc_ehci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ static void ehci_qtd_fill(struct ehci_qtd_hw *qtd, uint32_t bufaddr, size_t bufl
281281

282282
qtd->hw.token = token;
283283

284-
ehci_qtd_bpl_fill(qtd, bufaddr, buflen);
284+
ehci_qtd_bpl_fill(qtd, usb_phyaddr2ramaddr(bufaddr), buflen);
285285
qtd->dir_in = ((token & QTD_TOKEN_PID_MASK) == QTD_TOKEN_PID_IN) ? true : false;
286286
qtd->bufaddr = bufaddr;
287287
qtd->length = buflen;

0 commit comments

Comments
 (0)