亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? usb.c

?? 一個簡單的helloworld編程
?? C
?? 第 1 頁 / 共 4 頁
字號:

        //
        // If the recipient is an endpoint, determine whether it is stalled or
        // not and return that information to the host.
        //
        case USB_RT_RECIPIENT_ENDPOINT:
        {
            // Find out which endpoint is the recipient of the request.
            ulEndpoint = sUSB.sControlOut.wIndex & USB_ENDPOINT_ADDRESS_MASK;
            // Determine whether the IN or the OUT endpoint is being addressed
            // in the device request.
            ulEndpoint *= 2;
            if(sUSB.sControlOut.wIndex & USB_ENDPOINT_DIRECTION_MASK)
            {
                ulEndpoint++;
            }

            // Read the endpoint status.
            USBWriteCommand(USB_COMMAND_SELECT_ENDPOINT);
            ulEndpoint = USBReadData();

            // Send the endpoint's status to the host.
            if(ulEndpoint & USB_ENDPOINT_STALL)
            {
                ucStatus[0] = USB_ENDPOINT_STATUS_STALLED;
            }
            else
            {
                ucStatus[0] = 0;
            }
            ucStatus[1] = 0;

            // Send our response back to the host.
            USBSendControl(ucStatus, 2);

            // We're done handling this request.
            break;
        }
        // If an invalid request is received, stall the control endpoint.

        default:
        {
            // Stall the both control endpoints.
            USBStallEndpoint(USB_ENDPOINT_CONTROL_OUT, 1);
            USBStallEndpoint(USB_ENDPOINT_CONTROL_IN, 1);

            // We're done handling this request.
            break;
        }
    }
}

//****************************************************************************
//
// USBSendControl transmits a block of data back to the host via the control
// endpoint.
//
//****************************************************************************
unsigned long
USBSendControl(const unsigned char *pucData, unsigned long ulLength)
{
    // If a block is already being transmitted, then return a failure.
    if(sUSB.ulControlInCount)
    {
        return(0);
    }
    // Prepare to transmit this block back to the host.
    sUSB.pucControlIn = pucData;
    sUSB.ulControlInCount = ulLength;

    // Send the first packet of this block back to the host.
     USBWriteEndpoint(USB_ENDPOINT_CONTROL_IN, &sUSB.pucControlIn,&sUSB.ulControlInCount);
    return(1);
}

//****************************************************************************
//
// USBClearFeature implements the USB Clear_Feature device request.
//
//****************************************************************************
void USBClearFeature(void)
{
    U32 ulEndpoint;

    // The only feature we support is stall on an endpoint.
   if(((sUSB.sControlOut.bmRequestType & USB_RT_RECIPIENT_MASK) == USB_RT_RECIPIENT_ENDPOINT) &&
       (sUSB.sControlOut.wValue == USB_FEATURE_ENDPOINT_STALL))
    {
        // Compute the endpoint number.
        ulEndpoint = (sUSB.sControlOut.wIndex & USB_ENDPOINT_ADDRESS_MASK) * 2;
        if(sUSB.sControlOut.wIndex & USB_ENDPOINT_DIRECTION_MASK)
        {
            ulEndpoint++;
        }

        // Clear the stall condition on the specified endpoint.
        USBStallEndpoint(ulEndpoint, 0);
    }
    else
    {
        // An unknown feature was specified, so stall both control endpoints.
        USBStallEndpoint(USB_ENDPOINT_CONTROL_OUT, 1);
        USBStallEndpoint(USB_ENDPOINT_CONTROL_IN, 1);
    }
}

//****************************************************************************
//
// USBSetFeature implements the USB Set_Feature device request.
//
//****************************************************************************
void USBSetFeature(void)
{
    U32 ulEndpoint;

    // The only feature we support is stall on an endpoint.
    if(((sUSB.sControlOut.bmRequestType & USB_RT_RECIPIENT_MASK) ==
        USB_RT_RECIPIENT_ENDPOINT) &&
       (sUSB.sControlOut.wValue == USB_FEATURE_ENDPOINT_STALL))
    {
        // Compute the endpoint number.
        ulEndpoint = (sUSB.sControlOut.wIndex & USB_ENDPOINT_ADDRESS_MASK) * 2;
        if(sUSB.sControlOut.wIndex & USB_ENDPOINT_DIRECTION_MASK)
        {
            ulEndpoint++;
        }

        // Set the stall condition on the specified endpoint.
        USBStallEndpoint(ulEndpoint, 1);
    }
    else
    {
        // An unknown feature was specified, so stall both control endpoints.
        USBStallEndpoint(USB_ENDPOINT_CONTROL_OUT, 1);
        USBStallEndpoint(USB_ENDPOINT_CONTROL_IN, 1);
    }
}

//****************************************************************************
//
// USBSetAddress implements the USB Set_Address device request.
//
//****************************************************************************
void USBSetAddress(void)
{
    // Configure our UBS controller for the USB address assigned by the host.
    USBWriteCommand(USB_COMMAND_SET_ADDRESS_ENABLE);
    USBWriteData(sUSB.sControlOut.wValue | 0x80);

    // Respond to the host with an empty packet.
    USBSendControl(0, 0);
}

//****************************************************************************
//
// USBGetDescriptor implements the USB Get_Descriptor device request.
//
//****************************************************************************
void USBGetDescriptor(void)
{
    const U8 *pucDescriptor;
    U32 ulLength;

    // Determine how to handle this request based on the requested descriptor.

    switch(sUSB.sControlOut.wValue & USB_DESCRIPTOR_TYPE_MASK)
    {
        // The device descriptor was requested.
        case USB_DESCRIPTOR_DEVICE:
        {
            // Prepare to return the device descriptor.
            pucDescriptor = ucDeviceDescriptor;
            ulLength = sizeof(ucDeviceDescriptor);

            // We're done handling this request.
            break;
        }

        // The configuration descriptor was requested.
        case USB_DESCRIPTOR_CONFIGURATION:
        {
            // Prepare to return the configuration descriptor.
            pucDescriptor = ucConfigurationDescriptor;
            ulLength = sizeof(ucConfigurationDescriptor);

            // We're done handling this request.
            break;
        }

        // A string descriptor was requested.
        case USB_DESCRIPTOR_STRING:
        {
        // Make sure that the language and string index requested are valid.
          if(((sUSB.sControlOut.wValue & USB_DESCRIPTOR_INDEX_MASK) != 0) &&
               ((sUSB.sControlOut.wIndex != 0x0409) ||
                ((sUSB.sControlOut.wValue & USB_DESCRIPTOR_INDEX_MASK) > 2)))
            {
             // Stall both of the control endpoints.
                USBStallEndpoint(USB_ENDPOINT_CONTROL_OUT, 1);
                USBStallEndpoint(USB_ENDPOINT_CONTROL_IN, 1);

                // We're done handling this request.
                return;
            }

            // Prepare to return the requested string.
            switch(sUSB.sControlOut.wValue & USB_DESCRIPTOR_INDEX_MASK)
            {
                // String index 0 is the language ID string.
                 case 0x00:
                {
                    pucDescriptor = ucString0;
                    ulLength = sizeof(ucString0);
                    break;
                }
                // String index 1 is the manufacturer name.
                case 0x01:
                {
                    pucDescriptor = ucString1;
                    ulLength = sizeof(ucString1);
                    break;
                }

                // String index 2 is the product name.
                case 0x02:
                {
                    pucDescriptor = ucString2;
                    ulLength = sizeof(ucString2);
                    break;
                }
            }

            // We're done handling this request.
            break;
        }

        // An invalid request is received, so stall both control endpoints.
        default:
        {
         // Stall both of the control endpoints.
            USBStallEndpoint(USB_ENDPOINT_CONTROL_OUT, 1);
            USBStallEndpoint(USB_ENDPOINT_CONTROL_IN, 1);
         // We're done handling this request.
            return;
        }
    }

    // If the requested length is less than the length of the descriptor to be
    // returned, then simply return the requested portion of the descriptor.

    if(sUSB.sControlOut.wLength < ulLength)
    {
        ulLength = sUSB.sControlOut.wLength;
    }

    // Send the descriptor back to the host.
    USBSendControl(pucDescriptor, ulLength);
}

//****************************************************************************
//
// USBGetConfiguration implements the USB Get_Configuration device request.
//
//****************************************************************************
void USBGetConfiguration(void)
{
    // Send the current configuration value back to the host.
    USBSendControl((U8 *)&sUSB.ulConfiguration, 1);
}

