5 Copyright (C) 2006 by Michal Schulz
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU Library General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU Library General Public
19 License along with this program; if not, write to the
20 Free Software Foundation, Inc.,
21 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #include <exec/libraries.h>
27 #include <exec/execbase.h>
28 #include <exec/nodes.h>
29 #include <exec/lists.h>
30 #include <exec/semaphores.h>
31 #include <exec/ports.h>
32 #include <exec/interrupts.h>
34 #include <dos/dosextens.h>
36 #include <aros/libcall.h>
37 #include <aros/asmcall.h>
41 #include <aros/arossupportbase.h>
42 #include <exec/execbase.h>
44 #include LC_LIBDEFS_FILE
46 extern OOP_AttrBase HiddAttrBase
;
48 #define BITMAP_SIZE 128
49 #define MAX_HUB_PORTS 256
51 typedef struct usb_driver
{
53 struct SignalSemaphore d_Lock
;
55 uint32_t bitmap
[BITMAP_SIZE
/32];
60 const char * ec_ShortName
;
61 struct Library
*ec_LibBase
;
66 struct SignalSemaphore global_lock
;
69 struct List driverList
;
70 struct SignalSemaphore driverListLock
;
72 struct List extClassList
;
74 struct Process
*usbProcess
;
78 OOP_Class
*deviceClass
;
79 OOP_Class
*driverClass
;
84 usb_endpoint_descriptor_t
*endpoint
;
88 usb_interface_descriptor_t
*interface
;
89 EndpointData
*endpoints
;
100 usb_device_descriptor_t descriptor
;
101 usb_config_descriptor_t
*config_desc
;
102 InterfaceData
*interfaces
;
107 char *manufacturer_name
;
108 char *serialnumber_name
;
111 struct usb_staticdata
*sd
;
114 struct timerequest
*tr
;
120 struct Task
*hub_task
;
121 struct MsgPort
*hub_port
;
122 struct timerequest
*tr
;
123 uint8_t sigInterrupt
;
127 struct usb_staticdata
*sd
;
128 OOP_Object
**children
;
129 usb_hub_descriptor_t descriptor
;
130 uint8_t got_descriptor
;
137 struct Interrupt interrupt
;
142 struct Library LibNode
;
143 struct usb_staticdata sd
;
147 evt_Startup
, // Startup message
148 evt_Cleanup
, // Cleanup message
149 evt_Method
, // Call method attached as ev_Event, put return value into ev_Retval, and reply
150 evt_AsyncMethod
, // Call method attached as ev_Event, destroy original message
151 evt_HubAttached
, // New hub (OOP_Object * in ev_RetVal) attached
156 struct Message ev_Message
;
157 enum EventType ev_Type
;
159 OOP_Object
*ev_Target
;
163 #define METHOD(base, id, name) \
164 base ## __ ## id ## __ ## name (OOP_Class *cl, OOP_Object *o, struct p ## id ## _ ## name *msg)
166 #define BASE(lib)((struct usbbase*)(lib))
167 #define SD(cl) (&BASE(cl->UserData)->sd)
169 void setBitmap(uint32_t *bmp
, uint8_t addr
);
170 void freeBitmap(uint32_t *bmp
, uint8_t addr
);
171 uint8_t allocBitmap(uint32_t *bmp
);