00001
00016 #ifndef _USB_DEVICE_TASK_H_
00017 #define _USB_DEVICE_TASK_H_
00018
00021
00022
00023
00024
00025
00026
00027
00028
00029
00033 #define B_IDLE 0
00034 #define B_SRP_INIT 1
00035 #define B_PERIPHERAL 2
00036 #define B_WAIT_ACON 3
00037 #define B_HOST 4
00038 #define B_END_HNP_SUSPEND 5
00039
00043 extern U8 otg_device_sessions;
00044 extern U8 otg_b_device_state;
00045 extern U8 sof_seen_in_session;
00046
00048 #define Start_session_with_srp() (otg_device_sessions |= 0x01)
00049 #define End_session_with_srp() (otg_device_sessions &= ~0x01)
00050 #define Is_session_started_with_srp() (((otg_device_sessions&0x01) != 0) ? TRUE : FALSE)
00051
00053 #define Srp_sent_and_waiting_answer() (otg_device_sessions |= 0x02)
00054 #define Ack_srp_sent_and_answer() (otg_device_sessions &= ~0x02)
00055 #define Is_srp_sent_and_waiting_answer() (((otg_device_sessions&0x02) != 0) ? TRUE : FALSE)
00056
00059 #define TB_SRP_FAIL_MIN 0x0A28
00060 extern U16 otg_tb_srp_cpt;
00061 #define Init_tb_srp_counter() (otg_tb_srp_cpt = 0)
00062 #define Is_tb_srp_counter_overflow() ((otg_tb_srp_cpt > TB_SRP_FAIL_MIN) ? TRUE : FALSE)
00063
00064
00077 void usb_device_task_init (void);
00078
00092 void usb_start_device (void);
00093
00104 void usb_device_task (void);
00105
00107
00108 #endif
00109