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

📄 usb_defs.h

📁 C89c51 usb驱动程序,实现了usb转串口的功能,提供了一个虚拟的串口
💻 H
字号:
/*H**************************************************************************
* NAME:         usb_defs.h
*----------------------------------------------------------------------------
* Copyright (c) 2003 Atmel.
*----------------------------------------------------------------------------
* RELEASE:      
* FILE_REV:     
*----------------------------------------------------------------------------
* PURPOSE:
* This file contains ANSI-compliant compiler pre-processor directives to  
* enable compilation of Atmel's USB firmware library source files...
* #include this file in: usb_dev.c, usb_vuart_lib.c, usb_cdc_enum.c (only).
*
* Modified by M.J. Bauer (2004-09-09) to support Hi-Tech C 8051.
*****************************************************************************/

#ifndef _USB_DEFS_H_
#define _USB_DEFS_H_

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


/*_____ D E C L A R A T I O N S ____________________________________________*/

typedef unsigned char       Uchar;
typedef float               Float16;

typedef unsigned char       Uint8;
typedef unsigned int        Uint16;
typedef unsigned long int   Uint32;

typedef char                Int8;
typedef int                 Int16;
typedef long int            Int32;

typedef unsigned char       Bool;
typedef unsigned char       Byte;
typedef unsigned int        Word;
typedef unsigned long int   DWord;

typedef union
{
  Uint32 l;
  Uint16 w[2];
  Uint8  b[4];
} Union32;

typedef union
{
  Uint16 w;
  Uint8  b[2];
} Union16;


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

/* General purpose defines */
#define  _ConstType_  const
/* Constants */
#define FALSE   0
#define TRUE    1
#define KO      0
#define OK      1
#define OFF     0
#define ON      1
#define CLR     0
#define SET     1

/* Bit and byte manipulations */
#define LOW(U16)                ((Uchar)(U16))
#define HIGH(U16)               ((Uchar)((U16)>>8))
#define TST_BIT_X(addrx,mask)   (*addrx & mask)
#define SET_BIT_X(addrx,mask)   (*addrx = (*addrx | mask))
#define CLR_BIT_X(addrx,mask)   (*addrx = (*addrx & ~mask))
#define OUT_X(addrx,value)      (*addrx = value)
#define IN_X(addrx)             (*addrx)

/* little endian conversion */
#define LE16(b) (((b & 0xFF) << 8) | ((b & 0xFF00) >> 8))
#define LE32(b) (((b & 0xFF) << 24) | ((b & 0xFF00) << 8) | \
                 ((b & 0xFF0000) >> 8) | ((b & 0xFF000000) >> 24))

/***********************************************************
 SET_SFR_BIT macro
  parameters
    sfr_reg : defined value in include file for sfr register
    bit_pos : defined value B_XX in include file for particular
              bit of sfr register
    bit_val : CLR / SET
************************************************************/
#define SET_SFR_BIT(sfr_reg, bit_pos, bit_val) \
        { sfr_reg &= ~(1<<(bit_pos)); sfr_reg |= ((bit_val)<<(bit_pos));}

/***********************************************************
 TST_SFR_BIT macro
  parameters
    sfr_reg : defined value in include file for sfr register
    bit_pos : defined value B_XX in include file for particular
              bit of sfr register
************************************************************/
#define TST_SFR_BIT(sfr_reg, bit_pos) ((sfr_reg & (1<<(bit_pos)))>>(bit_pos))


#endif /* _USB_DEFS_H_ */

⌨️ 快捷键说明

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