device_mass_storage_task.h File Reference


Detailed Description

Management of the USB device mass-storage task.

This file manages the USB device mass-storage task.

Author:
Atmel Corporation: http://www.atmel.com
Support and FAQ: http://support.atmel.no/

Definition in file device_mass_storage_task.h.

#include "conf_usb.h"

Go to the source code of this file.

Functions

void device_mass_storage_task (void *pvParameters)
 Entry point of the device mass-storage task management.
void device_mass_storage_task_init (void)
 This function initializes the hardware/software resources required for device mass-storage task.
void usb_sof_action (void)
 usb_sof_action


Function Documentation

void device_mass_storage_task ( void *  pvParameters  ) 

Entry point of the device mass-storage task management.

This function links the device mass-storage SCSI commands to the USB bus.

Definition at line 122 of file device_mass_storage_task.c.

References configTSK_USB_DMS_PERIOD, EP_MS_OUT, usb_mass_storage_cbw(), and usb_mass_storage_csw().

Referenced by device_mass_storage_task_init().

00126 {
00127 #ifdef FREERTOS_USED
00128   portTickType xLastWakeTime;
00129 
00130   xLastWakeTime = xTaskGetTickCount();
00131   while (TRUE)
00132   {
00133     vTaskDelayUntil(&xLastWakeTime, configTSK_USB_DMS_PERIOD);
00134 
00135     // First, check the device enumeration state
00136     if (!Is_device_enumerated()) continue;
00137 #else
00138     // First, check the device enumeration state
00139     if (!Is_device_enumerated()) return;
00140 #endif  // FREERTOS_USED
00141 
00142     // Display Start-of-Frame counter on LEDs
00143     /*LED_Display_Field(LED_MONO0_GREEN |
00144                       LED_MONO1_GREEN |
00145                       LED_MONO2_GREEN |
00146                       LED_MONO3_GREEN,
00147                       sof_cnt >> 5);*/
00148 
00149     // If we receive something in the OUT endpoint, parse it
00150     if (Is_usb_out_received(EP_MS_OUT))
00151     {
00152       usb_mass_storage_cbw();
00153       usb_mass_storage_csw();
00154     }
00155 #ifdef FREERTOS_USED
00156   }
00157 #endif
00158 }

void device_mass_storage_task_init ( void   ) 

This function initializes the hardware/software resources required for device mass-storage task.

Definition at line 91 of file device_mass_storage_task.c.

References configTSK_USB_DMS_NAME, configTSK_USB_DMS_PRIORITY, configTSK_USB_DMS_STACK_SIZE, device_mass_storage_task(), EP_MS_IN, and EP_MS_OUT.

Referenced by main().

00092 {
00093   g_scsi_ep_ms_in = EP_MS_IN;
00094   g_scsi_ep_ms_out = EP_MS_OUT;
00095 #ifndef FREERTOS_USED
00096   #if USB_HOST_FEATURE == ENABLED
00097   // If both device and host features are enabled, check if device mode is engaged
00098   // (accessing the USB registers of a non-engaged mode, even with load operations,
00099   // may corrupt USB FIFO data).
00100   if (Is_usb_device())
00101   #endif  // USB_HOST_FEATURE == ENABLED
00102     Usb_enable_sof_interrupt();
00103 #endif  // FREERTOS_USED
00104 
00105 #ifdef FREERTOS_USED
00106   xTaskCreate(device_mass_storage_task,
00107               configTSK_USB_DMS_NAME,
00108               configTSK_USB_DMS_STACK_SIZE,
00109               NULL,
00110               configTSK_USB_DMS_PRIORITY,
00111               NULL);
00112 #endif  // FREERTOS_USED
00113 }


Generated on Fri Feb 19 02:22:52 2010 for AVR32 - Control Panel demonstration. by  doxygen 1.5.5