2 Copyright © 2004, The AROS Development Team. All rights reserved.
5 Desc: Stub functions for USB subsystem
14 #include <exec/libraries.h>
15 #include <exec/interrupts.h>
17 #include <utility/tagitem.h>
18 #include <utility/hooks.h>
21 #include <oop/static_mid.h>
23 #include <hidd/hidd.h>
27 #include <proto/oop.h>
30 #define OOPBase (OOP_OOPBASE(obj))
32 BOOL
HIDD_USB_AttachDriver(OOP_Object
*obj
, OOP_Object
*driver
)
35 struct pHidd_USB_AttachDriver p
;
37 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USB
, moHidd_USB_AttachDriver
);
40 p
.driverObject
= driver
;
42 return OOP_DoMethod(obj
, &p
.mID
);
45 BOOL
HIDD_USB_DetachDriver(OOP_Object
*obj
, OOP_Object
*driver
)
48 struct pHidd_USB_DetachDriver p
;
50 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USB
, moHidd_USB_DetachDriver
);
53 p
.driverObject
= driver
;
55 return OOP_DoMethod(obj
, &p
.mID
);
58 void HIDD_USB_AddClass(OOP_Object
*obj
, const char *className
)
61 struct pHidd_USB_AddClass p
;
63 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USB
, moHidd_USB_AddClass
);
66 p
.className
= className
;
68 OOP_DoMethod(obj
, &p
.mID
);
71 uint8_t HIDD_USB_AllocAddress(OOP_Object
*obj
, OOP_Object
*driver
)
74 struct pHidd_USB_AllocAddress p
;
76 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USB
, moHidd_USB_AllocAddress
);
79 p
.driverObject
= driver
;
81 return OOP_DoMethod(obj
, &p
.mID
);
84 void HIDD_USB_FreeAddress(OOP_Object
*obj
, OOP_Object
*driver
, uint8_t address
)
87 struct pHidd_USB_FreeAddress p
;
89 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USB
, moHidd_USB_FreeAddress
);
92 p
.driverObject
= driver
;
95 OOP_DoMethod(obj
, &p
.mID
);
98 OOP_Object
*HIDD_USB_NewDevice(OOP_Object
*obj
, OOP_Object
*hub
, BOOL fast
)
101 struct pHidd_USB_NewDevice p
;
103 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USB
, moHidd_USB_NewDevice
);
109 return (OOP_Object
*)OOP_DoMethod(obj
, &p
.mID
);
114 BOOL
HIDD_USBDevice_GetDescriptor(OOP_Object
*obj
, uint8_t type
, uint8_t index
, uint16_t length
, APTR descriptor
)
117 struct pHidd_USBDevice_GetDescriptor p
;
119 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBDevice
, moHidd_USBDevice_GetDescriptor
);
125 p
.descriptor
= descriptor
;
127 return OOP_DoMethod(obj
, &p
.mID
);
130 BOOL
HIDD_USBDevice_GetConfigDescriptor(OOP_Object
*obj
, uint8_t index
, usb_config_descriptor_t
*descriptor
)
133 struct pHidd_USBDevice_GetConfigDescriptor p
;
135 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBDevice
, moHidd_USBDevice_GetConfigDescriptor
);
139 p
.descriptor
= descriptor
;
141 return OOP_DoMethod(obj
, &p
.mID
);
144 BOOL
HIDD_USBDevice_GetDeviceDescriptor(OOP_Object
*obj
, usb_device_descriptor_t
*descriptor
)
147 struct pHidd_USBDevice_GetDeviceDescriptor p
;
149 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBDevice
, moHidd_USBDevice_GetDeviceDescriptor
);
152 p
.descriptor
= descriptor
;
154 return OOP_DoMethod(obj
, &p
.mID
);
157 BOOL
HIDD_USBDevice_GetStatus(OOP_Object
*obj
, usb_status_t
*status
)
160 struct pHidd_USBDevice_GetStatus p
;
162 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBDevice
, moHidd_USBDevice_GetStatus
);
167 return OOP_DoMethod(obj
, &p
.mID
);
171 BOOL
HIDD_USBDevice_GetString(OOP_Object
*obj
, int8_t id
, uint16_t language
, usb_string_descriptor_t
*string
)
174 struct pHidd_USBDevice_GetString p
;
176 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBDevice
, moHidd_USBDevice_GetString
);
180 p
.language
= language
;
183 return OOP_DoMethod(obj
, &p
.mID
);
186 void * HIDD_USBDevice_CreatePipe(OOP_Object
*obj
, enum USB_PipeType type
, uint8_t endpoint
, uint8_t period
, uint16_t maxpacket
, uint32_t timeout
)
189 struct pHidd_USBDevice_CreatePipe p
;
191 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBDevice
, moHidd_USBDevice_CreatePipe
);
195 p
.endpoint
= endpoint
;
197 p
.maxpacket
= maxpacket
;
200 return (void *) OOP_DoMethod(obj
, &p
.mID
);
203 void HIDD_USBDevice_DeletePipe(OOP_Object
*obj
, APTR pipe
)
206 struct pHidd_USBDevice_DeletePipe p
;
208 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBDevice
, moHidd_USBDevice_DeletePipe
);
213 OOP_DoMethod(obj
, &p
.mID
);
216 void HIDD_USBDevice_SetTimeout(OOP_Object
*obj
, APTR pipe
, uint32_t timeout
)
219 struct pHidd_USBDevice_SetTimeout p
;
221 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBDevice
, moHidd_USBDevice_SetTimeout
);
227 OOP_DoMethod(obj
, &p
.mID
);
230 BOOL
HIDD_USBDevice_ControlMessage(OOP_Object
*obj
, APTR pipe
, USBDevice_Request
*request
, APTR buffer
, uint32_t length
)
233 struct pHidd_USBDevice_ControlMessage p
;
235 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBDevice
, moHidd_USBDevice_ControlMessage
);
243 return OOP_DoMethod(obj
, &p
.mID
);
246 BOOL
HIDD_USBDevice_BulkTransfer(OOP_Object
*obj
, APTR pipe
, APTR buffer
, uint32_t length
)
249 struct pHidd_USBDevice_BulkTransfer p
;
251 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBDevice
, moHidd_USBDevice_BulkTransfer
);
258 return OOP_DoMethod(obj
, &p
.mID
);
261 BOOL
HIDD_USBDevice_Configure(OOP_Object
*obj
, uint8_t configNr
)
264 struct pHidd_USBDevice_Configure p
;
266 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBDevice
, moHidd_USBDevice_Configure
);
269 p
.configNr
= configNr
;
271 return OOP_DoMethod(obj
, &p
.mID
);
274 usb_interface_descriptor_t
*HIDD_USBDevice_GetInterface(OOP_Object
*obj
, uint8_t interface
)
277 struct pHidd_USBDevice_GetInterface p
;
279 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBDevice
, moHidd_USBDevice_GetInterface
);
282 p
.interface
= interface
;
284 return (usb_interface_descriptor_t
*)OOP_DoMethod(obj
, &p
.mID
);
287 usb_endpoint_descriptor_t
*HIDD_USBDevice_GetEndpoint(OOP_Object
*obj
, uint8_t interface
, uint8_t endpoint
)
290 struct pHidd_USBDevice_GetEndpoint p
;
292 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBDevice
, moHidd_USBDevice_GetEndpoint
);
295 p
.interface
= interface
;
296 p
.endpoint
= endpoint
;
298 return (usb_endpoint_descriptor_t
*)OOP_DoMethod(obj
, &p
.mID
);
301 BOOL
HIDD_USBHub_OnOff(OOP_Object
*obj
, BOOL on
)
304 struct pHidd_USBHub_OnOff p
;
306 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBHub
, moHidd_USBHub_OnOff
);
311 return OOP_DoMethod(obj
, &p
.mID
);
314 BOOL
HIDD_USBHub_PortEnable(OOP_Object
*obj
, uint8_t port
, BOOL enable
)
317 struct pHidd_USBHub_PortEnable p
;
319 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBHub
, moHidd_USBHub_PortEnable
);
325 return OOP_DoMethod(obj
, &p
.mID
);
328 BOOL
HIDD_USBHub_PortReset(OOP_Object
*obj
, uint8_t port
)
331 struct pHidd_USBHub_PortReset p
;
333 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBHub
, moHidd_USBHub_PortReset
);
338 return OOP_DoMethod(obj
, &p
.mID
);
341 BOOL
HIDD_USBHub_GetPortStatus(OOP_Object
*obj
, uint8_t port
, usb_port_status_t
*status
)
344 struct pHidd_USBHub_GetPortStatus p
;
346 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBHub
, moHidd_USBHub_GetPortStatus
);
352 return OOP_DoMethod(obj
, &p
.mID
);
355 BOOL
HIDD_USBHub_GetHubStatus(OOP_Object
*obj
, usb_hub_status_t
*status
)
358 struct pHidd_USBHub_GetHubStatus p
;
360 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBHub
, moHidd_USBHub_GetHubStatus
);
365 return OOP_DoMethod(obj
, &p
.mID
);
368 BOOL
HIDD_USBHub_ClearHubFeature(OOP_Object
*obj
, int feature
)
371 struct pHidd_USBHub_ClearHubFeature p
;
373 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBHub
, moHidd_USBHub_ClearHubFeature
);
378 return OOP_DoMethod(obj
, &p
.mID
);
381 BOOL
HIDD_USBHub_SetHubFeature(OOP_Object
*obj
, int feature
)
384 struct pHidd_USBHub_SetHubFeature p
;
386 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBHub
, moHidd_USBHub_SetHubFeature
);
391 return OOP_DoMethod(obj
, &p
.mID
);
394 BOOL
HIDD_USBHub_ClearPortFeature(OOP_Object
*obj
, uint8_t port
, int feature
)
397 struct pHidd_USBHub_ClearPortFeature p
;
399 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBHub
, moHidd_USBHub_ClearPortFeature
);
405 return OOP_DoMethod(obj
, &p
.mID
);
408 BOOL
HIDD_USBHub_SetPortFeature(OOP_Object
*obj
, uint8_t port
, int feature
)
411 struct pHidd_USBHub_SetPortFeature p
;
413 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBHub
, moHidd_USBHub_SetPortFeature
);
419 return OOP_DoMethod(obj
, &p
.mID
);
422 BOOL
HIDD_USBHub_GetHubDescriptor(OOP_Object
*obj
, usb_hub_descriptor_t
*descriptor
)
425 struct pHidd_USBHub_GetHubDescriptor p
;
427 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBHub
, moHidd_USBHub_GetHubDescriptor
);
430 p
.descriptor
= descriptor
;
432 return OOP_DoMethod(obj
, &p
.mID
);
435 OOP_Object
*HIDD_USBHub_GetChild(OOP_Object
*obj
, uint8_t port
)
438 struct pHidd_USBHub_GetChild p
;
440 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBHub
, moHidd_USBHub_GetChild
);
445 return (OOP_Object
*)OOP_DoMethod(obj
, &p
.mID
);
449 APTR
HIDD_USBDrv_CreatePipe(OOP_Object
*obj
, enum USB_PipeType type
,
450 BOOL fullspeed
, uint8_t address
, uint8_t endpoint
, uint8_t period
, uint32_t maxpacket
, uint32_t timeout
)
453 struct pHidd_USBDrv_CreatePipe p
;
455 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBDrv
, moHidd_USBDrv_CreatePipe
);
459 p
.fullspeed
= fullspeed
;
461 p
.endpoint
= endpoint
;
463 p
.maxpacket
= maxpacket
;
466 return (APTR
)OOP_DoMethod(obj
, &p
.mID
);
469 void HIDD_USBDrv_DeletePipe(OOP_Object
*obj
, APTR pipe
)
472 struct pHidd_USBDrv_DeletePipe p
;
474 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBDrv
, moHidd_USBDrv_DeletePipe
);
479 OOP_DoMethod(obj
, &p
.mID
);
482 void HIDD_USBDrv_SetTimeout(OOP_Object
*obj
, APTR pipe
, uint32_t timeout
)
485 struct pHidd_USBDrv_SetTimeout p
;
487 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBDrv
, moHidd_USBDrv_SetTimeout
);
493 OOP_DoMethod(obj
, &p
.mID
);
496 BOOL
HIDD_USBDrv_ControlTransfer(OOP_Object
*obj
, APTR pipe
, USBDevice_Request
*request
,
497 APTR buffer
, uint32_t length
)
500 struct pHidd_USBDrv_ControlTransfer p
;
502 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBDrv
, moHidd_USBDrv_ControlTransfer
);
510 return OOP_DoMethod(obj
, &p
.mID
);
513 BOOL
HIDD_USBDrv_BulkTransfer(OOP_Object
*obj
, APTR pipe
, APTR buffer
, uint32_t length
)
516 struct pHidd_USBDrv_BulkTransfer p
;
518 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBDrv
, moHidd_USBDrv_BulkTransfer
);
525 return OOP_DoMethod(obj
, &p
.mID
);
528 BOOL
HIDD_USBDrv_AddInterrupt(OOP_Object
*obj
, void *pipe
, void *buffer
, uint8_t length
, struct Interrupt
*interrupt
)
531 struct pHidd_USBDrv_AddInterrupt p
;
533 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBDrv
, moHidd_USBDrv_AddInterrupt
);
539 p
.interrupt
= interrupt
;
541 return OOP_DoMethod(obj
, &p
.mID
);
544 BOOL
HIDD_USBDrv_RemInterrupt(OOP_Object
*obj
, void *pipe
, struct Interrupt
*interrupt
)
547 struct pHidd_USBDrv_RemInterrupt p
;
549 if (!static_mid
) static_mid
= OOP_GetMethodID((STRPTR
)IID_Hidd_USBDrv
, moHidd_USBDrv_RemInterrupt
);
553 p
.interrupt
= interrupt
;
555 return OOP_DoMethod(obj
, &p
.mID
);