summaryrefslogtreecommitdiff
path: root/src/portable/ohci/ohci.h
AgeCommit message (Collapse)Author
2026-07-02license: use SPDX identifiers for src/ headers (#3749)Ha Thach
* license: use SPDX identifiers for src/ headers Replace the full ~20-line MIT license boilerplate on every src/ file with a two-line SPDX tag (SPDX-FileCopyrightText + SPDX-License-Identifier), following the REUSE convention used by CircuitPython and the Linux kernel. Removes ~3500 lines of duplicated boilerplate.
2025-10-31Merge branch 'master' into fork/ArcaneNibble/ohci-upstreamhathach
2025-10-30Merge branch 'master' into add-ohci-lpc55hathach
# Conflicts: - hw/bsp/lpc17/family.cmake - hw/bsp/lpc40/family.cmake - hw/bsp/lpc55/family.cmake
2025-10-28fix Identifiers that start with '__' or '_[A-Z]' are reserved.hathach
fix compiling with nuc family
2025-10-10try to enable ohci for lpc55 but not working, probably clock issuehathach
2025-10-09fix todo size in list_reverse()hathach
2025-10-09centralize hcd_dcache_uncached() for EDhathach
2025-09-13ohci: Use uncached alias to access EDsR
This code is written very carefully to always use an uncached view of memory to read/write EDs. An uncached view must *always* be used, or else cache behavior can corrupt the ED. As part of this change, combine access into as few word-sized accesses as possible. This makes the code perform better. Doing this involves giving type names to the bitfields that make up the ED's data words.
2025-09-13ohci: Re-implement TD allocation, matching the specificationR
The initial motivation for doing this is to remove the `used` flag in the TD. If we use this flag, we end up being required to read from TDs that the OHCI controller might be modifying (i.e. the OHCI controller logically owns the TD). This happens when we try to allocate a new, empty TD while the OHCI host controller is working on a transfer. Move the `used` flag to `gtd_extra_data_t`. This data is only used by the CPU, and the OHCI controller never accesses it. The existing allocation method for TDs does *not* put an empty TD onto each ED (i.e it does *not* do what is shown in Figure 5-6 of the OHCI specification). Instead, the NextTD field of the last TD is set to 0. The TailP field of the ED is also set to 0. This works in many cases. However, this implementation means that the CPU may end up trying to write to the NextTD field of an in-progress transfer while the OHCI host controller logically owns it. Change the implementation to use an empty TD, as suggested by the specification, for endpoints other than EP0. This avoids the above issue. It is not necessary to make the change for EP0 because only at most one TD can ever be pending at a time. The above change should also remove the need for the stall workaround. In the future, we want to modify the code to access EDs through an uncached mapping. Because uncached mappings are slow, we want to access EDs as little as possible. Currently, when a TD completes, we access an ED in order to figure out the device address and endpoint number of the TD which was completed. Because moving `used` to `gtd_extra_data_t` necessitates expanding it, we have enough room to also store the device address and endpoint number of the TD. This patch does so. With the above two changes, we no longer need to access an ED when a TD completes. Also remove the `index` field from TDs as it is no longer necessary.
2025-09-12ohci: Align TDs to cache linesR
2024-02-19fix wrong volatile usage in ohci gtdHa Thach
2024-01-11move gtd extra out of control struct to save sramhathach
also rename gtd_data to gtd_extra
2024-01-10[OHCI] Allow more than 16 devicesRyzee119
2023-02-22move and add optional tusb_app_virt_to_phys/tusb_app_phys_to_virthathach
also add place holder for tusb_app_dcache_flush() and tusb_app_dcache_invalidate()
2023-02-22rename OHCI_RHPORTS to TUP_OHCI_RHPORTShathach
2023-02-18ohci: Support configurable number of roothub portsRyzee119
2023-02-18ohci: Expand roothub descriptors into unionsRyzee119
2022-12-04Fix typosBastien Nocera
2022-03-04fix naming, and buildhathach
2022-03-04correct qhd and qtd count for ehci/ohcihathach
2022-03-04rename HCD_MAX_XFER to CFG_TUH_ENDPOINT_MAXhathach
minor clean up
2022-01-28OHCI: Fix array out of bounds issueRyzee119
If using a USB hub, a request outside the array size can occur Original line: https://github.com/hathach/tinyusb/blob/ffb257ac17f162bc5a4c26596d7a1e954db98aa5/src/portable/ohci/ohci.h#L162 It can happen in a few places but one such example is here: https://github.com/hathach/tinyusb/blob/ffb257ac17f162bc5a4c26596d7a1e954db98aa5/src/portable/ohci/ohci.c#L460 ie. if HUB address is 5, this would be an array index out of bounds on control endpoints as `CFG_TUH_DEVICE_MAX+1` is only 5. This fix just includes num of hubs in the reserve array size. Fixing locally fixed this issue.
2021-08-23rename CFG_TUSB_HOST_DEVICE_MAX to CFG_TUH_DEVICE_MAXhathach
2021-05-31correct ohci endpoint address in xfer completehathach
2021-02-23move ehci and ohci to portable folderhathach