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

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

?? usbdrv.c

?? usb 轉(zhuǎn) 232 ISP AMEGA8源程序
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/* Name: usbdrv.c * Project: AVR USB driver * Author: Christian Starkjohann * Creation Date: 2004-12-29 * Tabsize: 4 * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH * License: Proprietary, free under certain conditions. See Documentation. * This Revision: $Id: usbdrv.c 222 2006-07-17 15:07:34Z cs $ */#include "iarcompat.h"#ifndef __IAR_SYSTEMS_ICC__#   include <avr/io.h>#   include <avr/pgmspace.h>#endif#include "usbdrv.h"#include "oddebug.h"/*General Description:This module implements the C-part of the USB driver. See usbdrv.h for adocumentation of the entire driver.*/#ifndef IAR_SECTION#define IAR_SECTION(arg)#define __no_init#endif/* The macro IAR_SECTION is a hack to allow IAR-cc compatibility. On gcc, it * is defined to nothing. __no_init is required on IAR. *//* ------------------------------------------------------------------------- *//* raw USB registers / interface to assembler code: *//* usbRxBuf MUST be in 1 byte addressable range (because usbInputBuf is only 1 byte) */__no_init uchar usbRxBuf[2][USB_BUFSIZE] __attribute__ ((section (USB_BUFFER_SECTION))) IAR_SECTION(USB_BUFFER_SECTION);/* raw RX buffer: PID, 8 bytes data, 2 bytes CRC */uchar       usbDeviceAddr;      /* assigned during enumeration, defaults to 0 */uchar       usbNewDeviceAddr;   /* device ID which should be set after status phase */uchar       usbConfiguration;   /* currently selected configuration. Administered by driver, but not used */uchar       usbInputBuf;        /* ptr to raw buffer used for receiving */uchar       usbAppBuf;          /* ptr to raw buffer passed to app for processing */volatile schar usbRxLen;        /* = 0; number of bytes in usbAppBuf; 0 means free */uchar       usbCurrentTok;      /* last token received, if more than 1 rx endpoint: MSb=endpoint */uchar       usbRxToken;         /* token for data we received; if more than 1 rx endpoint: MSb=endpoint */uchar       usbMsgLen = 0xff;   /* remaining number of bytes, no msg to send if -1 (see usbMsgPtr) */volatile uchar usbTxLen = USBPID_NAK;   /* number of bytes to transmit with next IN token or handshake token */uchar       usbTxBuf[USB_BUFSIZE];/* data to transmit with next IN, free if usbTxLen contains handshake token */#if USB_CFG_HAVE_INTRIN_ENDPOINTvolatile uchar usbTxLen1 = USBPID_NAK;  /* TX count for endpoint 1 */uchar       usbTxBuf1[USB_BUFSIZE];     /* TX data for endpoint 1 */#if USB_CFG_HAVE_INTRIN_ENDPOINT3volatile uchar usbTxLen3 = USBPID_NAK;  /* TX count for endpoint 1 */uchar       usbTxBuf3[USB_BUFSIZE];     /* TX data for endpoint 1 */#endif#endif/* USB status registers / not shared with asm code */uchar           *usbMsgPtr;     /* data to transmit next -- ROM or RAM address */static uchar    usbMsgFlags;    /* flag values see below */static uchar    usbIsReset;     /* = 0; USB bus is in reset phase */#define USB_FLG_TX_PACKET       (1<<0)/* Leave free 6 bits after TX_PACKET. This way we can increment usbMsgFlags to toggle TX_PACKET */#define USB_FLG_MSGPTR_IS_ROM   (1<<6)#define USB_FLG_USE_DEFAULT_RW  (1<<7)/*optimizing hints:- do not post/pre inc/dec integer values in operations- assign value of PRG_RDB() to register variables and don't use side effects in arg- use narrow scope for variables which should be in X/Y/Z register- assign char sized expressions to variables to force 8 bit arithmetics*//* ------------------------------------------------------------------------- */#if USB_CFG_DESCR_PROPS_STRINGS == 0#if USB_CFG_DESCR_PROPS_STRING_0 == 0#undef USB_CFG_DESCR_PROPS_STRING_0#define USB_CFG_DESCR_PROPS_STRING_0    sizeof(usbDescriptorString0)PROGMEM char usbDescriptorString0[] = { /* language descriptor */    4,          /* sizeof(usbDescriptorString0): length of descriptor in bytes */    3,          /* descriptor type */    0x09, 0x04, /* language index (0x0409 = US-English) */};#endif#if USB_CFG_DESCR_PROPS_STRING_VENDOR == 0 && USB_CFG_VENDOR_NAME_LEN#undef USB_CFG_DESCR_PROPS_STRING_VENDOR#define USB_CFG_DESCR_PROPS_STRING_VENDOR   sizeof(usbDescriptorStringVendor)PROGMEM int  usbDescriptorStringVendor[] = {    USB_STRING_DESCRIPTOR_HEADER(USB_CFG_VENDOR_NAME_LEN),    USB_CFG_VENDOR_NAME};#endif#if USB_CFG_DESCR_PROPS_STRING_DEVICE == 0 && USB_CFG_DEVICE_NAME_LEN#undef USB_CFG_DESCR_PROPS_STRING_DEVICE#define USB_CFG_DESCR_PROPS_STRING_DEVICE   sizeof(usbDescriptorStringDevice)PROGMEM int  usbDescriptorStringDevice[] = {    USB_STRING_DESCRIPTOR_HEADER(USB_CFG_DEVICE_NAME_LEN),    USB_CFG_DEVICE_NAME};#endif#if USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER == 0 && USB_CFG_SERIAL_NUMBER_LEN#undef USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER#define USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER    sizeof(usbDescriptorStringSerialNumber)PROGMEM int usbDescriptorStringSerialNumber[] = {    USB_STRING_DESCRIPTOR_HEADER(USB_CFG_SERIAL_NUMBER_LEN),    USB_CFG_SERIAL_NUMBER};#endif#endif  /* USB_CFG_DESCR_PROPS_STRINGS == 0 */#if USB_CFG_DESCR_PROPS_DEVICE == 0#undef USB_CFG_DESCR_PROPS_DEVICE#define USB_CFG_DESCR_PROPS_DEVICE  sizeof(usbDescriptorDevice)PROGMEM char usbDescriptorDevice[] = {    /* USB device descriptor */    18,         /* sizeof(usbDescriptorDevice): length of descriptor in bytes */    USBDESCR_DEVICE,        /* descriptor type */    0x01, 0x01,             /* USB version supported */    USB_CFG_DEVICE_CLASS,    USB_CFG_DEVICE_SUBCLASS,    0,                      /* protocol */    8,                      /* max packet size */    USB_CFG_VENDOR_ID,      /* 2 bytes */    USB_CFG_DEVICE_ID,      /* 2 bytes */    USB_CFG_DEVICE_VERSION, /* 2 bytes */    USB_CFG_DESCR_PROPS_STRING_VENDOR != 0 ? 1 : 0,         /* manufacturer string index */    USB_CFG_DESCR_PROPS_STRING_DEVICE != 0 ? 2 : 0,         /* product string index */    USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER != 0 ? 3 : 0,  /* serial number string index */    1,          /* number of configurations */};#endif#if USB_CFG_DESCR_PROPS_HID_REPORT != 0 && USB_CFG_DESCR_PROPS_HID == 0#undef USB_CFG_DESCR_PROPS_HID#define USB_CFG_DESCR_PROPS_HID     9   /* length of HID descriptor in config descriptor below */#endif#if USB_CFG_DESCR_PROPS_CONFIGURATION == 0#undef USB_CFG_DESCR_PROPS_CONFIGURATION#define USB_CFG_DESCR_PROPS_CONFIGURATION   sizeof(usbDescriptorConfiguration)PROGMEM char usbDescriptorConfiguration[] = {    /* USB configuration descriptor */    9,          /* sizeof(usbDescriptorConfiguration): length of descriptor in bytes */    USBDESCR_CONFIG,    /* descriptor type */    18 + 7 * USB_CFG_HAVE_INTRIN_ENDPOINT + (USB_CFG_DESCR_PROPS_HID & 0xff), 0,                /* total length of data returned (including inlined descriptors) */    1,          /* number of interfaces in this configuration */    1,          /* index of this configuration */    0,          /* configuration name string index */#if USB_CFG_IS_SELF_POWERED    USBATTR_SELFPOWER,  /* attributes */#else    USBATTR_BUSPOWER,   /* attributes */#endif    USB_CFG_MAX_BUS_POWER/2,            /* max USB current in 2mA units *//* interface descriptor follows inline: */    9,          /* sizeof(usbDescrInterface): length of descriptor in bytes */    USBDESCR_INTERFACE, /* descriptor type */    0,          /* index of this interface */    0,          /* alternate setting for this interface */    USB_CFG_HAVE_INTRIN_ENDPOINT,   /* endpoints excl 0: number of endpoint descriptors to follow */    USB_CFG_INTERFACE_CLASS,    USB_CFG_INTERFACE_SUBCLASS,    USB_CFG_INTERFACE_PROTOCOL,    0,          /* string index for interface */#if (USB_CFG_DESCR_PROPS_HID & 0xff)    /* HID descriptor */    9,          /* sizeof(usbDescrHID): length of descriptor in bytes */    USBDESCR_HID,   /* descriptor type: HID */    0x01, 0x01, /* BCD representation of HID version */    0x00,       /* target country code */    0x01,       /* number of HID Report (or other HID class) Descriptor infos to follow */    0x22,       /* descriptor type: report */    USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH, 0,  /* total length of report descriptor */#endif#if USB_CFG_HAVE_INTRIN_ENDPOINT    /* endpoint descriptor for endpoint 1 */    7,          /* sizeof(usbDescrEndpoint) */    USBDESCR_ENDPOINT,  /* descriptor type = endpoint */    0x81,       /* IN endpoint number 1 */    0x03,       /* attrib: Interrupt endpoint */    8, 0,       /* maximum packet size */    USB_CFG_INTR_POLL_INTERVAL, /* in ms */#endif};#endif/* We don't use prog_int or prog_int16_t for compatibility with various libc * versions. Here's an other compatibility hack: */#ifndef PRG_RDB#define PRG_RDB(addr)   pgm_read_byte(addr)#endiftypedef union{    unsigned    word;    uchar       *ptr;    uchar       bytes[2];}converter_t;/* We use this union to do type conversions. This is better optimized than * type casts in gcc 3.4.3 and much better than using bit shifts to build * ints from chars. Byte ordering is not a problem on an 8 bit platform. *//* ------------------------------------------------------------------------- */#if USB_CFG_HAVE_INTRIN_ENDPOINTuchar   usbTxPacketCnt1;void    usbSetInterrupt(uchar *data, uchar len){uchar       *p, i;#if USB_CFG_IMPLEMENT_HALT    if(usbTxLen1 == USBPID_STALL)        return;#endif#if 0   /* No runtime checks! Caller is responsible for valid data! */    if(len > 8) /* interrupt transfers are limited to 8 bytes */        len = 8;#endif    i = USBPID_DATA1;    if(usbTxPacketCnt1 & 1)        i = USBPID_DATA0;    if(usbTxLen1 & 0x10){       /* packet buffer was empty */        usbTxPacketCnt1++;    }else{        usbTxLen1 = USBPID_NAK; /* avoid sending incomplete interrupt data */    }    p = usbTxBuf1;    *p++ = i;    for(i=len;i--;)        *p++ = *data++;    usbCrc16Append(&usbTxBuf1[1], len);    usbTxLen1 = len + 4;    /* len must be given including sync byte */    DBG2(0x21, usbTxBuf1, len + 3);}#endif#if USB_CFG_HAVE_INTRIN_ENDPOINT3uchar   usbTxPacketCnt3;void    usbSetInterrupt3(uchar *data, uchar len){uchar       *p, i;    i = USBPID_DATA1;    if(usbTxPacketCnt3 & 1)        i = USBPID_DATA0;    if(usbTxLen3 & 0x10){       /* packet buffer was empty */        usbTxPacketCnt3++;    }else{        usbTxLen3 = USBPID_NAK; /* avoid sending incomplete interrupt data */    }    p = usbTxBuf3;    *p++ = i;    for(i=len;i--;)        *p++ = *data++;    usbCrc16Append(&usbTxBuf3[1], len);    usbTxLen3 = len + 4;    /* len must be given including sync byte */    DBG2(0x23, usbTxBuf3, len + 3);}#endifstatic uchar    usbRead(uchar *data, uchar len){#if USB_CFG_IMPLEMENT_FN_READ    if(usbMsgFlags & USB_FLG_USE_DEFAULT_RW){#endif        uchar i = len, *r = usbMsgPtr;        if(usbMsgFlags & USB_FLG_MSGPTR_IS_ROM){    /* ROM data */            while(i--){                uchar c = PRG_RDB(r);    /* assign to char size variable to enforce byte ops */                *data++ = c;                r++;            }        }else{                  /* RAM data */            while(i--)                *data++ = *r++;        }        usbMsgPtr = r;        return len;

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区中文在线| 欧美日韩一级片在线观看| 欧美三级日韩在线| 久久天堂av综合合色蜜桃网 | 欧美国产欧美综合| 亚洲综合一区在线| 高清不卡在线观看av| 这里只有精品电影| 亚洲与欧洲av电影| 成人免费看的视频| 久久综合色鬼综合色| 午夜伦理一区二区| 91网址在线看| 欧美国产亚洲另类动漫| 另类小说欧美激情| 欧美日韩不卡一区| 国产精品久久午夜| 国产精品亚洲专一区二区三区 | 日韩精品成人一区二区三区| 成人国产精品免费| 国产欧美一区二区三区在线看蜜臀| 石原莉奈在线亚洲二区| 在线免费观看日本一区| 亚洲特级片在线| 国产高清不卡二三区| 欧美电影免费观看高清完整版在线观看| 亚洲精品国产精品乱码不99 | 国产成a人亚洲精| 日韩精品中文字幕一区| 另类人妖一区二区av| 日韩一级片在线播放| 日韩精品一级二级| 91精品在线一区二区| 男男视频亚洲欧美| 精品区一区二区| 国产一区二区免费看| 久久久精品蜜桃| av影院午夜一区| 亚洲一区二区三区四区的| 欧美日韩你懂的| 精品无码三级在线观看视频| 精品国产一二三区| 成人av在线资源| 亚洲乱码国产乱码精品精的特点 | 日韩一区二区三区免费观看| 亚洲人成亚洲人成在线观看图片 | 五月婷婷久久丁香| 欧美色网一区二区| 热久久一区二区| 国产网站一区二区三区| av福利精品导航| 亚洲成av人片一区二区梦乃| 欧美变态tickling挠脚心| 成人91在线观看| 青青青爽久久午夜综合久久午夜| 久久久久久久久久久久电影| 国产成人av电影免费在线观看| 一区二区三区在线观看视频| 日韩一级精品视频在线观看| 国产精品亚洲成人| 婷婷亚洲久悠悠色悠在线播放| xfplay精品久久| 欧美网站大全在线观看| 国产福利一区在线观看| 天天影视涩香欲综合网| 中文字幕日韩一区| 久久丝袜美腿综合| 欧美日本一区二区三区四区| 福利一区二区在线| 日韩中文字幕一区二区三区| 中文字幕在线播放不卡一区| 精品国产免费视频| 日韩精品中文字幕一区二区三区| 日本久久精品电影| 91欧美激情一区二区三区成人| 麻豆中文一区二区| 一区二区三区在线免费视频| 精品国产伦一区二区三区观看体验| 91久久精品午夜一区二区| 成人禁用看黄a在线| 日本不卡一二三| 石原莉奈在线亚洲二区| 亚洲一区在线视频观看| 洋洋成人永久网站入口| 亚洲视频一区二区在线| 亚洲视频免费看| 国产精品对白交换视频| 亚洲色图20p| 一级女性全黄久久生活片免费| 亚洲视频你懂的| 午夜欧美电影在线观看| 亚洲女同ⅹxx女同tv| 一区二区三区国产精华| 亚洲激情五月婷婷| 一区二区三区中文在线观看| 久久综合久久99| 国产精品乱子久久久久| 亚洲日本乱码在线观看| 一区二区三区波多野结衣在线观看| 亚洲欧美乱综合| 日韩成人精品视频| 美国三级日本三级久久99| 国产成人在线色| 国产 欧美在线| 欧美午夜宅男影院| 久久久精品国产免大香伊| 成人黄色小视频| 国产美女主播视频一区| 美女视频免费一区| 五月天一区二区| 日日摸夜夜添夜夜添亚洲女人| 亚洲综合无码一区二区| 亚洲1区2区3区4区| 麻豆国产精品777777在线| 青娱乐精品视频在线| 国产福利91精品一区| 狠狠网亚洲精品| 福利电影一区二区三区| 色噜噜狠狠色综合欧洲selulu| 欧美高清激情brazzers| 中文子幕无线码一区tr | 三级影片在线观看欧美日韩一区二区| 看片的网站亚洲| 欧美性videosxxxxx| 国产欧美日韩精品一区| 视频一区国产视频| 91麻豆swag| 欧美国产日韩精品免费观看| 日本女人一区二区三区| 色综合久久中文综合久久牛| 欧美不卡一区二区三区四区| 夜夜精品视频一区二区| 成人av手机在线观看| 国产亚洲一区二区三区四区| 国产精品久久久久久久岛一牛影视| 婷婷综合另类小说色区| 成人a级免费电影| 久久久久久久久97黄色工厂| 午夜精品久久久久影视| 欧美性猛交一区二区三区精品| 国产精品全国免费观看高清| 国产一区二区三区四区在线观看| 日韩一区二区三区四区| 日韩不卡免费视频| 欧美精品一级二级| 亚洲国产日韩在线一区模特| 欧美中文一区二区三区| 一区二区三区免费| 日本韩国欧美在线| 亚洲国产中文字幕| 欧美性一级生活| 免费xxxx性欧美18vr| 日韩视频不卡中文| 国产又黄又大久久| 欧美—级在线免费片| 99re这里只有精品6| 日本一区二区高清| 欧美性色aⅴ视频一区日韩精品| 亚洲成人免费在线| 欧美精品一区二| 波多野结衣91| 天堂蜜桃91精品| 精品久久久久99| www.日韩大片| 日韩和欧美一区二区| 国产性天天综合网| 91久久精品午夜一区二区| 日韩在线观看一区二区| 国产午夜亚洲精品理论片色戒| 91色.com| 日韩福利视频网| 国产精品视频免费看| 欧美日韩在线电影| 国产精品一区二区三区乱码| 亚洲色欲色欲www在线观看| 欧美肥妇bbw| 99精品桃花视频在线观看| 亚洲人精品午夜| 国产精品国产成人国产三级 | 欧美日韩精品一区二区三区| 精品一区二区av| 国产精品初高中害羞小美女文| 色美美综合视频| 精品亚洲国产成人av制服丝袜| 亚洲视频1区2区| 国产午夜精品在线观看| 欧美日本乱大交xxxxx| 国产成人精品三级| 另类中文字幕网| 三级影片在线观看欧美日韩一区二区 | 亚洲国产精品尤物yw在线观看| 久久综合成人精品亚洲另类欧美| 日本高清免费不卡视频| 成人免费看的视频| 国产成人av一区二区三区在线 | 日韩视频免费直播| 欧美日韩在线三区| 色美美综合视频| 色呦呦日韩精品| 在线亚洲欧美专区二区|