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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? usb.c

?? 一個簡單的helloworld編程
?? C
?? 第 1 頁 / 共 4 頁
字號:
#include "..\inc\44b.h"
#include "..\inc\44blib.h"
#include "..\inc\def.h"
#include "..\inc\option.h"
#include "..\inc\usb.h"
#include <stdarg.h>
#include <string.h>
#include <stdio.h>

//static NU_HISR  usb_comm_hisr;
//static NU_TASK  task_usbcomm;
//NU_EVENT_GROUP 	eg_usbcomm;

int usboperation=0;

static U32 verbose = 0;

static U8 usbbuffer0[256];
static U8 usbbuffer1[256];
static U8 usbbuffer2[256];

void USBISRPOLLING(int number);

//****************************************************************************
//
// This structure defines the setup packet received from the host via the
// control out endpoint.  This sturcture is padded at the end to the maximum
// control endpoint transfer size.
//
//****************************************************************************
typedef struct
{
    U8 bmRequestType;
    U8 bRequest;
    U16 wValue;
    U16 wIndex;
    U16 wLength;
} ControlTransfer;

//****************************************************************************
//
// This is the configuration descriptor for the digital audio player.  See the
// USB specification for the definition of this descriptor.
//
//****************************************************************************
static const U8 ucDeviceDescriptor[] =
{
    0x12,                               // bLength
    0x01,                               // bDescriptorType
    0x00, 0x01,                         // bcdUSB
    0x00,                               // bDeviceClass
    0x00,                               // bDeviceSubClass
    0x00,                               // bDeviceProtocol
    0x10,                               // bMaxPacketSize0
    0x71, 0x04,                         // idVendor 0x5e, 0x04,
    0x22, 0x02,                         // idProduct 0x0a, 0x93,
    0x00, 0x01,                         // bcdDevice
    0x01,                               // iManufacturer
    0x02,                               // iProduct
    0x00,                               // iSerial Number
    0x01                                // bNumConfigurations
};

static const U8 ucConfigurationDescriptor[] =
{
    //
    // The configuration descriptor structure.
    //
    0x09,                               // bLength
    0x02,                               // bDescriptorType
    0x20,                               // wTotalLength
    0x00,                               // bCorrection
    0x01,                               // bNumInterfaces
    0x01,                               // bConfigurationValue
    0x00,                               // iConfiguration
    0x80,                               // bmAttributes 0x40
    0x32,                               // MaxPower 0x00

    //
    // The interface descriptor structure.
    //
    0x09,                               // bLength
    0x04,                               // bDescriptorType
    0x00,                               // bInterfaceNumber
    0x00,                               // bAlternateSetting
    0x02,                               // bNumEndpoints
    0x00, //00                              // bInterfaceClass
    0x00,                               // bInterfaceSubClass
    0x00, //00                              // bInterfaceProtocol
    0x00,                               // iInterface

    //
    // The endpoint descriptor structure.
    //
    0x07,                               // bLength
    0x05,                               // bDescriptorType
    0x82,                               // bEndpointAddress
    0x02,                               // bmAttributes
    0x40, 0x00,                         // wMaxPacketSize
    0x00,                               // bInterval

    //
    // The endpoint descriptor structure.
    //
    0x07,                               // bLength
    0x05,                               // bDescriptorType
    0x02,                               // bEndpointAddress
    0x02,                               // bmAttributes
    0x40, 0x00,                         // wMaxPacketSize
    0x00                                // bInterval
};
//****************************************************************************
//
// String descriptor 0 for the digital audio player.  This defines the
// languages supported by the string descriptors.  See the USB specification
// for the definition of this descriptor.
//
//****************************************************************************
static const U8 ucString0[] =
{
    0x04,                               // bLength
    0x03,                               // bDescriptorType
    0x09, 0x04                          // wLANGID[0] -> US English
};

//****************************************************************************
//
// String descriptor 1 for the digital audio player.  This defines the
// manufacturer of the player.  See the USB specification for the definition
// of this descriptor.
//
//****************************************************************************
static const U8 ucString1[] =
{
    0x26,                               // bLength
    0x03,                               // bDescriptorType
    'S', 0x00,                          // wString[]
    'W', 0x00,
    '4', 0x00,
    '4', 0x00,
    'B', 0x00,
    '0', 0x00,
    ' ', 0x00,
    'B', 0x00,
    'O', 0x00,
    'A', 0x00,
    'R', 0x00,
    'D', 0x00,
    ' ', 0x00,
    ' ', 0x00,
    ' ', 0x00,
    ' ', 0x00,
    ' ', 0x00,
    ' ', 0x00
};