//****************************************************************************
//
// USBSetConfiguration implements the USB Set_Configuration device request.
//
//****************************************************************************
void USBSetConfiguration(void)
{
    // If the requested configuration is zero, then go into the unconfigured state.
     if(sUSB.sControlOut.wValue == 0)
    {
        // Clear the global configuration flag.
        sUSB.ulConfiguration = 0;

        // Disable the generic endpoints.
        USBWriteCommand(USB_COMMAND_SET_ENDPOINT_ENABLE);
        USBWriteData(0);

        // Respond to the host with an empty packet.
        USBSendControl(0, 0);
    }

    // If the requested configuration is one, then go into the configured state.
     else if(sUSB.sControlOut.wValue == 1)
    {
      // Set the global configuration flag.
      sUSB.ulConfiguration = 1;

        // Disable the generic endpoints.
        USBWriteCommand(USB_COMMAND_SET_ENDPOINT_ENABLE);
        USBWriteData(0);

        // Enable the generic endpoints.
        USBWriteCommand(USB_COMMAND_SET_ENDPOINT_ENABLE);
        USBWriteData(1);

        // Respond to the host with an empty packet.
        USBSendControl(0, 0);
    }

    // If the requested configuration is anything else, then stall both of the control endpoints.
     else
    {
        USBStallEndpoint(USB_ENDPOINT_CONTROL_OUT, 1);
        USBStallEndpoint(USB_ENDPOINT_CONTROL_IN, 1);
    }
}


//****************************************************************************
//
// USBGetInterface implements the USB Get_Interface device request.
//
//****************************************************************************
void USBGetInterface(void)
{
    U8 ucInterface = 0;

    // We only support a single interface, so the current interface is always
    // the first one.  Send our response back to the host.
    USBSendControl(&ucInterface, 1);
}

//****************************************************************************
//
// USBSetInterface implements the USB Set_Interface device request.
//
//****************************************************************************
void USBSetInterface(void)
{
    // We only support a single interface.
    if((sUSB.sControlOut.wValue == 0) && (sUSB.sControlOut.wIndex == 0))
    {
        // The first interface was requested, so do nothing.
        return;
    }
    else
    {
        // A non-existent interface was requested, so stall both control endpoints.
        USBStallEndpoint(USB_ENDPOINT_CONTROL_OUT, 1);
        USBStallEndpoint(USB_ENDPOINT_CONTROL_IN, 1);
    }
}

