📄 conf_usb.h
字号:
//! @file conf_usb.h,v
//!
//! Copyright (c) 2006 Atmel.
//!
//! Please read file license.txt for copyright notice.
//!
//! This file contains the possible external configuration of the USB
//!
//!
//! @version 1.14 snd3-refd1-1_9_5 $Id: conf_usb.h,v 1.14 2007/10/08 13:43:17 sguyon Exp $
//!
//! @todo
//! @bug
#ifndef _CONF_USB_H_
#define _CONF_USB_H_
// _________________ DEVICE MODE CONFIGURATION ____________________________
//! @brief ENABLE to activate the device software library support
//! Possible values ENABLE or DISABLE
//! Note: If you change the device used then you must change the PID or uninstall the previous device on your PC
#define USB_DEVICE_FEATURE ENABLE // if enable then add ?CO?USB_DEVICE_SETUP in line BANK3 of player.lin to win a code commun space
#define USB_DEVICE_MS ENABLE // if enable then add ?CO?USB_DEVICE_MS in line BANK3 of player.lin to win a code commun space
#define USB_DEVICE_HID DISABLE // if enable then add ?CO?USB_DEVICE_HID_SETUP in line BANK3 of player.lin to win a code commun space
#define USB_DEVICE_CDC DISABLE // if enable then add ?CO?USB_DEVICE_CDC_SETUP in line BANK3 of player.lin to win a code commun space
#define USB_DEVICE_SPEED_HIGH ENABLE // enable = autorize HIGH and FULL speed, disable = autorize only FULL speed
// USB Device descriptor
#define USB_DEVICE_VENDOR_ID VID_ATMEL // You can't use ATMEL VID/PID for your final product
#define USB_DEVICE_PRODUCT_ID PID_AT8XC51SND3
#define USB_DEVICE_RELEASE_NUMBER 0x0100 // 1.00
#define USB_DEVICE_MANUFACTURER_NAME "ATMEL" // note: no specific size
#define USB_DEVICE_PRODUCT_NAME "AT85REFD-07" // note: no specific size
#define USB_DEVICE_SERIAL_NUMBER "12345" // note: no specific size
#define USB_DEVICE_MAX_POWER 50 // 100 mA (unit 2mA)
// USB Device Mass storage description
#define USB_DEVICE_MS_NAME_INTERFACE "mass storage ATMEL"
#define USB_DEVICE_MS_VENDOR {'A','T','M','E','L',' ',' ',' '} // 8 Bytes mandatory
#define USB_DEVICE_MS_PRODUCT {'A','T','8','5','R','E','F','D','-','0','7',' ','M',' ','S',' '} // 16 Bytes mandatory
#define USB_DEVICE_MS_REVISION {'1','.','0','0'} // 4 Bytes mandatory
#define USB_PWD_FEATURE DISABLE // ENABLE/DISABLE securization access mechanism via specific mass storage command
#define USB_PWD_FORMAT DISABLE // (ignore if USB_PWD_FEATURE = DISABLE ) ENABLE/DISABLE automatique format after PWD_NB_BAD_LOG login try
// USB Device HID description
#define USB_DEVICE_HID_NAME_INTERFACE "HID ATMEL"
#define USB_DEVICE_HID_MODE USB_DEVICE_HID_MODE_MOUSE // USB_DEVICE_HID_MODE_MOUSE or USB_DEVICE_HID_MODE_KBD
// USB Device CDC description
#define USB_DEVICE_CDC_DATA_NAME_INTERFACE "CDC DATA ATMEL"
#define USB_DEVICE_CDC_COM_NAME_INTERFACE "CDC COM ATMEL"
#if( USB_DEVICE_CDC == ENABLE )
# define USB_DEVICE_CDC_COM ENABLE // enable/disable control serial COM (mandatory for Windows CDC driver)
#else
# define USB_DEVICE_CDC_COM DISABLE // if CDC disable then control CDC disable
#endif
// _________________ HOST MODE CONFIGURATION ____________________________
//! @brief ENABLE to activate the host software library support
//!
//! Possible values ENABLE or DISABLE
#define USB_HOST_FEATURE ENABLE
#define USB_HOST_HUB_SUPPORT DISABLE//ENABLE
#define USB_HOST_MS_SUPPORT ENABLE
#define USB_HOST_HID_SUPPORT DISABLE//ENABLE
#define USB_HOST_CDC_SUPPORT DISABLE // if enable then add ?CO?USB_HOST_CDC_SETUP in line BANK9 and add ?CO?MMI_CDC,of player.lin in line BANK4, to win a code commun space
// ________________________________________________________________________
// _____________________ CONFIGURATION LOW LEVEL _________________________
// _________________ COMMUN MODE ____________________________
#define USB_ID_PIN_CHANGE_GENERATE_RESET DISABLE //! Enable = Force WDT reset upon ID pin change
#define USB_DEVICE_AUTO_START DISABLE //! Enable = Start usb device automatique when VBUS dectected
// _________________ DEVICE MODE CONFIGURATION LOW ____________________________
//! Link Mass storage on interface 1
#define USB_DEVICE_INTER_1 USB_DEVICE_MS
#if ( USB_DEVICE_MS == ENABLED )
#define USB_DEVICE_INTER_1_FILL_DESC usb_device_ms_fill_desc
#define USB_DEVICE_INTER_1_ENDPOINT_INIT usb_device_ms_endpoint_init
#define USB_DEVICE_INTER_1_CTRL_REQUEST usb_device_ms_ctrl_request
#define USB_DEVICE_INTER_1_INIT usb_device_ms_init
#define USB_DEVICE_INTER_1_TASK usb_device_ms_task
#define USB_DEVICE_INTER_1_STOP()
#define USB_DEVICE_INTER_1_STRING USB_DEVICE_MS_NAME_INTERFACE
#include "modules\usb\device_drivers\usb_device_ms_setup.h"
#include "modules\usb\device_drivers\usb_device_ms.h"
#define USB_DEVICE_INTER_1_ENDPOINT 2
#else
#define USB_DEVICE_INTER_1_ENDPOINT 0
#endif
//! Link HID on interface 2
#define USB_DEVICE_INTER_2 USB_DEVICE_HID
#if ( USB_DEVICE_HID == ENABLED )
#define USB_DEVICE_INTER_2_FILL_DESC usb_device_hid_fill_desc
#define USB_DEVICE_INTER_2_ENDPOINT_INIT usb_device_hid_endpoint_init
#define USB_DEVICE_INTER_2_CTRL_REQUEST usb_device_hid_ctrl_request
#define USB_DEVICE_INTER_2_INIT usb_device_hid_init
#define USB_DEVICE_INTER_2_TASK usb_device_hid_task
#define USB_DEVICE_INTER_2_STOP()
#define USB_DEVICE_INTER_2_STRING USB_DEVICE_HID_NAME_INTERFACE
#include "modules\usb\device_drivers\usb_device_hid_setup.h"
#include "modules\usb\device_drivers\usb_device_hid.h"
#define USB_DEVICE_INTER_2_ENDPOINT 1
#else
#define USB_DEVICE_INTER_2_ENDPOINT 0
#endif
// Define FLAG for HID compile
#define USB_DEVICE_HID_MODE_MOUSE 0
#define USB_DEVICE_HID_MODE_KBD 1
//! Link CDC COM on interface 3
#define USB_DEVICE_INTER_3 USB_DEVICE_CDC_COM
#if ( USB_DEVICE_CDC_COM == ENABLED )
#define USB_DEVICE_INTER_3_FILL_DESC usb_device_cdc_com_fill_desc
#define USB_DEVICE_INTER_3_ENDPOINT_INIT usb_device_cdc_endpoint_init
#define USB_DEVICE_INTER_3_CTRL_REQUEST usb_device_cdc_com_ctrl_request
#define USB_DEVICE_INTER_3_INIT()
#define USB_DEVICE_INTER_3_TASK usb_device_cdc_com_task
#define USB_DEVICE_INTER_3_STOP()
#define USB_DEVICE_INTER_3_STRING USB_DEVICE_CDC_COM_NAME_INTERFACE
#define USB_DEVICE_INTER_3_ENDPOINT 1 // Interrupt endpoint of control enable
#else
#define USB_DEVICE_INTER_3_ENDPOINT 0
#endif
//! Link CDC on interface 4
#define USB_DEVICE_INTER_4 USB_DEVICE_CDC
#if ( USB_DEVICE_CDC == ENABLED )
#define USB_DEVICE_INTER_4_FILL_DESC usb_device_cdc_fill_desc
#define USB_DEVICE_INTER_4_ENDPOINT_INIT usb_device_cdc_com_endpoint_init
#define USB_DEVICE_INTER_4_CTRL_REQUEST usb_device_cdc_ctrl_request
#define USB_DEVICE_INTER_4_INIT usb_device_cdc_init
#define USB_DEVICE_INTER_4_TASK usb_device_cdc_task
#define USB_DEVICE_INTER_4_STOP()
#define USB_DEVICE_INTER_4_STRING USB_DEVICE_CDC_DATA_NAME_INTERFACE
#include "modules\usb\device_drivers\usb_device_cdc_setup.h"
#include "modules\usb\device_drivers\usb_device_cdc.h"
#define USB_DEVICE_INTER_4_ENDPOINT 2
#else
#define USB_DEVICE_INTER_4_ENDPOINT 0
#endif
//! NO Link on interface 5
#define USB_DEVICE_INTER_5 FALSE
#define USB_DEVICE_INTER_5_ENDPOINT 0
// Compute and check the total of endpoints
#define USB_DEVICE_MAX_ENDPOINT (USB_DEVICE_INTER_1_ENDPOINT + USB_DEVICE_INTER_2_ENDPOINT + USB_DEVICE_INTER_3_ENDPOINT + USB_DEVICE_INTER_4_ENDPOINT + USB_DEVICE_INTER_5_ENDPOINT)
#if( USB_DEVICE_MAX_ENDPOINT > 6 )
# error Too many endpoint on usb device mode
#endif
// _________________ HOST MODE CONFIGURATION LOW ____________________________
//! The host controller will be limited to the strict VID/PID list.
//! When enabled, if the device PID/VID does not belongs to the supported list,
//! the host controller library will not go to deeper configuration, but to error state.
#define HOST_STRICT_VID_PID_TABLE DISABLE
//! This table contains the VID/PID that are supported by the reduced host application
//! VID_PID_TABLE format definition:
//! #define VID_PID_TABLE {VID1, number_of_pid_for_this_VID1, PID11_value,..., PID1X_Value \n
//! ...\n
//! ,VIDz, number_of_pid_for_this_VIDz, PIDz1_value,..., PIDzX_Value}
#define VID_PID_TABLE {VID_ATMEL, 3, PID_AT89C51SND1, PID_AT89C51SND2, PID_AT8XC51SND3 \
,0x0123, 3, 0x2000, 0x2100, 0x1258}
//! The maximum number of devices in the USB tree
#if (USB_HOST_HUB_SUPPORT == ENABLE)
# define HOST_MAX_DEVICE 3
#else
# define HOST_MAX_DEVICE 1
#endif
//! The maximum number of interface supported per device
#define HOST_MAX_INTER_PER_DEVICE 2
//! The maximum number of endpoints per interface supported
#define HOST_MAX_EP_PER_INTER 3
//! The maximum number of Interrupt endpoints
#define HOST_MAX_IT_PIPE 2
//! Host start of frame interrupt always enable
#define HOST_CONTINUOUS_SOF_INTERRUPT DISABLE
//! timeout on pipe IN
#define HOST_TIMEOUT_DELAY 4000 // specific key have a delay of 270ms and iPod 3s on First Read Capacity
//! Enable to force the end of install before usb task exit
#define HOST_INSTALL_DEVICE_FREEZE ENABLE
// _________________ HOST HUB
//! Hub configuration
#define HOST_HUB_MAX 2
#define HOST_HUB_MAX_PORT_PER_DEVICE 4
// _________________ HOST MASS STORAGE
//! Link on driver 1
#define HOST_DRIVER_1 USB_HOST_MS_SUPPORT
#define HOST_DRIVER_1_RESET usb_host_ms_setup_reset
#define HOST_DRIVER_1_CHECK_CLASS usb_host_ms_setup_check_class
#define HOST_DRIVER_1_SPECIFIC_DESCRIPTOR( id_desc )
#define HOST_DRIVER_1_INIT_INTERFACE usb_host_ms_setup_init_interface
#define HOST_DRIVER_1_REMOVE_DEVICE usb_host_ms_setup_remove_device
#define HOST_DRIVER_1_IT_PIPE() // No interrupt pipe for mass storage driver
//! Configuration
#if (USB_HOST_HUB_SUPPORT == ENABLE)
# define HOST_MS_MAX_DEVICE 2 // Max two U-Disk is possible (endpoint limitation)
#else
# define HOST_MS_MAX_DEVICE 1 // Max one U-Disk is possible (no HUB = one device)
#endif
#define HOST_MS_MAX_LUN 4 // The maximum is 8, it is structure limitation (u8_lun_protected)
#include "modules\usb\host_drivers\usb_host_ms.h"
#include "modules\usb\host_drivers\usb_host_ms_setup.h"
// _________________ HOST HID
//! Link on driver 2
#define HOST_DRIVER_2 USB_HOST_HID_SUPPORT
#define HOST_DRIVER_2_RESET usb_host_hid_setup_reset
#define HOST_DRIVER_2_CHECK_CLASS usb_host_hid_setup_check_class
#define HOST_DRIVER_2_SPECIFIC_DESCRIPTOR( id_desc )
#define HOST_DRIVER_2_INIT_INTERFACE usb_host_hid_setup_init_interface
#define HOST_DRIVER_2_REMOVE_DEVICE usb_host_hid_setup_remove_device
#define HOST_DRIVER_2_IT_PIPE usb_host_hid_it_pipe
//! Configuration
#define USB_HOST_HID_SUPPORT_SPECIFIC DISABLE // Enable, You shall completed the specific part HID (search define USB_HOST_HID_SUPPORT_SPECIFIC)
#if (USB_HOST_HUB_SUPPORT==ENABLE)
#define HOST_HID_MAX_DEVICE 4 // >5 no possible, maximum 6 endpoint on hardware - 1 hub
#else
#define HOST_HID_MAX_DEVICE 1 // without HUB, only one device is possible
#endif
#include "modules\usb\host_drivers\usb_host_hid.h"
#include "modules\usb\host_drivers\usb_host_hid_setup.h"
// _________________ HOST CDC
#define USB_HOST_CDC_SUPPORT_OTHER ENABLE
//! Link on driver 3
#define HOST_DRIVER_3 USB_HOST_CDC_SUPPORT
#define HOST_DRIVER_3_RESET usb_host_cdc_setup_reset
#define HOST_DRIVER_3_CHECK_CLASS usb_host_cdc_setup_check_class
#define HOST_DRIVER_3_SPECIFIC_DESCRIPTOR( id_desc )
#define HOST_DRIVER_3_INIT_INTERFACE usb_host_cdc_setup_init_interface
#define HOST_DRIVER_3_REMOVE_DEVICE usb_host_cdc_setup_remove_device
#define HOST_DRIVER_3_IT_PIPE usb_host_cdc_it_pipe
//! Configuration
#define USB_HOST_CDC_SUPPORT_SPECIFIC DISABLE // Enable, You shall completed the specific part CDC (search define USB_HOST_CDC_SUPPORT_SPECIFIC)
#if (USB_HOST_HUB_SUPPORT==ENABLE)
#define HOST_CDC_MAX_DEVICE 4 // >5 no possible, maximum 6 endpoint on hardware - 1 hub
#else
#define HOST_CDC_MAX_DEVICE 1 // without HUB, only one device is possible
#endif
#include "modules\usb\host_drivers\usb_host_cdc.h"
#include "modules\usb\host_drivers\usb_host_cdc_setup.h"
// _________________ HOST other driver
//! Link on driver 4
#define HOST_DRIVER_4 DISABLE
#endif // _CONF_USB_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -