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

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

?? usb_drv.c

?? atmel c5122 USB C51程序
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*C**************************************************************************
* NAME:         usb_drv.c
*----------------------------------------------------------------------------
* Copyright (c) 2003 Atmel.
*----------------------------------------------------------------------------
* RELEASE:      c5122-scib-usb-hid-2_4_0      
* REVISION:     1.10     
*----------------------------------------------------------------------------
* PURPOSE: 
* This file contains the USB driver routines.
*****************************************************************************/

/*_____ I N C L U D E S ____________________________________________________*/

#include "config.h"
#include "usb_drv.h"

/*_____ M A C R O S ________________________________________________________*/


/*_____ D E F I N I T I O N ________________________________________________*/
/* --------------------------------------------------------------------------------------------------
|Xtal frequency  ||  6 MHz |  8 MHz | 12 MHz | 16 MHz | 20 MHz | 24 MHz | 32 MHz | 40 MHz | 48 MHz |
 --------------------------------------------------------------------------------------------------
|Pll % value (n) ||   1    |   1    |   1    |   1    |   5    |   1    |   2    |   10   |disabled|
|Pll x value (r) ||   8    |   6    |   4    |   3    |   12   |   2    |   3    |   12   |disabled|
|PLLDIV value    ||  70h   |  50h   |  30h   |  20  h |  B4h   |  10h   |  21h   |  B9h   |disabled|
|  [r,n]         ||        |        |        |        |        |        |        |        |        |
 --------------------------------------------------------------------------------------------------
|Timer load X1   ||   600  |   800  |  1200  |  1600  |  2000  |  2400  |  3200  |  4000  |  4800  |
|Timer TH0-TH1 X1|| FD-A7h | FC-DFh | FB-4Fh | F9-BFh | F8-2Fh | F6-9Fh | F3-7Fh | F0-5Fh | ED-3Fh |
|Timer load X2   ||  1200  |  1600  |  2400  |  3200  |  4000  |  4800  |   na   |   na   |   na   |
|Timer TH0-TH1 X2|| FB-4Fh | F9-BFh | F6-9Fh | F3-7Fh | F0-5Fh | ED-3Fh |   na   |   na   |   na   |   
 --------------------------------------------------------------------------------------------------
*/
#if FOSC == 0000
  code char pll_value[8] = {0x70,0x50,0x30,0x20,0xB4,0x10,0x21,0xB9};
  code char TH0_value[9] = {0xFD,0xFC,0xFB,0xF9,0xF8,0xF6,0xF3,0xF0,0xED};
  code char TL0_value[9] = {0xA7,0xDF,0x4F,0xBF,0x2F,0x9F,0x7F,0x5F,0x3F};
#endif
/*_____ D E C L A R A T I O N ______________________________________________*/

/*F**************************************************************************
* NAME: usb_configure_endpoint 
*----------------------------------------------------------------------------
* PARAMS:
* ep_num:   Number of the endpoint to configure
* ep_type:  Type to configure
*           The possible types are:
*                CONTROL
*                BULK_IN
*                BULK_OUT
*                INTERRUPT_IN
*                INTERRUPT_OUT
*                ISOCHRONOUS_IN
*                ISOCHRONOUS_OUT
* return:   none
*----------------------------------------------------------------------------
* PURPOSE: 
* This function configures an endpoint with the selected type.
*----------------------------------------------------------------------------
* EXAMPLE:
* usb_configure_endpoint(0,CONTROL);
*----------------------------------------------------------------------------
* NOTE:
* The endpoint 0 shall always be configured in CONTROL type.
*----------------------------------------------------------------------------
* REQUIREMENTS: 
*****************************************************************************/
void usb_configure_endpoint (Uchar ep_num, Uchar ep_type)
{
  Usb_select_ep(ep_num);
  Usb_configure_ep_type(ep_type); 
}