//****************************************************************************
//
// USBReceiveBulk reads a block of data from the host via the bulk endpoint.
//
//****************************************************************************
unsigned long
USBReceiveBulk(unsigned char *pucData, unsigned long ulLength)
{
    // If a block is already being read, then return a failure.
    if(sUSB.ulBulkOutCount)
    {
        return(0);
    }

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一级专区免费大片| 久久99热国产| 中文字幕电影一区| 69久久夜色精品国产69蝌蚪网| 国产成人av影院| 黄页视频在线91| 久久国产精品第一页| 日韩电影在线免费观看| 亚洲精品水蜜桃| 一区二区三区在线不卡| 亚洲女子a中天字幕| 亚洲猫色日本管| |精品福利一区二区三区| 日本一区二区视频在线观看| 亚洲国产精品黑人久久久| 久久夜色精品国产噜噜av| 精品国产一区a| 日本一区二区三区四区在线视频| 中文字幕中文字幕一区二区| 有码一区二区三区| 青青草97国产精品免费观看| 国产精品一区二区三区四区| 99精品欧美一区二区三区小说| 一本大道久久a久久精二百| 欧美性videosxxxxx| 精品久久久久久久人人人人传媒| 国产欧美综合在线观看第十页| 日韩美女啊v在线免费观看| 亚洲在线免费播放| 国产一区二区三区精品欧美日韩一区二区三区| 国产成人综合在线观看| 色综合天天综合给合国产| 欧美一级欧美一级在线播放| 国产精品免费aⅴ片在线观看| 亚洲一区二区精品3399| 国产综合色视频| 在线亚洲一区二区| 久久久综合精品| 亚洲一区视频在线| 国产精品亚洲一区二区三区在线| 91久久线看在观草草青青| 欧美精品一区二区三区四区| 亚洲黄色尤物视频| 成人黄色电影在线| 日韩精品一区二区三区在线播放 | 欧美精品一区二区久久久| 最好看的中文字幕久久| 美女被吸乳得到大胸91| 91豆麻精品91久久久久久| 久久色在线视频| 奇米亚洲午夜久久精品| 在线视频中文字幕一区二区| 国产精品麻豆一区二区| 久久精品国产澳门| 欧美日韩精品一区视频| 国产精品精品国产色婷婷| 国产一区二区三区在线观看免费| 欧美日韩一级片在线观看| 国产精品视频一二三区| 国内精品免费**视频| 欧美日韩国产综合视频在线观看| 亚洲视频一区二区免费在线观看 | 不卡视频一二三四| 久久一夜天堂av一区二区三区| 日韩成人一级片| 欧美日韩一区久久| 亚洲宅男天堂在线观看无病毒| 99精品视频一区| 国产精品乱码一区二区三区软件| 韩国精品一区二区| 欧美www视频| 亚洲123区在线观看| 精品视频全国免费看| 亚洲国产日韩精品| 在线观看精品一区| 亚洲国产精品一区二区尤物区| 色88888久久久久久影院按摩| 国产精品麻豆网站| 91在线视频网址| 亚洲乱码国产乱码精品精98午夜| 91网站黄www| 亚洲裸体xxx| 91麻豆6部合集magnet| 亚洲一区二区美女| 欧美日韩国产片| 日本视频一区二区三区| 精品美女被调教视频大全网站| 久久国产剧场电影| 国产欧美一区二区精品性| 成人手机电影网| ●精品国产综合乱码久久久久| 欧美亚洲国产一卡| 强制捆绑调教一区二区| 国产欧美一区二区精品秋霞影院 | 成人av网站在线观看| 久久久亚洲精华液精华液精华液| 日韩主播视频在线| 欧美成人性战久久| 国产精品一区二区无线| 亚洲同性gay激情无套| 91视频观看免费| 婷婷丁香久久五月婷婷| 欧美精品一区二区在线观看| 99久久99久久精品免费观看| 亚洲成人av一区| 久久精品亚洲国产奇米99| 91一区一区三区| 精品一区二区久久| 亚洲欧美日韩精品久久久久| 在线播放国产精品二区一二区四区| 久久综合综合久久综合| 中文字幕亚洲欧美在线不卡| 欧美日本在线一区| 国产精品一区二区久激情瑜伽| 亚洲日穴在线视频| 精品国产三级电影在线观看| 不卡的av在线播放| 另类中文字幕网| 一区二区三区毛片| 欧美精品一区二区在线观看| 色综合久久综合网97色综合| 激情久久久久久久久久久久久久久久| 国产精品超碰97尤物18| 精品99999| 在线电影一区二区三区| 99久久精品免费| 国产一区二区三区免费看| 日本午夜一本久久久综合| 亚洲男同1069视频| 中文字幕+乱码+中文字幕一区| 91麻豆精品国产91久久久资源速度| 成人午夜短视频| 激情小说欧美图片| 日韩成人精品视频| 香港成人在线视频| 亚洲日本在线天堂| 中文字幕不卡在线播放| www一区二区| 91精品国产一区二区人妖| 色综合久久综合网97色综合| av色综合久久天堂av综合| 国产在线播放一区| 美女视频黄a大片欧美| 天天免费综合色| 亚洲综合999| 一区二区在线电影| 日韩伦理免费电影| 亚洲欧洲日产国产综合网| 欧美激情中文不卡| 国产调教视频一区| 久久一夜天堂av一区二区三区| 欧美本精品男人aⅴ天堂| 日韩欧美色电影| 欧美一区二区三区在线观看| 精品视频1区2区3区| 欧美视频精品在线观看| 欧美色中文字幕| 欧美日韩免费观看一区三区| 欧美在线综合视频| 欧美午夜视频网站| 欧美日韩国产在线观看| 欧美肥妇bbw| 欧美一区二区三区小说| 日韩亚洲欧美在线| 久久精品亚洲乱码伦伦中文 | 成人欧美一区二区三区| 国产精品国产自产拍高清av王其| 中文字幕高清不卡| 一区二区三区在线视频观看| 亚洲国产va精品久久久不卡综合| 婷婷国产在线综合| 国产一区欧美一区| 99久久99久久久精品齐齐| 欧美伊人精品成人久久综合97| 欧美一区二区三区在线电影| 国产三级一区二区| 亚洲国产日韩精品| 国产尤物一区二区| 色拍拍在线精品视频8848| 日韩一区二区三区电影| 国产精品久久久久7777按摩 | 精品福利在线导航| 国产精品久久久久三级| 五月天丁香久久| 国产精品911| 欧美日韩国产一级二级| 国产三级欧美三级日产三级99 | 国产精品伦一区二区三级视频| 亚洲精品视频在线看| 久久99久久久欧美国产| 色婷婷激情综合| 国产亚洲精品久| 香蕉加勒比综合久久| 丁香五精品蜜臀久久久久99网站| 91视频国产资源| 久久久精品免费网站| 亚洲色图.com| 久久精品国产成人一区二区三区| 成人免费不卡视频| 91精品国产综合久久香蕉麻豆 |