Skip to content

Commit

Permalink
feat(common): add usb_phyaddr2ramaddr & usb_ramaddr2phyaddr macro
Browse files Browse the repository at this point in the history
Signed-off-by: sakumisu <[email protected]>
  • Loading branch information
sakumisu committed Jan 22, 2025
1 parent 1aa2d03 commit 333522d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions common/usb_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
2 changes: 1 addition & 1 deletion port/ehci/usb_hc_ehci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 333522d

Please sign in to comment.