/*F**************************************************************************
* NAME: usb_select_endpoint_interrupt
*----------------------------------------------------------------------------
* PARAMS:
* return:   endpoint number
*----------------------------------------------------------------------------
* PURPOSE: 
* This function select the endpoint where an event occurs and returns the
* number of this endpoint. If no event occurs on the endpoints, this
* function returns 0.
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS: 
*****************************************************************************/
Uchar usb_select_enpoint_interrupt(void)
{
  if (EP0INT)       { Usb_select_ep(0); }
  else if (EP1INT)  { Usb_select_ep(1); }
  else if (EP2INT)  { Usb_select_ep(2); }
  else if (EP3INT)  { Usb_select_ep(3); }
  else if (EP4INT)  { Usb_select_ep(4); }
  else if (EP5INT)  { Usb_select_ep(5); }
  else if (EP6INT)  { Usb_select_ep(6); }

  return (UEPNUM);
}


/*F**************************************************************************
* NAME: usb_get_nb_byte 
*----------------------------------------------------------------------------
* PARAMS:
* return:   number of byte stored in the currently selected endpoint
*----------------------------------------------------------------------------
* PURPOSE: 
* This function returns the number of byte stored in the currently selected
* endpoint.
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
* This function shall be launched only for OUT endpoints after each receipt
* and before any other operation.
* This function shall not be used if the declared FIFO size is more than
* 255 bytes. In this case, use the usb_get_nb_byte_epw function.  
*----------------------------------------------------------------------------
* REQUIREMENTS: 
*****************************************************************************/
Uchar usb_get_nb_byte (void)
{
  return (UBYCTLX);
}

/*F**************************************************************************
* NAME: usb_get_nb_byte_epw 
*----------------------------------------------------------------------------
* PARAMS:
* return:   number of byte stored in the endpoint .
*----------------------------------------------------------------------------
* PURPOSE: 
* This function returns the number of byte stored in the endpoint 6.
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
* This function shall be launched only for OUT endpoints after each receipt
* and before any other operation.
* This function shall be used if the declared FIFO size is more than
* 255 bytes.
*----------------------------------------------------------------------------
* REQUIREMENTS:
*****************************************************************************/
Uint16 usb_get_nb_byte_epw (void)
{
  return ((((Uint16)UBYCTHX)<<8)|(UBYCTLX)); 
}

/*F**************************************************************************
* NAME: usb_send_ep0_packet
*----------------------------------------------------------------------------
* PARAMS:
* *tbuf:        address of the first data to send
* data_length:  number of bytes to send
* return:       address of the next Ucharto send
*----------------------------------------------------------------------------
* PURPOSE: 
* This function moves the data pointed by tbuf to the default Control
* endpoint fifo and sends it through the USB.
*----------------------------------------------------------------------------
* EXAMPLE:
* usb_send_ep0_packet(&first_data,0x20);  // send packet
* while(!(Usb_tx_complete));              // wait packet ACK'ed by the Host
* Usb_clear_tx_complete();                     // acknowledge the transmit
*----------------------------------------------------------------------------
* NOTE: 
* tbuf is incremented of 'data_length'.
*----------------------------------------------------------------------------
* REQUIREMENTS: 
*****************************************************************************/
Uchar* usb_send_ep0_packet (Uchar* tbuf, Uchar data_length)
{
  Usb_select_ep(0);

  for (; data_length-- ;  tbuf++)  { Usb_write_byte(*tbuf); }
  Usb_set_tx_ready();

  return tbuf;
}


/*F**************************************************************************
* NAME: usb_send_right_packet
*----------------------------------------------------------------------------
* PARAMS:
* ep_num:       number of the addressed endpoint
* *tbuf:        address of the first data to send
* data_length:  number of bytes to send
* return:       address of the next Uchar to send
*----------------------------------------------------------------------------
* PURPOSE: 
* This function moves the data pointed by tbuf to the selected endpoint fifo 
* and sends it through the USB.
*----------------------------------------------------------------------------
* EXAMPLE:
* usb_send_packet(3,&first_data,0x20);    // send packet on the endpoint #3
* while(!(Usb_tx_complete));              // wait packet ACK'ed by the Host
* Usb_clear_tx_complete();                     // acknowledge the transmit
*----------------------------------------------------------------------------
* NOTE:
* tbuf is incremented of 'data_length'.
*----------------------------------------------------------------------------
* REQUIREMENTS: 
*****************************************************************************/
Uchar* usb_send_right_packet ( Uchar * tbuf, Uchar data_length)
{
  for ( ; data_length-- ; tbuf++)  { Usb_write_byte(*tbuf); }
  Usb_set_tx_ready();

  return tbuf;
}


 

