void device_mass_storage_task(void)
#endif
{
#ifdef FREERTOS_USED
  portTickType xLastWakeTime;

  xLastWakeTime = xTaskGetTickCount();
  while (true)
  {
    vTaskDelayUntil(&xLastWakeTime, configTSK_USB_DMS_PERIOD);

    // First, check the device enumeration state
    if (!Is_device_enumerated()) continue;
#else
    // First, check the device enumeration state
    if (!Is_device_enumerated()) return;
#endif  // FREERTOS_USED

    // Display Start-of-Frame counter on LEDs
    /*LED_Display_Field(LED_MONO0_GREEN |
                      LED_MONO1_GREEN |
                      LED_MONO2_GREEN |
                      LED_MONO3_GREEN,
                      sof_cnt >> 5);*/

    // If we receive something in the OUT endpoint, parse it
    if (Is_usb_out_received(EP_MS_OUT))
    {
      usb_mass_storage_cbw();
      usb_mass_storage_csw();
    }
#ifdef FREERTOS_USED
  }
#endif
}
void device_mass_storage_task(void)
#endif
{
#ifdef FREERTOS_USED
  portTickType xLastWakeTime;

  xLastWakeTime = xTaskGetTickCount();
  while (true)
  {
    vTaskDelayUntil(&xLastWakeTime, configTSK_USB_DMS_PERIOD);

    // First, check the device enumeration state
    if (!Is_device_enumerated()) continue;
#else
    // First, check the device enumeration state
    if (!Is_device_enumerated()) return;
#endif  // FREERTOS_USED

#if BOARD == EVK1100
#if 0 // Error for NS8100
    // Display Start-of-Frame counter on LEDs
    LED_Display_Field(LED_MONO0_GREEN |
                      LED_MONO1_GREEN |
                      LED_MONO2_GREEN |
                      LED_MONO3_GREEN,
                      sof_cnt >> 5);
#endif
#elif BOARD == EVK1101 || BOARD == EVK1104 || BOARD == EVK1105 || BOARD == UC3C_EK
    // Display Start-of-Frame counter on LEDs
    LED_Display_Field(LED0 |
                      LED1,
                      sof_cnt >> 5);
#else
  #error The display of the SOFs must be defined here.
#endif

    // If we receive something in the OUT endpoint, parse it
    if (Is_usb_out_received(EP_MS_OUT))
    {
      usb_mass_storage_cbw();
      usb_mass_storage_csw();
    }
#ifdef FREERTOS_USED
  }
#endif
}
Example #3
0
//!
//! @brief Entry point of the device mass-storage task management
//!
//! This function links the device mass-storage SCSI commands to the USB bus.
//!
//! @param pvParameters Input. Unused.
//!
void device_mass_storage_task(void *pvParameters)
{
  portTickType xLastWakeTime;

  xLastWakeTime = xTaskGetTickCount();
  while (true)
  {
    vTaskDelayUntil(&xLastWakeTime, configTSK_USB_DMS_PERIOD);

    // First, check the device enumeration state
    if (!Is_device_enumerated()) continue;

    // Display Start-of-Frame counter on LEDs
    // LED_Display_Field(0x7E, sof_cnt >> 5);

    // If we receive something in the OUT endpoint, parse it
    if (Is_usb_out_received(EP_MS_OUT))
    {
      usb_mass_storage_cbw();
      usb_mass_storage_csw();
    }
  }
}
void device_mass_storage_task (void)
#endif
{
    unsigned int TickDelayToRestart = MAX_TICKS_UNTIL_RESTART_MSD_INTERFACE;
    int ErrorFound;
    unsigned long long ActualTime_u64;
    static unsigned int LoopCounter_u32 = 0;

#ifdef FREERTOS_USED
    portTickType xLastWakeTime;

    FAI_InitLun (0);

    xLastWakeTime = xTaskGetTickCount ();
    while (TRUE)
    {
        vTaskDelayUntil (&xLastWakeTime, configTSK_USB_DMS_PERIOD);

        // First, check the device enumeration state
        if (!Is_device_enumerated ())
            continue;
#else
    // First, check the device enumeration state
    if (!Is_device_enumerated ())
        return;
#endif // FREERTOS_USED

    // If we receive something in the OUT endpoint, parse it
    if (Is_usb_out_received (EP_MS_OUT))
    {
        usb_mass_storage_cbw ();
        usb_mass_storage_csw ();
    }

    // Check LUN activity

    if (30 <= LoopCounter_u32)
    {
        ActualTime_u64 = TIME_MEASURING_GetTime ();
        if ((FALSE == sd_mmc_mci_test_unit_only_local_access)   // On local access > disable check
            // || (ActualTime_u64 > MAX_TICKS_STARTUP_UNTIL_RESTART_MSD_INTERFACE) // Not check on startup
            )
        {
            ErrorFound = FALSE;
            if (ActualTime_u64 - LastLunAccessInTick_u64[0] > TickDelayToRestart)
            {
                CI_StringOut ("UNCRYPTED LUN 0 - TIMEOUT\r\n");
                ErrorFound = TRUE;
            }
            // Check LUN activity
            if (ActualTime_u64 - LastLunAccessInTick_u64[1] > TickDelayToRestart)
            {
                CI_StringOut ("ENCRYPTED LUN 1 - TIMEOUT\r\n");
                ErrorFound = TRUE;
            }
            /*
               if (TRUE == ErrorFound) { CI_StringOut ("*** RESTART MSD DEVICE TASK ***\r\n"); LastLunAccessInTick_u64[0] = ActualTime_u64;
               LastLunAccessInTick_u64[1] = ActualTime_u64; usb_device_task_delete(); usb_device_task_init(); } */
        }
        else
        {
            LastLunAccessInTick_u64[0] = ActualTime_u64;    // Avoid wrong timeout
            LastLunAccessInTick_u64[1] = ActualTime_u64;
        }
    }
    else
    {
        LoopCounter_u32 = 0;
    }


#ifdef FREERTOS_USED
}
#endif
}