//****************************************************************************
//
// String descriptor 1 for the digital audio player.  This defines the product
// description of the player.  See the USB specification for the definition of
// this descriptor.
//
//****************************************************************************
static const U8 ucString2[] =
{
    0x52,                               // bLength
    0x03,                               // bDescriptorType
    'S', 0x00,                          // wString[]
    'W', 0x00,
    '4', 0x00,
    '4', 0x00,
    'B', 0x00,
    '0', 0x00,
    '-', 0x00,
    'P', 0x00,
    'D', 0x00,
    'I', 0x00,
    'U', 0x00,
    'S', 0x00,
    'B', 0x00,
    'D', 0x00,
    '1', 0x00,
    '2', 0x00,
    ' ', 0x00,
    'D', 0x00,
    'E', 0x00,
    'V', 0x00,
    'I', 0x00,
    'C', 0x00,
    'E', 0x00,
    'S', 0x00,
    ' ', 0x00
};
//****************************************************************************
//
// An array of pointers to the USB standard device request handler Functions.
//
//****************************************************************************
void (* const USBStandardDeviceRequest[])(void) =
{
    USBGetStatus,
    USBClearFeature,
    USBReserved,
    USBSetFeature,
    USBReserved,
    USBSetAddress,
    USBGetDescriptor,
    USBReserved,
    USBGetConfiguration,
    USBSetConfiguration,
    USBGetInterface,
    USBSetInterface,
    USBReserved
};

//****************************************************************************
//
// The following structure contains the persistent state of the USB interface.
//
//****************************************************************************
static struct
{
    // The currently selected USB configuration.
    unsigned long ulConfiguration;

    // The buffer of data that is being sent to the control endpoint.
    const unsigned char *pucControlIn;

    // The number of bytes to be sent to the control endpoint.
     unsigned long ulControlInCount;

    // The buffer of data that is being received from the control endpoint.
    ControlTransfer sControlOut;

    // The buffer of data that is being sent to the bulk endpoint.
     const unsigned char *pucBulkIn;

    // The number of bytes to be sent to the bulk endpoint.
    unsigned long ulBulkInCount;

    // The buffer of data that is being received from the bulk endpoint.
    unsigned char *pucBulkOut;

    // The number of bytes still to be read from the bulk endpoint.
    unsigned long ulBulkOutCount;

    const unsigned char *pucACKIn;

    unsigned long ulACKInCount;
    
    unsigned char  *pucCommandOut;
    
    unsigned long ulCommandOutCount;

} sUSB;


#define USB_STRUCT_INITED 0x55AAA55A

U8 USBInitStruct(void)
{
    if (sUSB.ulConfiguration == USB_STRUCT_INITED)
        return 0;
        
    memset(&sUSB, 0 , sizeof(sUSB));    
    sUSB.ulConfiguration = USB_STRUCT_INITED;
    
    sUSB.pucControlIn = usbbuffer0;
    sUSB.ulControlInCount = 0;

    sUSB.pucBulkIn = usbbuffer2;
    sUSB.ulBulkInCount = 0;

    sUSB.pucBulkOut = usbbuffer2;
    sUSB.ulBulkOutCount = 0;

    sUSB.pucACKIn = usbbuffer1;
    sUSB.ulACKInCount = 0;
    
    sUSB.pucCommandOut = usbbuffer1;
    sUSB.ulCommandOutCount = 0;
    return 0;
}


void USBEnable(void)
{
	pISR_EINT0=(int)USBISR;
 	rINTMSK =~(BIT_GLOBAL|BIT_EINT0);
}

void USBDisable(void)
{
	 rINTMSK =BIT_EINT0;
}

//****************************************************************************
//
// USBWriteCommand will write the specified value to the command register of
// the PDIUSBD12.
//
//****************************************************************************
void USBWriteCommand(U8 commandvalue)
{
    U8 * volatile commandregister = (U8 *)(Usb_Base_Address + Usb_Command_Address);
    int delay;

    // Write the value to the command register.
     *commandregister = commandvalue;

    // Delay a bit to comply with the timing specification of the PDIUSBD12.
     for(delay = 0; delay < 24; delay++)
    {
    }
}