/*F**************************************************************************
* NAME: usb_read_packet
*----------------------------------------------------------------------------
* PARAMS:
* ep_num:       number of the addressed endpoint
* *rbuf:        address of the first data to write with the USB data
* data_length:  number of bytes to read
* return:       address of the next Ucharto send
*----------------------------------------------------------------------------
* PURPOSE: 
* This function moves the data stored in the selected endpoint fifo to 
* the address specified by *rbuf.
*----------------------------------------------------------------------------
* EXAMPLE:
* while(!(Usb_rx_complete));                      // wait new packet received
* usb_read_packet(4,&first_data,usb_get_nb_byte); // read packet from ep 4
* Usb_clear_rx();                                 // acknowledge the transmit
*----------------------------------------------------------------------------
* NOTE:
* rbuf is incremented of 'data_length'.
*----------------------------------------------------------------------------
* REQUIREMENTS: 
*****************************************************************************/
Uchar* usb_read_right_packet (Uchar* rbuf, Uchar data_length)
{
  for (; data_length-- ; rbuf++) { *rbuf = Usb_read_byte(); }

  return rbuf;
}

/*F**************************************************************************
* NAME: usb_halt_endpoint
*----------------------------------------------------------------------------
* PARAMS:
* ep_num:       number of the addressed endpoint
* return:       none
*----------------------------------------------------------------------------
* PURPOSE: 
* This function sends a STALL handshake for the next Host request. A STALL
* handshake will be send for each next request untill a SETUP or a Clear Halt
* Feature occurs for this endpoint.
*----------------------------------------------------------------------------
* EXAMPLE:
*----------------------------------------------------------------------------
* NOTE:
*----------------------------------------------------------------------------
* REQUIREMENTS: 
*****************************************************************************/
void usb_halt_endpoint (Uchar ep_num)
{
  Usb_select_ep(ep_num);
  UEPSTAX = 0x00;
  Usb_set_stall_request();
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
紧缚捆绑精品一区二区| 91麻豆高清视频| 亚洲第一久久影院| 亚洲视频中文字幕| 国产精品乱码人人做人人爱| 精品1区2区在线观看| 欧美一区欧美二区| 日韩一区二区三区观看| 91.com视频| 91精品久久久久久蜜臀| 欧美男同性恋视频网站| 欧美综合在线视频| 欧美亚洲综合另类| 国产成人在线免费观看| 久久精品国产久精国产| 蜜桃精品在线观看| 青草国产精品久久久久久| 日本亚洲最大的色成网站www| 国产精品的网站| 亚洲美女淫视频| 亚洲欧美国产高清| 亚洲精品高清在线| 亚洲国产成人av| 日韩av电影免费观看高清完整版 | 精品国产在天天线2019| 日韩欧美综合在线| 日韩欧美区一区二| 26uuu色噜噜精品一区| 久久蜜桃一区二区| 久久先锋资源网| 中文字幕二三区不卡| 国产麻豆91精品| 午夜久久久久久| 日本欧美一区二区在线观看| 久久99九九99精品| 国产mv日韩mv欧美| 91蜜桃网址入口| 欧美三级视频在线播放| 91精品国产综合久久蜜臀 | 国产欧美日韩麻豆91| 亚洲欧美日韩精品久久久久| 日韩电影在线免费看| 成人三级在线视频| 欧美天堂亚洲电影院在线播放 | 美女视频网站久久| 成人av电影免费观看| 欧美精品vⅰdeose4hd| 亚洲国产精品精华液2区45| 亚洲成人av资源| 国产成人免费在线| 欧美日韩亚洲综合在线| 欧美激情一区二区三区| 秋霞电影一区二区| 99vv1com这只有精品| 欧美一级一区二区| 亚洲人成伊人成综合网小说| 日本亚洲三级在线| 色婷婷综合激情| 国产视频亚洲色图| 青青青伊人色综合久久| 色婷婷激情一区二区三区| 久久中文娱乐网| 日韩主播视频在线| 色欧美日韩亚洲| 欧美极品xxx| 九色综合狠狠综合久久| 欧洲亚洲国产日韩| 国产精品不卡在线| 国模少妇一区二区三区| 欧美一区二区福利视频| 一区二区三区在线免费播放 | 日韩欧美二区三区| 亚洲图片自拍偷拍| 91啪亚洲精品| 欧美国产欧美亚州国产日韩mv天天看完整| 午夜av一区二区| 91丨porny丨国产| 日本一区二区视频在线观看| 欧美aaaaaa午夜精品| 精品视频在线视频| 日韩理论片中文av| 99久久久久久99| 中文av一区二区| 国产91精品一区二区麻豆亚洲| 日韩一区二区三区电影| 丝袜美腿高跟呻吟高潮一区| 欧美性欧美巨大黑白大战| 亚洲乱码中文字幕| 一本一道波多野结衣一区二区| 国产精品久久久久影院亚瑟| 国产成人精品亚洲777人妖| 久久综合九色欧美综合狠狠| 狠狠色丁香婷综合久久| 精品成人a区在线观看| 麻豆精品新av中文字幕| 91精品国产91综合久久蜜臀| 午夜不卡av免费| 7777精品伊人久久久大香线蕉经典版下载 | 亚洲成人av一区二区三区| 色婷婷亚洲精品| 亚洲自拍偷拍图区| 欧美日韩视频在线一区二区| 亚洲国产日韩a在线播放| 欧美婷婷六月丁香综合色| 亚洲成人免费观看| 欧美精品一卡两卡| 日本视频在线一区| 日韩美女主播在线视频一区二区三区 | 亚洲综合色丁香婷婷六月图片| 欧美在线播放高清精品| 亚洲国产中文字幕| 欧美一区二区三区白人| 蜜臀久久99精品久久久画质超高清| 欧美日韩国产123区| 男人的天堂亚洲一区| 精品粉嫩超白一线天av| 风间由美一区二区av101| 国产精品久久久久久久久快鸭| 99久久99久久久精品齐齐| 亚洲欧美日韩久久| 欧美日韩国产首页| 久久精品久久综合| 国产女同性恋一区二区| 99视频在线观看一区三区| 亚洲国产精品久久久久秋霞影院| 欧美精品aⅴ在线视频| 久久国产精品99精品国产 | 久久国产精品露脸对白| 久久久美女毛片| 91色porny| 日本欧美一区二区三区乱码| 久久久久国产成人精品亚洲午夜 | 777精品伊人久久久久大香线蕉| 精品一区二区在线视频| 中文子幕无线码一区tr| 欧美三级三级三级| 精品一区二区久久| 国产精品久久久久久亚洲毛片| 欧美在线你懂得| 国产一区二区精品在线观看| 亚洲色图制服诱惑 | 久久美女艺术照精彩视频福利播放| 成人不卡免费av| 亚洲成av人片一区二区| 久久久久久久久99精品| 91成人免费在线| 精一区二区三区| 亚洲蜜桃精久久久久久久| 日韩午夜精品视频| 色综合天天综合给合国产| 老鸭窝一区二区久久精品| 亚洲色图在线播放| 精品福利二区三区| 欧美视频一二三区| 国产成人精品在线看| 亚洲高清在线视频| 中文av一区二区| 日韩午夜av电影| 色妹子一区二区| 国产九色sp调教91| 午夜精品aaa| 国产精品免费aⅴ片在线观看| 欧美一级片在线看| 色天使色偷偷av一区二区| 国产精品2024| 麻豆极品一区二区三区| 亚洲精品成人悠悠色影视| 久久久久久久久蜜桃| 欧美一区二区在线免费观看| 色婷婷综合激情| 成人黄色小视频| 国产综合一区二区| 日韩影视精彩在线| 亚洲美女区一区| 欧美国产在线观看| 亚洲精品一区二区三区蜜桃下载| 欧美午夜不卡视频| 色综合久久久久综合体桃花网| 国产美女精品在线| 麻豆一区二区在线| 午夜精品爽啪视频| 一区二区三区在线看| 国产精品另类一区| 久久蜜桃av一区精品变态类天堂| 日韩一区二区不卡| 欧美久久一二三四区| 欧美性大战久久久久久久蜜臀| 99久久综合精品| 成人性视频网站| 国产乱理伦片在线观看夜一区| 欧美亚洲另类激情小说| 色综合咪咪久久| 91蜜桃传媒精品久久久一区二区| 国产精品一区三区| 国产精品白丝av| 国产一区二区三区视频在线播放| 美女视频免费一区| 久久激情五月激情| 麻豆国产精品一区二区三区| 日韩电影免费在线|