嵌入式开发者社区

标题: 菜鸟问个USB_dev_msc问题 [打印本页]

作者: DSP_推粪球    时间: 2016-3-9 17:50
标题: 菜鸟问个USB_dev_msc问题
大神们:
下面是USB_dev_msc主函数的主循环, 我真的没看出来他是怎么调用读写函数进行USB读写的,还是说他就是等着用户自己在“// If there is no activity then return to the idle state.”处填写读写动作呢??谢谢了!
    while(1)
    {
        switch(g_eMSCState)
        {
            case MSC_DEV_READ:
            {
                //
                // Update the screen if necessary.
                //
                if(g_ulFlags & FLAG_UPDATE_STATUS)
                {
                    UpdateStatus("Reading", 0);
                    g_ulFlags &= ~FLAG_UPDATE_STATUS;
                }

                //
                // If there is no activity then return to the idle state.
                //
                if(g_ulIdleTimeout == 0)
                {
                    UpdateStatus("Idle     ", 0);
                    g_eMSCState = MSC_DEV_IDLE;
                }

                break;
            }
            case MSC_DEV_WRITE:
            {
                //
                // Update the screen if necessary.
                //
                if(g_ulFlags & FLAG_UPDATE_STATUS)
                {
                    UpdateStatus("Writing ", 0);
                    g_ulFlags &= ~FLAG_UPDATE_STATUS;
                }

                //
                // If there is no activity then return to the idle state.
                //
                if(g_ulIdleTimeout == 0)
                {
                    UpdateStatus("Idle     ", 0);
                    g_eMSCState = MSC_DEV_IDLE;
                }
                break;
            }
            case MSC_DEV_IDLE:
            default:
            {
                break;
            }
        }


作者: 希望缄默    时间: 2016-3-10 09:06
USB 协议是很复杂的 请参考如下资料
http://processors.wiki.ti.com/index.php/StarterWare_USB
Mass Storage Device Class
[attach]652[/attach]





欢迎光临 嵌入式开发者社区 (https://www.51ele.net/) Powered by Discuz! X3.4