Merge pull request #3320 from Cacodemon345/usb-work

usb: Implement HCCA reads and writes
This commit is contained in:
Miran Grča
2023-05-07 12:57:38 +02:00
committed by GitHub
2 changed files with 7 additions and 2 deletions

View File

@@ -58,6 +58,7 @@ typedef struct usb_t
} usb_t;
#pragma pack(push, 1)
/* Base USB descriptor struct. */
typedef struct
{
@@ -76,6 +77,7 @@ typedef struct
uint8_t bmAttributes;
uint8_t bMaxPower;
} usb_desc_conf_t;
#pragma pack(pop)
typedef struct
@@ -84,9 +86,7 @@ typedef struct
uint16_t HccaFrameNumber;
uint16_t HccaPad1;
uint32_t HccaDoneHead;
uint32_t Reserved[29];
} usb_hcca_t;
/* USB endpoint device struct. Incomplete and unused. */
typedef struct
{

View File

@@ -300,8 +300,13 @@ ohci_set_interrupt(usb_t *dev, uint8_t bit)
void
ohci_end_of_frame(usb_t* dev)
{
usb_hcca_t hcca;
/* TODO: Put endpoint and transfer descriptor processing here. */
dma_bm_read(dev->ohci_mmio[OHCI_HcHCCA].l, (uint8_t*)&hcca, sizeof(usb_hcca_t), 4);
dev->ohci_mmio[OHCI_HcFmNumber].w[0]++;
dma_bm_write(dev->ohci_mmio[OHCI_HcHCCA].l, (uint8_t*)&hcca, sizeof(usb_hcca_t), 4);
}
void