This file manages the USB device mass-storage task.
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) |
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 |
void device_mass_storage_task | ( | void | ) |
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 127 of file device_mass_storage_task.c.
References configTSK_USB_DMS_PERIOD, EP_MS_OUT, sof_cnt, usb_mass_storage_cbw(), and usb_mass_storage_csw().
Referenced by device_mass_storage_task_init(), and main().
00129 { 00130 #ifdef FREERTOS_USED 00131 portTickType xLastWakeTime; 00132 00133 xLastWakeTime = xTaskGetTickCount(); 00134 while (TRUE) 00135 { 00136 vTaskDelayUntil(&xLastWakeTime, configTSK_USB_DMS_PERIOD); 00137 00138 // First, check the device enumeration state 00139 if (!Is_device_enumerated()) continue; 00140 #else 00141 // First, check the device enumeration state 00142 if (!Is_device_enumerated()) return; 00143 #endif // FREERTOS_USED 00144 00145 #if BOARD == EVK1100 00146 // Display Start-of-Frame counter on LEDs 00147 LED_Display_Field(LED_MONO0_GREEN | 00148 LED_MONO1_GREEN | 00149 LED_MONO2_GREEN | 00150 LED_MONO3_GREEN, 00151 sof_cnt >> 5); 00152 #elif BOARD == EVK1101 || BOARD == EVK1104 || BOARD == EVK1105 || BOARD == UC3C_EK 00153 // Display Start-of-Frame counter on LEDs 00154 LED_Display_Field(LED0 | 00155 LED1, 00156 sof_cnt >> 5); 00157 #else 00158 #error The display of the SOFs must be defined here. 00159 #endif 00160 00161 // If we receive something in the OUT endpoint, parse it 00162 if (Is_usb_out_received(EP_MS_OUT)) 00163 { 00164 usb_mass_storage_cbw(); 00165 usb_mass_storage_csw(); 00166 } 00167 #ifdef FREERTOS_USED 00168 } 00169 #endif 00170 }
void device_mass_storage_task_init | ( | void | ) |
This function initializes the hardware/software resources required for device mass-storage task.
Definition at line 93 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, EP_MS_OUT, g_scsi_ep_ms_in, g_scsi_ep_ms_out, and sof_cnt.
Referenced by main().
00094 { 00095 g_scsi_ep_ms_in = EP_MS_IN; 00096 g_scsi_ep_ms_out = EP_MS_OUT; 00097 sof_cnt = 0; 00098 #ifndef FREERTOS_USED 00099 #if USB_HOST_FEATURE == ENABLED 00100 // If both device and host features are enabled, check if device mode is engaged 00101 // (accessing the USB registers of a non-engaged mode, even with load operations, 00102 // may corrupt USB FIFO data). 00103 if (Is_usb_device()) 00104 #endif // USB_HOST_FEATURE == ENABLED 00105 Usb_enable_sof_interrupt(); 00106 #endif // FREERTOS_USED 00107 00108 #ifdef FREERTOS_USED 00109 xTaskCreate(device_mass_storage_task, 00110 configTSK_USB_DMS_NAME, 00111 configTSK_USB_DMS_STACK_SIZE, 00112 NULL, 00113 configTSK_USB_DMS_PRIORITY, 00114 NULL); 00115 #endif // FREERTOS_USED 00116 }