⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usb.html

📁 at89c5132,at89c51snd1的usb与keyboard驱动程序。
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML><HEAD> <META NAME="GENERATOR" CONTENT="langdoc 1.0.1"> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <TITLE> C51 USB Library </TITLE> </HEAD> <BODY> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="6"> <TR> <TD ALIGN=CENTER VALIGN=MIDDLE BGCOLOR=BLUE> <H1> <FONT COLOR="#FFFFFF"> C51 USB Library </FONT> </H1> </TD> </TR> </TABLE><P ALIGN=RIGHT> <I></I> </P><H2> Library Usage </H2><H3> Package Description </H3><H3> Package Summary </H3><H4> Constants </H4><PRE></PRE><H4> Global Variables </H4><PRE></PRE><H4> Macros </H4><PRE>USB clock management <A HREF="#wSWAP">wSWAP</A> </PRE><H4> Functions </H4><PRE><A HREF="#configure_usb_clock">configure_usb_clock</A> <A HREF="#usb_configure_endpoint">usb_configure_endpoint</A> <A HREF="#usb_get_nb_byte">usb_get_nb_byte</A> <A HREF="#usb_get_nb_byte_epw">usb_get_nb_byte_epw</A> <A HREF="#usb_halt_endpoint">usb_halt_endpoint</A> <A HREF="#usb_read_packet">usb_read_packet</A> <A HREF="#usb_reset_endpoint">usb_reset_endpoint</A> <A HREF="#usb_select_endpoint_interrupt">usb_select_endpoint_interrupt</A> <A HREF="#usb_send_ep0_packet">usb_send_ep0_packet</A> <A HREF="#usb_send_packet">usb_send_packet</A> </PRE><H3> Files List </H3><UL><LI><B><A NAME="usb_drv.c"></A> usb_drv.c</B><BR></LI><UL>This file contains the USB driver routines.</UL><LI><B><A NAME="usb_drv.h"></A> usb_drv.h</B><BR></LI><UL>This file contains the USB low level driver definition</UL></UL><H3> Included Files </H3><UL><LI><B>config.h </B><BR></LI><LI><B><A HREF="#usb_drv.h">usb_drv.h</A> </B><BR></LI></UL><H2> Constant Macros </H2><H2> Global Variables </H2><H2> Function Macros </H2><A NAME="USB clock management"></A><H3> USB clock management </H3><TABLE BORDER="0"  WIDTH="100 %"  BGCOLOR="#D6E8FF"  CELLPADDING="6"><TR> <TD VALIGN=MIDDLE><PRE>#define Usb_set_EXT48 (  )                 ( PLLCON |= MSK_EXT48 )  </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>#define Usb_clear_EXT48 (  )               ( PLLCON &= ~MSK_EXT48 )  </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE></PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>#define Pll_stop (  )                      ( PLLCON &= ~MSK_PLLEN )  </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>#define Pll_set_div ( n )                  ( PLLDIV = n )  </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>#define Pll_enable (  )                    ( PLLCON |= MSK_PLLEN )  </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE></PRE></TD><TR> <TD VALIGN=MIDDLE><PRE></PRE></TD><TR> <TD VALIGN=MIDDLE><PRE></PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>/ * _____ D E C L A R A T I O N ______________________________________________ * / </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE></PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>void    <A HREF="#usb_configure_endpoint">usb_configure_endpoint</A>        ( Uchar  ,  Uchar ) ; </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>Uchar   <A HREF="#usb_get_nb_byte">usb_get_nb_byte</A>               ( void ) ; </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>Uint16  <A HREF="#usb_get_nb_byte_epw">usb_get_nb_byte_epw</A>           ( void ) ; </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>Uchar *   <A HREF="#usb_send_ep0_packet">usb_send_ep0_packet</A>           ( Uchar *  ,  Uchar ) ; </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>Uchar *   <A HREF="#usb_send_packet">usb_send_packet</A>               ( Uchar  ,  Uchar *  ,  Uchar ) ; </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>Uchar *   <A HREF="#usb_read_packet">usb_read_packet</A>               ( Uchar  ,  Uchar *  ,  Uchar ) ; </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>void    <A HREF="#usb_reset_endpoint">usb_reset_endpoint</A>            ( Uchar ) ; </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>Uchar   usb_select_enpoint_interrupt  ( void ) ; </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>void    <A HREF="#usb_halt_endpoint">usb_halt_endpoint</A>             ( Uchar ) ; </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>void    <A HREF="#configure_usb_clock">configure_usb_clock</A>           ( void ) ; </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE></PRE></TD><TR> <TD VALIGN=MIDDLE><PRE></PRE></TD><TR> <TD VALIGN=MIDDLE><PRE></PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>#endif  / *  _USB_DRV_H_  * / </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE></PRE></TD></TABLE><P>These macros manage the USB clock.<P><HR><A NAME="wSWAP"></A><H3> wSWAP </H3><TABLE BORDER="0"  WIDTH="100 %"  BGCOLOR="#D6E8FF"  CELLPADDING="6"><TR> <TD VALIGN=MIDDLE><PRE>#define <A HREF="#wSWAP">wSWAP</A> ( x )   (  (  (  ( x ) >>8 ) &0x00FF ) | (  (  ( x ) <<8 ) &0xFF00 )  )  ; </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE></PRE></TD><TR> <TD VALIGN=MIDDLE><PRE></PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>/ * M *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> *  NAME: dwSWAP </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> * ---------------------------------------------------------------------------- </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> *  PARAMS: </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> *  x     :  ( Uint32 )  the 32 bit double word to swap </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> *  return:  ( Uint32 )  the 32 bit double word x with the 4 bytes swaped </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> * ---------------------------------------------------------------------------- </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> *  PURPOSE: </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> *  This macro swaps the Uchar order in double words. </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> * ---------------------------------------------------------------------------- </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> *  EXAMPLE: </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> * ---------------------------------------------------------------------------- </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> *  NOTE: </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> * ---------------------------------------------------------------------------- </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> *  REQUIREMENTS: </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * / </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>#define dwSWAP ( x )   (  (  (  ( x ) >>24 ) &0x000000FF ) | (  (  ( x ) >>8 ) &0x0000FF00 ) | (  (  ( x ) <<24 ) &0xFF000000 ) | (  (  ( x ) <<8 ) &0x00FF0000 )  )  </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE></PRE></TD><TR> <TD VALIGN=MIDDLE><PRE></PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>/ * M *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> *  NAME: General endpoint management </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> * ---------------------------------------------------------------------------- </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> *  PARAMS: </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> * ---------------------------------------------------------------------------- </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> *  PURPOSE: </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> *  These macros manage the common features of the endpoints </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> * ---------------------------------------------------------------------------- </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> *  EXAMPLE: </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> * ---------------------------------------------------------------------------- </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> *  NOTE: </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> * ---------------------------------------------------------------------------- </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> *  REQUIREMENTS: </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * / </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>#define Usb_select_ep ( e )                ( UEPNUM = e )  </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>#define Usb_configure_ep_type ( x )        ( UEPCONX = x )  </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>#define Usb_set_stall_request (  )         ( UEPSTAX |= MSK_STALLRQ )  </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>#define Usb_clear_stall_request (  )       ( UEPSTAX &= ~MSK_STALLRQ )  </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>#define Usb_clear_stalled (  )             ( UEPSTAX &= ~MSK_STALLED )  </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>#define Usb_stall_requested (  )           ( UEPSTAX & MSK_STALLRQ )  </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>#define Usb_stall_sent (  )                ( UEPSTAX & MSK_STALLED )  </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>#define Usb_read_byte (  )                 ( UEPDATX )  </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>#define Usb_write_byte ( x )               ( UEPDATX = x )  </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>#define Usb_endpoint_interrupt (  )        ( UEPINT != 0  )  </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE></PRE></TD><TR> <TD VALIGN=MIDDLE><PRE></PRE></TD><TR> <TD VALIGN=MIDDLE><PRE>/ * M *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> *  NAME: OUT endpoint management </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> * ---------------------------------------------------------------------------- </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> *  PARAMS: </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> * ---------------------------------------------------------------------------- </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> *  PURPOSE: </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> *  These macros manage the OUT endpoints. </PRE></TD><TR> <TD VALIGN=MIDDLE><PRE> * ---------------------------------------------------------------------------- </PRE></TD>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -