Contiki 2.6

usb_task.c File Reference

This file manages the USB task either device/host or both. More...

#include "contiki.h"
#include "config.h"
#include "conf_usb.h"
#include "usb_drv.h"
#include "usb_descriptors.h"
#include "pll_drv.h"
#include "usb_task.h"
#include "rndis/rndis_protocol.h"
#include "rndis/rndis_task.h"
#include <avr/sleep.h>

Go to the source code of this file.

Functions

void suspend_action (void)
 Spare function to handle sleep mode.
void usb_start_device (void)
 This function initializes the USB device controller.
 PROCESS_THREAD (usb_process, ev, data_proc)
 USB Process.
 ISR (USB_GEN_vect)
 USB general interrupt subroutine.

Variables

volatile uint16_t g_usb_event = 0
 Public : U16 g_usb_event usb_connected is used to store USB events detected upon USB general interrupt subroutine Its value is managed by the following macros (See usb_task.h file) Usb_send_event(x) Usb_ack_event(x) Usb_clear_all_event() Is_usb_event(x) Is_not_usb_event(x)
bit usb_connected
 Public : (bit) usb_connected usb_connected is set to TRUE when VBUS has been detected usb_connected is set to FALSE otherwise Used with USB_DEVICE_FEATURE == ENABLED only /.
U8 usb_configuration_nb
 Public : (U8) usb_configuration_nb Store the number of the USB configuration used by the USB device when its value is different from zero, it means the device mode is enumerated Used with USB_DEVICE_FEATURE == ENABLED only /.

Detailed Description

This file manages the USB task either device/host or both.

This file manages the USB storage.

*********************************************************************

The USB task selects the correct USB task (usb_device task or usb_host task to be executed depending on the current mode available.

According to USB_DEVICE_FEATURE and USB_HOST_FEATURE value (located in conf_usb.h file) The usb_task can be configured to support USB DEVICE mode or USB Host mode or both for a dual role device application.

This module also contains the general USB interrupt subroutine. This subroutine is used to detect asynchronous USB events.

Note:

  • The usb_task belongs to the scheduler, the usb_device_task and usb_host do not, they are called from the general usb_task
  • See conf_usb.h file for more details about the configuration of this module

*********************************************************************

Definition in file usb_task.c.