xref: /minix/minix/drivers/usb/usbd/hcd/musb/musb_core.h (revision 7f5f010b)
1 /*
2  * Interface of low level MUSB core logic (variant independent)
3  */
4 
5 #ifndef _MUSB_CORE_H_
6 #define _MUSB_CORE_H_
7 
8 #include <usb/hcd_common.h>
9 
10 
11 /*===========================================================================*
12  *    Types and constants                                                    *
13  *===========================================================================*/
14 /* Holds info on DATA toggle (DATA0/DATA1) initialization,
15  * required by bulk transfers */
16 typedef enum {
17 
18 	MUSB_DATATOG_UNKNOWN = 0,	/* Default with memset 0 */
19 	MUSB_DATATOG_INIT
20 }
21 musb_datatog;
22 
23 /* Structure to hold Mentor USB core configuration
24  * May be more than one on a single chip
25  * Should be initialized by MUSB's variant specific code (like AM335x) */
26 typedef struct {
27 
28 	void * regs;	/* Points to beginning of memory mapped registers */
29 	hcd_reg1 ep;	/* Currently used endpoint */
30 	hcd_reg1 addr;	/* Currently used address */
31 	musb_datatog datatog_tx[HCD_TOTAL_EP];
32 	musb_datatog datatog_rx[HCD_TOTAL_EP];
33 }
34 musb_core_config;
35 
36 
37 /*===========================================================================*
38  *    Function prototypes                                                    *
39  *===========================================================================*/
40 /* Only to be used outside generic HCD code */
41 void musb_core_start(void *);
42 void musb_core_stop(void *);
43 
44 
45 /* For HCD interface */
46 void musb_setup_device(void *, hcd_reg1, hcd_reg1);
47 int musb_reset_device(void *, hcd_speed *);
48 void musb_setup_stage(void *, hcd_ctrlrequest *);
49 void musb_rx_stage(void *, hcd_datarequest *);
50 void musb_tx_stage(void *, hcd_datarequest *);
51 void musb_in_data_stage(void *);
52 void musb_out_data_stage(void *);
53 void musb_in_status_stage(void *);
54 void musb_out_status_stage(void *);
55 int musb_read_data(void *, hcd_reg1 *, hcd_reg1);
56 int musb_check_error(void *, hcd_transfer, hcd_reg1, hcd_direction);
57 
58 
59 #endif /* !_MUSB_CORE_H_ */
60