2014-05-26 16:47:47 +02:00
|
|
|
/*
|
|
|
|
* Interface for HCD
|
|
|
|
*
|
|
|
|
* This file holds prototypes that must be implemented by HCD
|
|
|
|
* and event call that should be called when interrupt occurred
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _HCD_INTERFACE_H_
|
|
|
|
#define _HCD_INTERFACE_H_
|
|
|
|
|
|
|
|
#include <usb/hcd_common.h>
|
|
|
|
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* HCD additional defines *
|
|
|
|
*===========================================================================*/
|
2014-05-26 16:47:56 +02:00
|
|
|
/* Can be returned by 'read_data' to indicate error */
|
2014-05-26 16:47:47 +02:00
|
|
|
#define HCD_READ_ERR -1
|
|
|
|
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* HCD driver structure to be filled
|
|
|
|
*===========================================================================*/
|
|
|
|
struct hcd_driver_state {
|
|
|
|
/* Standard USB controller procedures */
|
2014-05-26 16:47:56 +02:00
|
|
|
void (*setup_device) (void *, hcd_reg1, hcd_reg1);
|
|
|
|
int (*reset_device) (void *, hcd_speed *);
|
|
|
|
void (*setup_stage) (void *, hcd_ctrlrequest *);
|
2014-05-30 14:58:16 +02:00
|
|
|
void (*rx_stage) (void *, hcd_datarequest *);
|
|
|
|
void (*tx_stage) (void *, hcd_datarequest *);
|
2014-05-26 16:47:56 +02:00
|
|
|
void (*in_data_stage) (void *);
|
|
|
|
void (*out_data_stage) (void *);
|
|
|
|
void (*in_status_stage) (void *);
|
|
|
|
void (*out_status_stage) (void *);
|
2014-06-04 15:40:00 +02:00
|
|
|
int (*read_data) (void *, hcd_reg1 *, hcd_reg1);
|
2014-05-26 16:47:56 +02:00
|
|
|
int (*check_error) (void *, hcd_transfer, hcd_direction);
|
2014-05-26 16:47:47 +02:00
|
|
|
|
|
|
|
/* Controller's private data (like mapped registers) */
|
|
|
|
void * private_data;
|
|
|
|
|
|
|
|
/* Current state to be handled by driver */
|
2014-05-26 16:47:56 +02:00
|
|
|
hcd_event current_event;
|
2014-06-13 12:50:13 +02:00
|
|
|
hcd_reg1 current_endpoint;
|
2014-05-26 16:47:56 +02:00
|
|
|
hcd_event expected_event;
|
2014-06-13 12:50:13 +02:00
|
|
|
hcd_reg1 expected_endpoint;
|
2014-05-26 16:47:47 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* HCD event handling routine *
|
|
|
|
*===========================================================================*/
|
|
|
|
/* Handle asynchronous event
|
|
|
|
* This must be called in case of specific HCD interrupts listed above */
|
|
|
|
void hcd_handle_event(hcd_driver_state *);
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* !_HCD_INTERFACE_H_ */
|