LibXenon
Bare-metal Xbox 360 homebrew library
Loading...
Searching...
No Matches
Macros | Functions | Variables
ohci.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <stdint.h>
#include "usbhack.h"
#include "lib_malloc.h"
#include "lib_queue.h"
#include "usbchap9.h"
#include "usbd.h"
#include "ohci.h"
Include dependency graph for ohci.c:

Go to the source code of this file.

Macros

#define CPUCFG_COHERENT_DMA   1 /* hack runs on a PC, PCs are coherent */
 
#define ENDIAN_BIG   0
 
#define ENDIAN_LITTLE   1 /* hack runs on PC, PCs are little endian */
 
#define BSWAP32(x)   (x)
 
#define OHCI_VTOP(ptr)   vtop(ptr)
 
#define OHCI_PTOV(ptr)   ptov(ptr)
 
#define OHCI_VTOD(ptr)   OHCI_VTOP(ptr)
 
#define OHCI_DTOV(ptr)   OHCI_PTOV(ptr)
 
#define OHCI_WRITECSR(softc, x, y)    *((volatile uint32_t *) ((softc)->ohci_regs + ((x)/sizeof(uint32_t)))) = (y)
 
#define OHCI_READCSR(softc, x)    *((volatile uint32_t *) ((softc)->ohci_regs + ((x)/sizeof(uint32_t))))
 
#define OHCI_INVAL_RANGE(s, l)   memdcbf(s,l)
 
#define OHCI_FLUSH_RANGE(s, l)   memdcbst(s,l)
 
#define OHCIDEBUG(x)
 
#define ohci_td_from_transfer(softc, transfer)    ((softc)->ohci_hwtdpool + ((transfer) - (softc)->ohci_transfer_pool))
 
#define ohci_transfer_from_td(softc, td)    ((softc)->ohci_transfer_pool + ((td) - (softc)->ohci_hwtdpool))
 
#define ohci_ed_from_endpoint(softc, endpoint)    ((softc)->ohci_hwedpool + ((endpoint) - (softc)->ohci_endpoint_pool))
 
#define ohci_endpoint_from_ed(softc, ed)    ((softc)->ohci_endpoint_pool + ((ed) - (softc)->ohci_hwedpool))
 
#define CACHE_ALIGN   32 /* XXX place holder, big enough to now. */
 
#define ALIGN(n, align)   (((n)+((align)-1)) & ~((align)-1))
 

Functions

uint32_t vtop (void *ptr)
 
void * ptov (uint32_t x)
 
void ohci_dumprhstat (uint32_t reg)
 
void ohci_dumpportstat (int idx, uint32_t reg)
 
void ohci_dumptd (ohci_softc_t *, ohci_td_t *td)
 
void ohci_dumptdchain (ohci_softc_t *, ohci_td_t *td)
 
void ohci_dumped (ohci_softc_t *, ohci_ed_t *ed)
 
void ohci_dumpedchain (ohci_softc_t *, ohci_ed_t *ed)
 
void ohci_dumpdoneq (ohci_softc_t *softc)
 

Variables

usb_hcdrv_t ohci_driver
 
int ohcidebug = 0
 

Macro Definition Documentation

◆ ALIGN

#define ALIGN (   n,
  align 
)    (((n)+((align)-1)) & ~((align)-1))

Definition at line 521 of file ohci.c.

◆ BSWAP32

#define BSWAP32 (   x)    (x)

Definition at line 84 of file ohci.c.

◆ CACHE_ALIGN

#define CACHE_ALIGN   32 /* XXX place holder, big enough to now. */

Definition at line 520 of file ohci.c.

◆ CPUCFG_COHERENT_DMA

#define CPUCFG_COHERENT_DMA   1 /* hack runs on a PC, PCs are coherent */

Definition at line 55 of file ohci.c.

◆ ENDIAN_BIG

#define ENDIAN_BIG   0

Definition at line 56 of file ohci.c.

◆ ENDIAN_LITTLE

#define ENDIAN_LITTLE   1 /* hack runs on PC, PCs are little endian */

Definition at line 57 of file ohci.c.

◆ OHCI_DTOV

