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

📄 conf_usb.h

📁 ATMEL 90usb128 USB source,include USB protocol stack.
💻 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.5 at90usb128-usbkey-demo-3enum-host-mouse-1_0_4 $Id: conf_usb.h,v 1.5 2006/07/12 14:58:56 rletendu Exp $
//!
//! @todo
//! @bug
#ifndef _CONF_USB_H_
#define _CONF_USB_H_

//! @defgroup usb_general_conf USB application configuration
//!
//! @{


   // _________________ USB MODE CONFIGURATION ____________________________
   //
   //! @defgroup USB_op_mode USB operating modes configuration
   //! defines to enable device or host usb operating modes
   //! supported by the application
   //! @{

      //! @brief ENABLE to activate the host software library support
      //!
      //! Possible values ENABLE or DISABLE
      #define USB_HOST_FEATURE            ENABLED

      //! @brief ENABLE to activate the device software library support
      //!
      //! Possible values ENABLE or DISABLE
      #define USB_DEVICE_FEATURE          ENABLED

   //! @}

   // _________________ USB REGULATOR CONFIGURATION _______________________
   //
   //! @defgroup USB_reg_mode USB regulator configuration
   //! @{

   //! @brief Enable the internal regulator for USB pads
   //!
   //! When the application voltage is lower than 3.5V, to optimize power consumption
   //! the internal USB pads regulatr can be disabled.
#ifndef USE_USB_PADS_REGULATOR
   #define USE_USB_PADS_REGULATOR   ENABLE      // Possible values ENABLE or DISABLE
#endif
   //! @}

   // _________________ HOST MODE CONFIGURATION ____________________________
   //
   //! @defgroup USB_host_mode_cfg USB host operating mode configuration
   //!
   //! @{

   #define HID_CLASS          0x03
   #define MS_CLASS           0x08
   #define NO_SUBCLASS        0x00
   #define BOOT_SUBCLASS      0x01
   #define MOUSE_PROTOCOL     0x02
   #define NO_PROTOCOL        0x00

#define PIPE_MOUSE_IN  pipe_mouse_in
extern U8  pipe_ms_in;
   //!   @brief VID/PID supported table list
   //!
   //!   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            {0x03EB, 2, 0x201C, 0x2014 \
                                 ,0x0123, 3, 0x2000, 0x2100, 0x1258}
   //!   @brief CLASS/SUBCLASS_PROTOCOL supported table list
   //!
   //!   This table contains the CLASS/SUBCLASS/PROTOCOL that is supported by the reduced host application
   //!   This table definition allows to extended the reduced application device support to an entire Class/
   //!   /subclass/protocol instead of a simple VID/PID table list.
   //!
   //!   CLASS_SUBCLASS_PROTOCOL format definition: \n
   //!   #define CLASS_SUBCLASS_PROTOCOL  {CLASS1, SUB_CLASS1,PROTOCOL1, \n
   //!                                     ...\n
   //!                                     CLASSz, SUB_CLASSz,PROTOCOLz}
   #define CLASS_SUBCLASS_PROTOCOL  {HID_CLASS, 0x00, 0x02, \
                                  HID_CLASS, 0x01, 0x02}


   //! The size of RAM buffer reserved of descriptors manipulation
   #define SIZEOF_DATA_STAGE        250

   //! The address that will be assigned to the connected device
   #define DEVICE_ADDRESS           0x05

   //! The maximum number of interface that can be supported (composite device)
   #define MAX_INTERFACE_SUPPORTED  0x01

   //! The maximum number of endpoints per interface supported
   #define MAX_EP_PER_INTERFACE     2

   //! 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

   //! Try to configure the host pipe according to the device descriptors received
   #define HOST_AUTO_CFG_ENDPOINT         ENABLE

   //! Host start of frame interrupt always enable
   #define HOST_CONTINUOUS_SOF_INTERRUPT  DISABLE

   //! When Host error state detected, goto unattached state
   #define HOST_ERROR_RESTART             ENABLE

   //! USB host pipes transfers use USB communication interrupt (allows to use none blocking functions)
   #define USB_HOST_PIPE_INTERRUPT_TRANSFER  ENABLE

   //! Force WDT reset upon ID pin change
   #define ID_PIN_CHANGE_GENERATE_RESET   ENABLE

   //! Enable Timeout delay (time) for host transfer
   #define TIMEOUT_DELAY_ENABLE           ENABLE

   //! delay 1/4sec (250ms) before timeout value
   #define TIMEOUT_DELAY               10

   //! Enable cpt NAK Timeout for host transfer
   #define NAK_TIMEOUT_ENABLE          DISABLE

   //! Number of NAK handshake before timeout for transmit functions (up to 0xFFFF)
   #define NAK_SEND_TIMEOUT            0x0FFF

   //! NAKNumber of NAK handshake before timeout for receive functions (up to 0xFFFF)
   #define NAK_RECEIVE_TIMEOUT         0x0FFF

   //! For reduced host only allows to control VBUS generator with PIO PE.7
   #define SOFTWARE_VBUS_CTRL          ENABLE

   #if (HOST_AUTO_CFG_ENDPOINT==FALSE)
      //! If no auto configuration of EP, map here user function
      #define        User_configure_endpoint()
   #endif

   //! @defgroup host_cst_actions USB host custom actions
   //!
   //! @{
   // write here the action to associate to each USB host event
   // be carefull not to waste time in order not disturbing the functions
   #define Usb_id_transition_action()
   #define Host_device_disconnection_action()
   #define Host_device_connection_action()
   #define Host_sof_action()
   #define Host_suspend_action()                      host_suspend_action();
   #define Host_hwup_action()
   #define Host_device_not_supported_action()
   #define Host_device_supported_action()
   #define Host_device_error_action()
   //! @}

extern void host_suspend_action(void);
   //! @}


// _________________ DEVICE MODE CONFIGURATION __________________________

   //! @defgroup USB_device_mode_cfg USB device operating mode configuration
   //!
   //! @{

#define Usb_unicode(a)			((U16)(a))

#define NB_ENDPOINTS          6  //!  number of endpoints in the application including control endpoint
#define EP_MOUSE_IN           1  //! Number of the mouse interrupt IN endpoint
#define EP_MS_IN              2
#define EP_MS_OUT             3
#define EP_HID_IN             4
#define EP_HID_OUT            5




   //! @defgroup device_cst_actions USB device custom actions
   //!
   //! @{
   // write here the action to associate to each USB event
   // be carefull not to waste time in order not disturbing the functions
#define Usb_sof_action()         sof_action();
#define Usb_wake_up_action()
#define Usb_resume_action()
#define Usb_suspend_action()
#define Usb_reset_action()
#define Usb_vbus_on_action()
#define Usb_vbus_off_action()
#define Usb_set_configuration_action()
   //! @}

extern void sof_action(void);

    // write here the action to associate to each SCSI event
    // be carefull not to waste time in order not disturbing the functions
#define Scsi_start_read_action()    Led1_on()
#define Scsi_stop_read_action()     Led1_off()
#define Scsi_start_write_action()   Led0_on()
#define Scsi_stop_write_action()    Led0_off()
   //! @}

//! @}

#endif // _CONF_USB_H_

⌨️ 快捷键说明

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