4 * This file holds prototypes that must be implemented by HCD
5 * and event call that should be called when interrupt occurred
8 #ifndef _HCD_INTERFACE_H_
9 #define _HCD_INTERFACE_H_
11 #include <usb/hcd_common.h>
14 /*===========================================================================*
15 * HCD additional defines *
16 *===========================================================================*/
17 /* Can be returned by 'read_data' to indicate error */
18 #define HCD_READ_ERR -1
21 /*===========================================================================*
22 * HCD driver structure to be filled
23 *===========================================================================*/
24 struct hcd_driver_state
{
25 /* Standard USB controller procedures */
26 void (*setup_device
) (void *, hcd_reg1
, hcd_reg1
);
27 int (*reset_device
) (void *, hcd_speed
*);
28 void (*setup_stage
) (void *, hcd_ctrlrequest
*);
29 void (*rx_stage
) (void *, hcd_datarequest
*);
30 void (*tx_stage
) (void *, hcd_datarequest
*);
31 void (*in_data_stage
) (void *);
32 void (*out_data_stage
) (void *);
33 void (*in_status_stage
) (void *);
34 void (*out_status_stage
) (void *);
35 int (*read_data
) (void *, hcd_reg1
*, int);
36 int (*check_error
) (void *, hcd_transfer
, hcd_direction
);
38 /* Controller's private data (like mapped registers) */
41 /* Current state to be handled by driver */
42 hcd_event current_event
;
44 hcd_event expected_event
;
45 int expected_endpoint
;
49 /*===========================================================================*
50 * HCD event handling routine *
51 *===========================================================================*/
52 /* Handle asynchronous event
53 * This must be called in case of specific HCD interrupts listed above */
54 void hcd_handle_event(hcd_driver_state
*);
57 #endif /* !_HCD_INTERFACE_H_ */