XenevaOS
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions | Variables
dwc2_root.cpp File Reference
#include "dwc2.h"
#include "dwc2_reg.h"
#include <Mm/pmmngr.h>
#include <Drivers/uart.h>
#include <string.h>
#include <Hal/AA64/aa64lowlevel.h>
#include <Hal/AA64/aa64cpu.h>
#include <_null.h>
Include dependency graph for dwc2_root.cpp:

Classes

struct  _dev_desc_
 
struct  _string_desc_
 
struct  _interface_desc_
 
struct  _qualifier_desc_
 
struct  _config_desc_
 
struct  _usb_desc_
 
struct  _usb_hub_
 
struct  _usb_ep_desc_
 
struct  usb_port_status_t
 

Macros

#define DESCRIPTOR_TYPE_CONFIG   2
 
#define DESCRIPTOR_TYPE_INTERFACE   4
 
#define DESCRIPTOR_TYPE_ENDPOINT   5
 
#define USB_EP_TYPE_CONTROL   0x00
 
#define USB_EP_TYPE_ISOC   0x01
 
#define USB_EP_TYPE_BULK   0x02
 
#define USB_EP_TYPE_INTERRUPT   0x03
 
#define PORT_STATUS_CONNECTION   (1<<0)
 
#define PORT_CHANGE_CONNECTION   (1<<0)
 
#define PORT_CHANGE_ENABLE   (1<<1)
 
#define PORT_CHANGE_SUSPEND   (1<<2)
 
#define PORT_CHANGE_OVERCURRENT   (1<<3)
 
#define PORT_CHANGE_RESET   (1<<4)
 

Typedefs

typedef struct _dev_desc_ usb_dev_desc_t
 
typedef struct _string_desc_ usb_string_desc_t
 
typedef struct _interface_desc_ usb_if_desc_t
 
typedef struct _qualifier_desc_ usb_qualifier_desc_t
 
typedef struct _config_desc_ usb_config_desc_t
 
typedef struct _usb_desc_ usb_descriptor_t
 
typedef struct _usb_hub_ usb_hub_desc_t
 
typedef struct _usb_ep_desc_ usb_ep_desc_t
 

Functions

usb_descriptor_tdwc2_get_descriptor (void *desc, uint8_t type)
 
void usb_hub_get_port_status (struct dwc2_core_regs *regs, uint8_t port, void *dma, uint8_t address, uint8_t speed)
 
void dwc2_enumerate_root_device (struct dwc2_core_regs *regs)
 
void root_hub_transfer_int (dwc2_core_regs *regs, uint8_t pid)
 
void * root_hub_get_interrupt_buffer ()
 
void root_hub_handle_port_change (dwc2_core_regs *regs, uint8_t port)
 

Variables

void * intb
 
uint8_t port_changed
 

Detailed Description

BSD 2-Clause License

Copyright (c) 2022-2025, Manas Kamal Choudhury All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Macro Definition Documentation

◆ DESCRIPTOR_TYPE_CONFIG

#define DESCRIPTOR_TYPE_CONFIG   2

◆ DESCRIPTOR_TYPE_ENDPOINT

#define DESCRIPTOR_TYPE_ENDPOINT   5

◆ DESCRIPTOR_TYPE_INTERFACE

#define DESCRIPTOR_TYPE_INTERFACE   4

◆ PORT_CHANGE_CONNECTION

#define PORT_CHANGE_CONNECTION   (1<<0)

◆ PORT_CHANGE_ENABLE

#define PORT_CHANGE_ENABLE   (1<<1)

◆ PORT_CHANGE_OVERCURRENT

#define PORT_CHANGE_OVERCURRENT   (1<<3)

◆ PORT_CHANGE_RESET

#define PORT_CHANGE_RESET   (1<<4)

◆ PORT_CHANGE_SUSPEND

#define PORT_CHANGE_SUSPEND   (1<<2)

◆ PORT_STATUS_CONNECTION

#define PORT_STATUS_CONNECTION   (1<<0)

◆ USB_EP_TYPE_BULK

#define USB_EP_TYPE_BULK   0x02

◆ USB_EP_TYPE_CONTROL

#define USB_EP_TYPE_CONTROL   0x00

◆ USB_EP_TYPE_INTERRUPT

#define USB_EP_TYPE_INTERRUPT   0x03

◆ USB_EP_TYPE_ISOC

#define USB_EP_TYPE_ISOC   0x01

Typedef Documentation

◆ usb_config_desc_t

◆ usb_descriptor_t

typedef struct _usb_desc_ usb_descriptor_t

◆ usb_dev_desc_t

typedef struct _dev_desc_ usb_dev_desc_t

◆ usb_ep_desc_t

typedef struct _usb_ep_desc_ usb_ep_desc_t

◆ usb_hub_desc_t

typedef struct _usb_hub_ usb_hub_desc_t

◆ usb_if_desc_t

◆ usb_qualifier_desc_t

◆ usb_string_desc_t

Function Documentation

◆ dwc2_enumerate_root_device()

void dwc2_enumerate_root_device ( struct dwc2_core_regs regs)

dwc2_enumerate_root_device – enumerate the root device

Parameters
regs– pointer to system regs

no strings for root hub, iss iss bom laaj pali no ??

next set address, and configure the hub, because devices are waiting to get powered in

PORT power up

◆ dwc2_get_descriptor()

usb_descriptor_t * dwc2_get_descriptor ( void *  desc,
uint8_t  type 
)

◆ root_hub_get_interrupt_buffer()

void * root_hub_get_interrupt_buffer ( )

◆ root_hub_handle_port_change()

void root_hub_handle_port_change ( dwc2_core_regs regs,
uint8_t  port 
)

◆ root_hub_transfer_int()

void root_hub_transfer_int ( dwc2_core_regs regs,
uint8_t  pid 
)

◆ usb_hub_get_port_status()

void usb_hub_get_port_status ( struct dwc2_core_regs regs,
uint8_t  port,
void *  dma,
uint8_t  address,
uint8_t  speed 
)

Variable Documentation

◆ intb

void* intb

◆ port_changed

uint8_t port_changed