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

📄 usb_config.h

📁 C89c51 usb驱动程序,实现了usb转串口的功能,提供了一个虚拟的串口
💻 H
字号:
/*H**************************************************************************
* NAME:         usb_config.h
*----------------------------------------------------------------------------
* Copyright (c) 2003 Atmel.
*----------------------------------------------------------------------------
* RELEASE:      c5131-usb-cdc-1_0_1
* FILE_REV:     1.3
*----------------------------------------------------------------------------
* PURPOSE:
* File defines application-specific configuration of USB driver parameters.
* This firmware uses the standard USB "Communications Device Class" (CDC)
* param's, so that the host PC application software can access the device via
* a "virtual" COM port. (Windows 2000 and XP have built-in USB CDC drivers.)
*
* Atmel's USB-UART 'CDC' library provides functions to emulate UART behaviour,
* so that the application firmware can be made independent of the low-level
* USB protocol.
* #include this file in usb_dev.c, usb_vuart_lib.c, usb_cdc_enum.c.
*
* Originated by Atmel Corp. 2003.
* Modified and adapted to Hi-Tech C-8051 by M.J. Bauer (SEP.2004)
*****************************************************************************/

#ifndef _CONFIG_H_
#define _CONFIG_H_

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


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


/*_____ D E F I N I T I O N ________________________________________________*/


/* MCU Configuration  (NB: This file does not determine UART config for the application) */

#define FOSC                    16000           // must be 12000 or 16000 (KHz) in this version
#define CPUB_VERSION            0x0102
#define X2_MODE                                 // Allow use of c51 x2 mode feature
#define BAUDRATE                38400           // Can be 9600, 19200, 38400, 57600, or 115200
#define BDR_GENERATOR           BRG_INTERNAL    // Can be BRG_INTERNAL, BRG_TIMER1, or BRG_TIMER2
#define UART_MINIMUM

/* USB Configuration */
                                            /* DEVICE DESCRIPTOR */
#define USB_SPECIFICATION     0x1001
#define DEVICE_CLASS          0x02
#define DEVICE_SUB_CLASS      0
#define DEVICE_PROTOCOL       0
#define EP_CONTROL_LENGTH     32
#define VENDOR_ID             0xEB03        /* Atmel vendor ID = 03EBh */
#define PRODUCT_ID            0x0920        /* Product ID: 2009h = CDC C5131 */
#define RELEASE_NUMBER        0x0000
#define MAN_INDEX             0x00
#define PROD_INDEX            0x00
#define SN_INDEX              0x00
#define NB_CONFIGURATION      1

                                    /* CONFIGURATION DESCRIPTOR */
#define CONF_LENGTH           0x4300  // 3E00
#define NB_INTERFACE          2
#define CONF_NB               1
#define CONF_INDEX            0
#define CONF_ATTRIBUTES       USB_CONFIG_BUSPOWERED
#define MAX_POWER             50          /* 100 mA */
                                    /* INTERFACE 0 DESCRIPTOR */
#define INTERFACE0_NB          0
#define ALTERNATE0             0
#define NB_ENDPOINT0           1
#define INTERFACE0_CLASS       0x02 /* CDC ACM Comm */
#define INTERFACE0_SUB_CLASS   0x02
#define INTERFACE0_PROTOCOL    0x01
#define INTERFACE0_INDEX       0

                                    /* INTERFACE 1 DESCRIPTOR */
#define INTERFACE1_NB          1
#define ALTERNATE1             0
#define NB_ENDPOINT1           2
#define INTERFACE1_CLASS       0x0A /* CDC ACM Data */
#define INTERFACE1_SUB_CLASS   0
#define INTERFACE1_PROTOCOL    0
#define INTERFACE1_INDEX       0

                                    /* ENDPOINT 3 DESCRIPTOR */
#define ENDPOINT_NB_3         0x83
#define EP_ATTRIBUTES_3       0x03  // interrupt
#define EP_SIZE_3             ((Uint16)32) << 8
#define EP_INTERVAL_3         0x02

                                    /* ENDPOINT 1 DESCRIPTOR */
#define ENDPOINT_NB_1         0x81
#define EP_ATTRIBUTES_1       0x02  // bulk
#define EP_SIZE_1             ((Uint16)32) << 8
#define EP_INTERVAL_1         0x00

                                    /* ENDPOINT 2 DESCRIPTOR */
#define ENDPOINT_NB_2         0x02
#define EP_ATTRIBUTES_2       0x02  // bulk
#define EP_SIZE_2             ((Uint16)32) << 8
#define EP_INTERVAL_2         0x00



#define USB_MANUFACTURER_NAME {'A'<<8, 'T'<<8, 'M'<<8, 'E'<<8, 'L'<<8}
#define USB_MN_LENGTH         5
#define USB_PRODUCT_NAME      {'A'<<8, 'T'<<8, '8'<<8, '9'<<8, 'C'<<8, '5'<<8, '1'<<8, \
                               '3'<<8, '1'<<8, ' '<<8, \
                               'E'<<8, 'v'<<8, 'a'<<8, 'B'<<8, ' '<<8, \
                               'C'<<8, 'D'<<8, 'C'<<8, ' '<<8, \
                               'E'<<8, 'x'<<8, 'a'<<8, 'm'<<8, 'p'<<8, 'l'<<8, 'e'<<8 }

#define USB_PN_LENGTH         26
#define USB_SERIAL_NUMBER     {'1'<<8, '.'<<8, '0'<<8, '.'<<8, '0'<<8}
#define USB_SN_LENGTH         5

#define LANG_ID               0x00
#define LANGUAGE_ID           0x0904

#define EP_CONTROL            0x00
#define EP_IN                 0x01
#define EP_KBD_IN             EP_IN
#define EP_IN_LENGTH          64
#define ENDPOINT_0            0x00
#define ENDPOINT_1            0x81

#define RX_EP                 2
#define TX_EP                 1
#define TX_EP_SIZE            32




#endif /* _CONFIG_H_ */

⌨️ 快捷键说明

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