LibXenon
Bare-metal Xbox 360 homebrew library
Loading...
Searching...
No Matches
ehci-mem.c
Go to the documentation of this file.
1/*
2 * Original Copyright (c) 2001 by David Brownell
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19/* this file is part of ehci.c */
20
21
22static inline void ehci_qtd_init(struct ehci_qtd *qtd
23 )
24{
26 memset (qtd, 0, sizeof *qtd);
27 qtd->qtd_dma = dma;
28 qtd->hw_token = (QTD_STS_HALT);
29 qtd->hw_next = EHCI_LIST_END();
31}
32static inline struct ehci_qtd * ehci_qtd_alloc(struct ehci_hcd * ehci)
33{
34 struct ehci_qtd *qtd ;
35 //debug_printf("ehci_qtd used=%x\n",ehci->qtd_used);
36 if(ehci->qtd_used>=EHCI_MAX_QTD) return NULL;
37 qtd = ehci->qtds[ehci->qtd_used++];
38 ehci_qtd_init(qtd);
39 return qtd;
40}
41
43{
44 int i;
45#if 1
46 ehci->periodic = ehci_maligned(DEFAULT_I_TDPS * sizeof(__le32),32,4096);
48
49 for (i = 0; i < DEFAULT_I_TDPS; i++)
52#else
53 debug_printf("ehci periodic:%x\n",ehci_readl(ehci, &ehci->regs->frame_list));
54 debug_printf("ehci *periodic:%x\n",*(u32*)ehci_readl(ehci, &ehci->regs->frame_list));
55#endif
56 for(i=0;i<EHCI_MAX_QTD;i++)
57 ehci->qtds[i] = ehci_maligned(sizeof(struct ehci_qtd),32,4096);
58 ehci->qtd_used = 0;
59 ehci->asyncqh = ehci_maligned(sizeof(struct ehci_qh),32,4096);
63
64 ehci->async = ehci_maligned(sizeof(struct ehci_qh),32,4096);
65 ehci->async->ehci = ehci;
68
69 return 0;
70}
#define NULL
Definition: def.h:47
int ehci_mem_init(struct ehci_hcd *ehci)
Definition: ehci-mem.c:42
#define QTD_STS_HALT
Definition: ehci.h:10
#define EHCI_LIST_END()
Definition: ehci.h:179
#define EHCI_MAX_QTD
Definition: ehci.h:46
#define DEFAULT_I_TDPS
Definition: ehci.h:94
void * ehci_maligned(int size, int alignement, int crossing)
Definition: usb_os.c:41
struct ehci_hcd * ehci
Definition: ehci.h:23
dma_addr_t ehci_virt_to_dma(void *)
Definition: usb_os.c:67
#define __le32
Definition: ehci_types.h:11
#define dma_addr_t
Definition: ehci_types.h:12
Definition: ehci.h:75
dma_addr_t periodic_dma
Definition: ehci.h:96
struct ehci_qh * asyncqh
Definition: ehci.h:86
struct ehci_qtd * qtds[EHCI_MAX_QTD]
Definition: ehci.h:88
__hc32 * periodic
Definition: ehci.h:95
struct ehci_regs __iomem * regs
Definition: ehci.h:79
struct ehci_qh * async
Definition: ehci.h:85
int qtd_used
Definition: ehci.h:89
Definition: ehci.h:208
dma_addr_t qh_dma
Definition: ehci.h:229
struct ehci_qtd * qtd_head
Definition: ehci.h:230
struct ehci_hcd * ehci
Definition: ehci.h:232
Definition: ehci.h:119
__hc32 hw_token
Definition: ehci.h:123
__hc32 hw_alt_next
Definition: ehci.h:122
__hc32 hw_next
Definition: ehci.h:121
dma_addr_t qtd_dma
Definition: ehci.h:146
u32 frame_list
Definition: ehci_defs.h:91
#define ehci_writel(v, a)
Definition: tinyehci.c:60
#define debug_printf(a...)
Definition: tinyehci.c:44
#define ehci_readl(a)
Definition: tinyehci.c:59
uint32_t u32
32bit unsigned integer
Definition: xetypes.h:14