1 #ifndef _USB_GEN_HUB_BASE_H_ 2 #define _USB_GEN_HUB_BASE_H_ 3 4 #include <usb_host_hub.h> 5 6 /* use a short timeout for hub/port status fetches */ 7 #define USB_STS_TIMEOUT 300//1000 8 #define USB_STS_RETRIES 5 9 10 static int blinkenlights; 11 //extern int blinkenlights; 12 static hal_spinlock_t hub_event_lock; 13 //extern uint32_t hub_event_lock; 14 static struct usb_list_head hub_event_list; 15 //extern struct list_head hub_event_list; 16 17 #define USB_HUB_THREAD_EXIT_FLAG_FALSE 0x00 18 #define USB_HUB_THREAD_EXIT_FLAG_TRUE 0x01 19 20 //用来控制hub thread的 21 struct hub_thread_context 22 { 23 //USB_OS_KERNEL_EVENT *hub_thread_complete; //hub thread的 create,exit的complete 24 // USB_OS_KERNEL_EVENT *hub_thread_event; //只是用来控制thread的sleep/wakeup 25 hal_sem_t hub_thread_complete; //hub thread的 create,exit的complete 26 hal_sem_t hub_thread_event; //只是用来控制thread的sleep/wakeup 27 volatile u32 hub_thread_exit_flag ; //hub thread 退出flag 28 //如USB_HUB_THREAD_EXIT_FLAG_TRUE 29 }; 30 31 static struct hub_thread_context hub_thread_cont; 32 //extern struct hub_thread_context hub_thread_cont; 33 34 int32_t hub_port_status(struct usb_hub *hub, int32_t port1, u16 *status, u16 *change); 35 int32_t usb_suspend_device(struct usb_host_virt_dev *virt_dev); 36 37 int32_t usb_resume_device(struct usb_host_virt_dev *virt_dev); 38 39 40 void hub_quiesce(struct usb_hub *hub); 41 42 int32_t hub_suspend(struct usb_interface *intf); 43 int hub_resume(struct usb_interface *intf); 44 int remote_wakeup(struct usb_host_virt_dev *udev); 45 46 int hub_hub_status(struct usb_hub *hub, u16 *status, u16 *change); 47 48 49 int hub_thread_sleep(struct hub_thread_context *thread_cont); 50 void hub_thread_wakeup(struct hub_thread_context *thread_cont); 51 52 53 #endif 54