//****************************************************************************
//
// USBWriteData will write the specified value to the data register of the
// PDIUSBD12.
//
//****************************************************************************
void USBWriteData(U8 datavalue)
{
    U8 * volatile dataregister = (U8 *)(Usb_Base_Address + Usb_Data_Address);
    int delay;

    // Write the value to the data register.

    *dataregister = datavalue;

    // Delay a bit to comply with the timing specification of the PDIUSBD12.
    for(delay = 0; delay < 24; delay++)
    {
    }
}
//****************************************************************************
//
// USBInit configures the PDIUSBD12 device.
//
//****************************************************************************
void USBON(void)
{
    int saveSyscfg;
    
    saveSyscfg=rSYSCFG;
    
//    rNCACHBE1=( (0x6000000>>12)<<16 )|(0x4000000>>12);
//    rSYSCFG=SYSCFG_8KBn;
    
    USBInitStruct();
    USBWriteCommand(USB_COMMAND_SEND_RESUME);
    Delay(10000);
    USBWriteCommand(USB_COMMAND_SET_ADDRESS_ENABLE);
    USBWriteData(0);
    
    USBWriteCommand(USB_COMMAND_SET_ENDPOINT_ENABLE);
    USBWriteData(0);
    //
    // Enable the interrupts for the bulk endpoints.
    //
    USBWriteCommand(USB_COMMAND_SET_DMA);
    USBWriteData(USB_DMA_ENDP4_INT_ENABLE | USB_DMA_ENDP5_INT_ENABLE);

    //
    // Configure the PDIUSBD12 and enable the SoftConnect pull-up.
    //

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲图片欧美综合| 国产精品美女视频| 美脚の诱脚舐め脚责91| 欧美一级欧美三级| 久久99精品国产麻豆婷婷| 精品三级在线看| 国内精品视频666| 久久精品综合网| jvid福利写真一区二区三区| 亚洲欧洲成人自拍| 欧日韩精品视频| 蜜臀精品久久久久久蜜臀| 日韩精品中午字幕| 成人av在线资源网| 一区二区三区精品| 欧美videofree性高清杂交| 国产精品亚洲人在线观看| 国产精品高清亚洲| 欧美午夜理伦三级在线观看| 久久精品国产99国产| 欧美激情一区二区三区全黄 | 奇米精品一区二区三区四区| 精品捆绑美女sm三区| 9色porny自拍视频一区二区| 午夜久久久久久电影| 国产亚洲午夜高清国产拍精品| av电影在线观看完整版一区二区| 亚洲va欧美va人人爽| 久久亚洲春色中文字幕久久久| 91丨porny丨国产入口| 秋霞成人午夜伦在线观看| 亚洲国产高清在线观看视频| 欧美精品在线观看播放| 国产传媒日韩欧美成人| 亚洲国产综合色| 久久久www免费人成精品| 在线观看国产日韩| 国产综合一区二区| 亚洲专区一二三| 国产日韩欧美制服另类| 在线播放中文字幕一区| 99久久伊人精品| 国产一区在线观看视频| 亚洲电影一级黄| 国产精品久久二区二区| 欧美一区二区精品| 欧美日韩中文国产| aa级大片欧美| 国产69精品一区二区亚洲孕妇| 日本中文字幕一区二区视频 | 国产91丝袜在线播放| 日韩精品一级中文字幕精品视频免费观看 | 91精品国产综合久久国产大片| 成人午夜伦理影院| 激情小说亚洲一区| 婷婷国产v国产偷v亚洲高清| 亚洲手机成人高清视频| 国产亚洲女人久久久久毛片| 欧美一区二区三区视频免费播放| 91麻豆蜜桃一区二区三区| 国产黄人亚洲片| 青青草原综合久久大伊人精品| 一区二区三区在线免费| 亚洲欧洲精品天堂一级| 国产视频一区二区在线| 精品国产乱码久久久久久闺蜜| 欧美日本不卡视频| 欧美日韩高清一区二区三区| 欧美主播一区二区三区美女| 99精品久久久久久| 成人涩涩免费视频| 国产盗摄精品一区二区三区在线| 美女视频黄 久久| 日韩中文欧美在线| 日本欧美大码aⅴ在线播放| 天堂久久一区二区三区| 亚洲成人av免费| 性感美女极品91精品| 亚洲成人动漫一区| 日韩国产欧美三级| 开心九九激情九九欧美日韩精美视频电影| 婷婷国产v国产偷v亚洲高清| 日本午夜精品一区二区三区电影| 亚洲成a人v欧美综合天堂下载| 亚洲一区二区高清| 香蕉加勒比综合久久| 日本不卡免费在线视频| 美女精品自拍一二三四| 精品一区二区三区香蕉蜜桃| 精品一区二区综合| 国产.欧美.日韩| www.欧美日韩国产在线| 91老师片黄在线观看| 在线一区二区三区| 欧美日本精品一区二区三区| 日韩一区二区精品| 国产亚洲午夜高清国产拍精品| 一区在线观看视频| 亚洲1区2区3区4区| 狠狠色伊人亚洲综合成人| 成人午夜av影视| 欧洲一区在线观看| 欧美性生活大片视频| 欧美成人午夜电影| 久久丝袜美腿综合| 亚洲婷婷综合色高清在线| 一区二区三区成人在线视频| 亚洲成va人在线观看| 国产乱国产乱300精品| www.色精品| 3d动漫精品啪啪一区二区竹菊| 日韩欧美综合一区| 国产精品免费网站在线观看| 亚洲第一在线综合网站| 国产一二三精品| 欧美综合视频在线观看| 精品国产一区二区三区久久影院 | 韩国精品一区二区| 91小视频免费看| 欧美成人精品二区三区99精品| 国产精品入口麻豆原神| 午夜欧美一区二区三区在线播放| 国产做a爰片久久毛片| 在线亚洲人成电影网站色www| 日韩欧美区一区二| 伊人一区二区三区| 国产麻豆精品视频| 欧美精品久久天天躁| 国产欧美精品一区二区色综合| 亚洲成a人片在线观看中文| 福利电影一区二区| 91精品国产欧美一区二区18| 国产精品蜜臀av| 久久精品99国产精品| 欧美午夜精品电影| 亚洲欧美一区二区三区国产精品 | 亚洲成人午夜电影| 99免费精品视频| 精品噜噜噜噜久久久久久久久试看| 依依成人精品视频| 99精品偷自拍| 国产亚洲精品aa| 免费在线观看日韩欧美| 欧美日韩欧美一区二区| 国产精品久线在线观看| 国产一区二区三区免费观看| 欧美一卡2卡3卡4卡| 亚洲综合在线免费观看| 国产91露脸合集magnet| 日韩免费看的电影| 欧美一激情一区二区三区| 中文字幕欧美激情| 国产成人aaa| 欧美一区二区三区免费大片| 国产女同性恋一区二区| 亚洲va国产va欧美va观看| 国产99久久久国产精品潘金 | 91精品福利在线一区二区三区| 亚洲乱码中文字幕综合| 国产精品一区二区在线观看网站| 欧美卡1卡2卡| 久久综合九色综合97婷婷女人| 亚洲免费看黄网站| 成人晚上爱看视频| 国产日韩欧美精品在线| 久久精品国产99国产精品| 9191成人精品久久| 日韩av成人高清| 欧美日韩成人综合在线一区二区 | 欧美成人国产一区二区| 偷拍日韩校园综合在线| 99久久伊人久久99| 1区2区3区欧美| 成人97人人超碰人人99| 欧美激情综合网| 精品中文字幕一区二区小辣椒| 欧美一二三在线| 国产一区二区三区四区五区入口| 日韩一二在线观看| 激情成人综合网| 91精品国产综合久久精品app| 亚洲国产人成综合网站| 91精品国产一区二区三区| 性久久久久久久| 777奇米成人网| 天天综合色天天| 久久久久久综合| 懂色av一区二区三区蜜臀| 亚洲国产精品ⅴa在线观看| 国产一区二区三区在线观看精品| 国产欧美视频一区二区三区| 另类小说图片综合网| 精品国产电影一区二区| 亚洲二区在线观看| 日韩视频一区二区在线观看| 美国三级日本三级久久99| 欧美成人在线直播| 91视视频在线观看入口直接观看www | 2019国产精品| 91免费视频观看|