#define OHCI_DTOV (   ptr)    OHCI_PTOV(ptr)

Definition at line 93 of file ohci.c.

◆ ohci_ed_from_endpoint

#define ohci_ed_from_endpoint (   softc,
  endpoint 
)     ((softc)->ohci_hwedpool + ((endpoint) - (softc)->ohci_endpoint_pool))

Definition at line 180 of file ohci.c.

◆ ohci_endpoint_from_ed

#define ohci_endpoint_from_ed (   softc,
  ed 
)     ((softc)->ohci_endpoint_pool + ((ed) - (softc)->ohci_hwedpool))

Definition at line 183 of file ohci.c.

◆ OHCI_FLUSH_RANGE

#define OHCI_FLUSH_RANGE (   s,
 
)    memdcbst(s,l)

Definition at line 130 of file ohci.c.

◆ OHCI_INVAL_RANGE

#define OHCI_INVAL_RANGE (   s,
 
)    memdcbf(s,l)

Definition at line 129 of file ohci.c.

◆ OHCI_PTOV

#define OHCI_PTOV (   ptr)    ptov(ptr)

Definition at line 91 of file ohci.c.

◆ OHCI_READCSR

#define OHCI_READCSR (   softc,
 
)     *((volatile uint32_t *) ((softc)->ohci_regs + ((x)/sizeof(uint32_t))))

Definition at line 96 of file ohci.c.

◆ ohci_td_from_transfer

#define ohci_td_from_transfer (   softc,
  transfer 
)     ((softc)->ohci_hwtdpool + ((transfer) - (softc)->ohci_transfer_pool))

Definition at line 174 of file ohci.c.

◆ ohci_transfer_from_td

#define ohci_transfer_from_td (   softc,
  td 
)     ((softc)->ohci_transfer_pool + ((td) - (softc)->ohci_hwtdpool))

Definition at line 177 of file ohci.c.

◆ OHCI_VTOD

#define OHCI_VTOD (   ptr)    OHCI_VTOP(ptr)

Definition at line 92 of file ohci.c.

◆ OHCI_VTOP

#define OHCI_VTOP (   ptr)    vtop(ptr)

Definition at line 90 of file ohci.c.

◆ OHCI_WRITECSR

#define OHCI_WRITECSR (   softc,
  x,
 
)     *((volatile uint32_t *) ((softc)->ohci_regs + ((x)/sizeof(uint32_t)))) = (y)

Definition at line 94 of file ohci.c.

◆ OHCIDEBUG

#define OHCIDEBUG (   x)

Definition at line 141 of file ohci.c.

Function Documentation

◆ ohci_dumpdoneq()

void ohci_dumpdoneq ( ohci_softc_t softc)

◆ ohci_dumped()

void ohci_dumped ( ohci_softc_t ,
ohci_ed_t ed 
)

◆ ohci_dumpedchain()

void ohci_dumpedchain ( ohci_softc_t ,
ohci_ed_t ed 
)

◆ ohci_dumpportstat()

void ohci_dumpportstat ( int  idx,
uint32_t  reg 
)

◆ ohci_dumprhstat()

void ohci_dumprhstat ( uint32_t  reg)

◆ ohci_dumptd()

void ohci_dumptd ( ohci_softc_t ,
ohci_td_t td 
)

◆ ohci_dumptdchain()

void ohci_dumptdchain ( ohci_softc_t ,
ohci_td_t td 
)

◆ ptov()

void * ptov ( uint32_t  x)

Definition at line 197 of file usbhack.c.

◆ vtop()

uint32_t vtop ( void *  ptr)

Definition at line 171 of file usbhack.c.

Variable Documentation

◆ ohci_driver

usb_hcdrv_t ohci_driver
Initial value:
= {
ohci_create,
ohci_delete,
ohci_start,
ohci_stop,
ohci_intr,
ohci_ept_create,
ohci_ept_delete,
ohci_ept_setmps,
ohci_ept_setaddr,
ohci_ept_cleartoggle,
ohci_xfer
}

Definition at line 1717 of file ohci.c.

◆ ohcidebug

int ohcidebug = 0

Definition at line 199 of file ohci.c.