Exemplo n.º 1
0
//*****************************************************************************
//
// Calls the USB host stack tick function.
//
// This function is called periodically to allow the USB host stack to
// process any outstanding items.
//
// \return None.
//
//*****************************************************************************
void
ScopeUSBHostTick(void)
{
    tBoolean bRetcode;

    //
    // Call the stack to allow it to perform any processing needing done.
    //
    USBHCDMain();

    //
    // See if we need to do anything here.
    //
    if(g_eState == STATE_DEVICE_ENUM)
    {
        //
        // The device is available.  Try to open its root directory just
        // to make sure it is accessible.
        //
        bRetcode = FileIsDrivePresent(1);

        if(bRetcode)
        {
            //
            // The USB drive is accessible so dump a message and set the state
            // to indicate that the device is ready for use.
            //
            UARTprintf("Opened root directory - USB drive present.\n");
            RendererSetAlert("USB drive\ndetected.", 200);
            g_eState = STATE_DEVICE_READY;
        }
    }
}
Exemplo n.º 2
0
//*****************************************************************************
//
// Calls the USB host stack tick function.
//
// This function is called periodically to allow the USB host stack to
// process any outstanding items.
//
// \return None.
//
//*****************************************************************************
void
ScopeUSBHostTick(void)
{
    tBoolean bRetcode;

    //
    // Call the stack to allow it to perform any processing needing done.
    //
    USBHCDMain();

    //
    // See if we need to do anything here.
    //
    if(g_eState == STATE_DEVICE_ENUM)
    {
        //
        // Take it easy on the Mass storage device if it is slow to
        // start up after connecting.
        //
        if(USBHMSCDriveReady(g_ulMSCInstance) != 0)
        {
            //
            // Wait about 500ms before attempting to check if the
            // device is ready again.
            //
            SysCtlDelay(SysCtlClockGet()/(3*2));
        }
        else
        {
            //
            // The device is available.  Try to open its root directory just
            // to make sure it is accessible.
            //
            bRetcode = FileIsDrivePresent(1);

            if(bRetcode)
            {
                //
                // The USB drive is accessible so dump a message and set the state
                // to indicate that the device is ready for use.
                //
                UARTprintf("Opened root directory - USB drive present.\n");
                RendererSetAlert("USB drive\ndetected.", 200);
                g_eState = STATE_DEVICE_READY;
            }
        }
    }
}