亚洲欧美第一页_禁久久精品乱码_粉嫩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在线视频观看| 波多野结衣中文一区| 国产成人亚洲综合a∨猫咪| 国产精品夜夜嗨| 国产乱子伦视频一区二区三区| 国内久久婷婷综合| 国产精品99久久久久久久vr | 欧美日韩亚洲综合| 欧美日韩国产电影| 制服丝袜中文字幕一区| 欧美一二三四在线| 精品国产电影一区二区| 久久久91精品国产一区二区精品| 久久久国产精品午夜一区ai换脸| 国产日韩欧美麻豆| 1区2区3区欧美| 亚洲成人免费在线观看| 日韩av一区二区在线影视| 欧美aaaaa成人免费观看视频| 六月丁香婷婷色狠狠久久| 国产精品 欧美精品| 成人综合激情网| 色老汉一区二区三区| 69堂亚洲精品首页| 精品嫩草影院久久| 亚洲国产精华液网站w| 亚洲欧美另类久久久精品2019| 亚洲不卡av一区二区三区| 裸体一区二区三区| 成人自拍视频在线| 91国在线观看| 欧美大片日本大片免费观看| 国产日韩欧美精品综合| 亚洲综合另类小说| 精品一区二区在线看| 不卡av免费在线观看| 欧美日韩国产高清一区| 久久久亚洲国产美女国产盗摄 | 国产黑丝在线一区二区三区| 91女人视频在线观看| 欧美日韩精品高清| 久久综合九色综合欧美98| 亚洲人成网站在线| 偷拍亚洲欧洲综合| 国产高清一区日本| 精品视频色一区| 国产视频一区不卡| 日日摸夜夜添夜夜添精品视频 | 国产99精品在线观看| 欧美少妇一区二区| 国产日韩欧美综合在线| 亚洲国产日韩a在线播放| 国产精品综合久久| 欧美日韩国产免费一区二区 | 麻豆视频一区二区| 91久久精品日日躁夜夜躁欧美| 欧美成人一级视频| 一区二区三区欧美| 国产麻豆精品在线观看| 欧美午夜精品免费| 国产精品久久夜| 久久er精品视频| 欧美色综合网站| 国产精品网站在线观看| 麻豆精品视频在线观看免费| 色综合欧美在线视频区| 久久精品欧美一区二区三区不卡| 亚洲成人av电影在线| www.av精品| 久久五月婷婷丁香社区| 日韩精品视频网站| 在线观看视频91| 综合av第一页| 成人午夜精品在线| 2022国产精品视频| 日本欧美一区二区在线观看| 91在线一区二区| 国产女同性恋一区二区| 国内成人免费视频| 欧美一级欧美三级| 亚洲高清在线视频| 欧美中文一区二区三区| 国产精品免费视频一区| 国产裸体歌舞团一区二区| 日韩一区二区在线看| 亚洲成人激情自拍| 在线精品视频一区二区| 亚洲欧美日韩在线| 91美女片黄在线观看| 国产精品二三区| 成人激情综合网站| 欧美国产一区二区| 国产·精品毛片| 久久久精品免费免费| 国产一区二区三区av电影| 欧美一级精品在线| 免费观看一级欧美片| 日韩一区二区在线观看| 日欧美一区二区| 欧美精品视频www在线观看| 偷拍与自拍一区| 欧美精品777| 男男成人高潮片免费网站| 日韩一卡二卡三卡四卡| 蜜桃精品视频在线| 日韩一区二区免费在线电影 | 欧美一区二视频| 日韩黄色一级片| 日韩限制级电影在线观看| 蜜桃91丨九色丨蝌蚪91桃色| 精品日韩欧美一区二区| 国产精品一区二区在线观看不卡| 国产欧美日韩在线| 97精品国产露脸对白| 夜夜嗨av一区二区三区| 欧美日韩一级黄| 久久机这里只有精品| 2014亚洲片线观看视频免费| 国产a久久麻豆| 亚洲视频在线一区| 在线观看av不卡| 五月婷婷综合激情| 欧美mv日韩mv国产网站app| 国产乱码一区二区三区| 国产精品国模大尺度视频| 91久久人澡人人添人人爽欧美 | 成人精品鲁一区一区二区| 中文字幕在线不卡一区 | 国产欧美日韩亚州综合 | 欧美色网一区二区| 久热成人在线视频| 国产蜜臀av在线一区二区三区| 成人黄色av电影| 亚洲永久精品国产| 欧美α欧美αv大片| 成人黄色免费短视频| 亚洲成人av福利| 久久新电视剧免费观看| 色综合欧美在线视频区| 美女一区二区在线观看| 国产精品日韩成人| 欧美高清视频一二三区| 国产成人免费9x9x人网站视频| 亚洲狠狠丁香婷婷综合久久久| 欧美一三区三区四区免费在线看| 国产成人免费av在线| 亚洲成人自拍偷拍| 国产欧美精品在线观看| 欧美日韩国产一区| 国产精品一线二线三线| 亚洲一区影音先锋| 国产欧美中文在线| 欧美日韩成人综合天天影院| 国产精品18久久久久久久久久久久 | 欧美一级生活片| 一本久道久久综合中文字幕| 欧美aaaaaa午夜精品| 亚洲蜜臀av乱码久久精品| 26uuu亚洲综合色欧美| 欧美色图在线观看| 成人av第一页| 久久精品国产精品亚洲综合| 一区二区三区在线影院| 久久久久国产精品厨房| 欧美久久一区二区| www.在线欧美| 国产一区二区0| 五月开心婷婷久久| 亚洲天堂网中文字| 久久久久国产成人精品亚洲午夜| 欧美羞羞免费网站| 93久久精品日日躁夜夜躁欧美| 狠狠色狠狠色综合日日91app| 午夜欧美大尺度福利影院在线看| 国产精品毛片大码女人| 26uuu精品一区二区| 制服丝袜亚洲播放| 欧洲av一区二区嗯嗯嗯啊| 岛国av在线一区| 国产久卡久卡久卡久卡视频精品| 欧美aⅴ一区二区三区视频| 亚洲午夜激情av| 玉足女爽爽91| 中文字幕在线观看不卡视频| 国产欧美日韩在线| 久久九九影视网| 久久综合色播五月| 精品少妇一区二区三区免费观看| 7777女厕盗摄久久久| 欧美色图免费看| 91精品91久久久中77777| 一本色道亚洲精品aⅴ| 懂色av一区二区三区蜜臀| 国产99久久久国产精品潘金| 国产黄色成人av| 国产成人啪免费观看软件| 国产黄色精品视频| 国产iv一区二区三区|