新聞中心

        EEPW首頁 > 模擬技術 > 設計應用 > USB入門總結

        USB入門總結

        作者: 時間:2012-04-18 來源:網絡 收藏
        ceronous status variable initialization
        ------------------------------------------------------------*/
        usb_status.configuration = NULL;
        usb_status.remote_wakeup = 0;
        usb_status.address = 0;
        usb_status.dvcstate = DEFAULT_STATE; /* Device state :DEFAULT */
        usb_status.stall_req = 0;
        #ifdef Debug
        test[conters]='!';
        conters++;
        #endif

        /*------------------------------------------------------------
        Callback to application layer
        ------------------------------------------------------------*/
        (*usb_status.callback)();
        }
        else if (SUSPENDED_INT())
        { /* suspended state */
        /* for Rev.1.1
        Transit to suspended state after detect the line has kept idle over 3msec.
        After resume detected, end suspend state in 3msec to be able to respond
        the host request.
        */
        CLR_SUSPENDED_STATE();
        #ifdef Debug
        test[conters]='@';
        conters++;
        #endif

        }

        else if (AWAKE_INT())
        { /* Deveice awake state */
        /* AWAKE procedure */

        CLR_AWAKE_STATE(); /* Request clear */
        #ifdef Debug
        test[conters]='#';
        conters++;
        #endif

        }
        else if (_BUSRESET_DES_INT())
        { /* USB bus reset deassert */
        /* Procedure for USB bus reset de-assert */

        CLR_BUS_RESET_DES_STATE(); /* Request clear */
        #ifdef Debug
        test[conters]='$';
        conters++;
        #endif

        }

        else if (SOF_INT())
        { /* SOF interrupt status */
        CLR_B_SOF_STATE();
        #ifdef Debug
        test[conters]='%';
        conters++;
        #endif
        /* SOF interrupt status clear */
        } /* SOF interrupt status */

        if (SETUP_RDY_INT())
        { /* setup ready */
        #ifdef Debug
        test[conters]='^';
        conters++;
        #endif

        read_Device_Requests();
        }

        else if(EP1_PKTRDY_INT())
        { /* EP1 packet ready */
        read_FIFO(EP1);
        }
        else if (EP2_PKTRDY_INT())
        { /* EP2 packet ready */

        write_FIFO(EP2);
        }

        else if (EP0_RXPKTRDY_INT())
        { /* EP0 receive packet ready */
        read_FIFO(EP0RX);
        }
        else if (EP0_TXPKTRDY_INT())
        { /* EP0 transmit packet ready */
        write_FIFO(EP0TX);
        }

        }
        計錄的結果在變量查看中顯示如下:

        首先我解釋一下,這段程序是我在做USB設備時的中斷函數。主



        關鍵詞: USB 入門總結

        評論


        相關推薦

        技術專區

        關閉
        主站蜘蛛池模板: 梁平县| 乡城县| 中卫市| 金堂县| 鹤岗市| 盐池县| 广州市| 杭锦后旗| 抚远县| 咸丰县| 邛崃市| 庄浪县| 阿巴嘎旗| 兴国县| 汉川市| 长春市| 红原县| 白银市| 珲春市| 南城县| 太湖县| 项城市| 永泰县| 启东市| 通州市| 黑山县| 买车| 连云港市| 镇江市| 偏关县| 彭山县| 南通市| 灵武市| 平原县| 日喀则市| 曲阜市| 洛宁县| 洛隆县| 枣强县| 凌海市| 日喀则市|