refactoring ugly typedefs...
[ppcskel.git] / usb / drivers / class / hub.c
1 /*
2  * Copyright (c) 2007, Benedikt Sauter <sauter@ixbat.de>
3  * All rights reserved.
4  *
5  * Short descripton of file:
6  *
7  *
8  * Redistribution and use in source and binary forms, with or without 
9  * modification, are permitted provided that the following conditions 
10  * are met:
11  *
12  *   * Redistributions of source code must retain the above copyright 
13  *     notice, this list of conditions and the following disclaimer.
14  *   * Redistributions in binary form must reproduce the above 
15  *     copyright notice, this list of conditions and the following 
16  *     disclaimer in the documentation and/or other materials provided 
17  *     with the distribution.
18  *   * Neither the name of the FH Augsburg nor the names of its 
19  *     contributors may be used to endorse or promote products derived 
20  *     from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
25  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
26  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
27  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
28  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
29  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
30  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
32  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34
35 //#include <wait.h>
36 //#include <stdlib.h>
37
38 #include "../../core/core.h"
39 #include "../../core/usb.h"
40 #include "../../usbspec/usb11spec.h"
41
42
43 void usb_hub_probe();
44 void usb_hub_check();
45
46
47 struct usb_driver hub = {
48         .name     = "hub",
49         .probe  = usb_hub_probe,
50         .check  = usb_hub_check,
51         .data     = NULL
52 };
53
54 void usb_hub_init()
55 {
56         usb_register_driver(&hub);      
57 }
58
59
60 void usb_hub_probe()
61 {
62         // schaue ob aktuell enumeriertes geraet ein hub ist
63         #if DEBUG
64         core.stdout("Probe: Hub\r\n");
65         #endif
66         wait_ms(1000);
67         
68         struct usb_device *dev = usb_open_class(HUB_CLASSCODE);
69         if(dev != NULL){
70                 hub.data = (void*)dev;          /* save handle */
71                 #if DEBUG
72                 core.stdout("Hub: Found Hub Device\r\n");
73                 #endif 
74          
75                 /* install int in EP */
76
77         }
78
79
80
81 }
82
83
84 void usb_hub_check()
85 {
86         // usb_read_interrupt(handle,1,buf); 
87         // ah neue geraet gefunden
88         // mit request den port geziel reseten, damit device adresse 0 hat
89         // enumeration start
90         // usb_add_device()
91         //
92         //
93         // ah geraet entfernt
94         // usb_remove_device(h1);
95
96 }
97
98
99 u8 usb_hub_get_hub_descriptor(struct usb_device *dev, char * buf)
100 {
101         return 0;  
102 }
103
104 u8 usb_hub_get_hub_status(struct usb_device *dev, char *buf)
105 {
106
107
108         return 0;  
109 }
110
111
112 u8 usb_hub_get_port_status(struct usb_device *dev, char *buf)
113 {
114
115
116         return 0;  
117 }
118
119 u8 usb_hub_clear_port_feature(struct usb_device *dev)
120 {
121
122         return 0;  
123 }
124
125 u8 usb_hub_set_port_feature(struct usb_device *dev, u8 value)
126 {
127
128         return 0;  
129 }
130
131 u8 usb_hub_clear_hub_feature(struct usb_device *dev)
132 {
133
134         return 0;  
135 }
136
137 u8 usb_hub_set_hub_feature(struct usb_device *dev)
138 {
139
140         return 0;  
141 }
142
143 u8 usb_hub_set_hub_descriptor(struct usb_device *dev)
144 {
145
146         return 0;  
147 }
148