76 PROCESS(usb_process,
"USB process");
78 #ifndef USE_USB_PADS_REGULATOR
79 #error "USE_USB_PADS_REGULATOR" should be defined as ENABLE or DISABLE in conf_usb.h file
81 #include <avr/sleep.h>
86 #define LOG_STR_CODE(str)
88 U8 code log_device_disconnect[]=
"Device Disconnected";
89 U8 code log_id_change[]=
"Pin Id Change";
92 #define USB_EVENT 0x2F
136 set_sleep_mode(SLEEP_MODE_PWR_DOWN);
153 Usb_unfreeze_clock();
154 Usb_enable_vbus_interrupt();
167 static void pollhandler(
void)
177 if (schedule_interrupt) {
201 schedule_interrupt = 0;
227 #if (USE_USB_PADS_REGULATOR==ENABLE) // Otherwise assume USB PADs regulator is not used
238 #if (USB_LOW_SPEED_DEVICE==ENABLE)
241 Usb_enable_vbus_interrupt();
257 Usb_vbus_on_action();
300 if (Is_usb_vbus_transition() && Is_usb_vbus_interrupt_enabled())
302 Usb_ack_vbus_transition();
303 if (Is_usb_vbus_high())
306 Usb_vbus_on_action();
314 Usb_vbus_off_action();
321 if (
Is_usb_sof() && Is_sof_interrupt_enabled())
334 Usb_suspend_action();
339 Usb_unfreeze_clock();
342 Usb_wake_up_action();
#define Is_usb_event(x)
Check for USB event.
This file contains the possible external configuration of the USB.
#define Is_usb_wake_up()
tests if wake-up occurs
volatile uint16_t g_usb_event
Public : U16 g_usb_event usb_connected is used to store USB events detected upon USB general interrup...
void process_poll(struct process *p)
Request a process to be polled.
#define Usb_reset_endpoint(ep)
resets the selected endpoint
This file manages the USB task either device/host or both.
#define Usb_enable_wake_up_interrupt()
enables wake-up interrupt
#define PROCESS_BEGIN()
Define the beginning of a process.
#define Wait_pll_ready()
Test PLL lock bit and wait until lock is set.
#define Is_usb_suspend()
tests if Suspend state detected
#define Usb_ack_reset()
acks USB reset
void usb_start_device(void)
This function initializes the USB device controller.
#define Usb_enable_regulator()
Enable internal USB pads regulator.
This file contains the USB driver routines.
#define Usb_ack_suspend()
acks Suspend
#define NULL
The null pointer.
#define Usb_write_byte(byte)
writes byte in FIFO for current endpoint
void suspend_action(void)
Spare function to handle sleep mode.
#define Is_usb_sof()
tests if Start Of Frame occurs
void usb_process_request(void)
usb_process_request.
#define Usb_ack_event(x)
Ack event processed.
#define Usb_ack_wake_up()
acks wake-up
U8 usb_configuration_nb
Public : (U8) usb_configuration_nb Store the number of the USB configuration used by the USB device w...
U8 usb_init_device(void)
usb_init_device.
int process_post(struct process *p, process_event_t ev, process_data_t data)
Post an asynchronous event.
#define Is_usb_resume()
tests if resume occurs
#define Usb_attach()
attaches to USB bus
#define Usb_ack_resume()
acks resume
#define PROCESS_THREAD(name, ev, data)
Define the body of a process.
#define PROCESS_END()
Define the end of a process.
#define EVT_USB_POWERED
USB Event: USB plugged.
#define TRUE
An alias for one, used for clarity.
#define Usb_enable_reset_interrupt()
enables USB reset interrupt
bit usb_connected
Public : (bit) usb_connected usb_connected is set to TRUE when VBUS has been detected usb_connected i...
This file manages the RNDIS task.
#define Usb_low_speed_mode()
For device mode, force low speed mode.
#define Usb_send_in()
sends IN
#define EVT_USB_UNPOWERED
USB Event: USB un-plugged.
#define Usb_send_event(x)
Send event.
#define PROCESS_POLLHANDLER(handler)
Specify an action when a process is polled.
#define Usb_disable_resume_interrupt()
disables resume interrupt
#define Usb_disable_wake_up_interrupt()
disables wake-up interrupt
#define PROCESS_WAIT_EVENT_UNTIL(c)
Wait for an event to be posted to the process, with an extra condition.
#define Is_usb_reset()
tests if USB reset occurs
This file contains the low level macros and definition for the USB PLL.
#define Is_usb_receive_setup()
tests if SETUP received
#define PROCESS(name, strname)
Declare a process.
#define Usb_enable()
Enable both USB interface and Vbus pad.
#define Is_usb_write_enabled()
tests if endpoint write allowed
#define Usb_freeze_clock()
Stop internal USB clock in interface (freeze the interface register)
This file contains the usb parameters that uniquely identify the application through descriptor table...
#define FALSE
An alias for zero, used for clarity.
#define Usb_select_endpoint(ep)
selects the endpoint number to interface with the CPU
#define EVT_USB_WAKE_UP
USB Event: USB wake up.
#define EVT_USB_RESET
USB Event: USB reset.
#define EVT_USB_RESUME
USB Event: USB resume.
#define Usb_force_device_mode()
Disable external UID pin and force device mode.
#define EVT_USB_SUSPEND
USB Event: USB suspend.
#define Usb_ack_sof()
acks Start Of Frame
#define Usb_disable()
Disable both USB interface and Vbus pad.