[tuxdroid-svn] r1179 - firmware/fuxusb/trunk/src
Status: Beta
Brought to you by:
ks156
From: Paul_R <c2m...@c2...> - 2008-05-20 12:59:03
|
Author: Paul_R Date: 2008-05-20 14:59:06 +0200 (Tue, 20 May 2008) New Revision: 1179 Modified: firmware/fuxusb/trunk/src/config.h firmware/fuxusb/trunk/src/global.c firmware/fuxusb/trunk/src/global.h firmware/fuxusb/trunk/src/usb_commands.c firmware/fuxusb/trunk/src/usb_desc.h firmware/fuxusb/trunk/src/usb_misc.c firmware/fuxusb/trunk/src/usb_misc.h Log: * Removed reattach_usb from usb_misc to create a define in global.h * Moved descriptors defines from config.h to usb_desc.h Modified: firmware/fuxusb/trunk/src/config.h =================================================================== --- firmware/fuxusb/trunk/src/config.h 2008-05-20 12:25:48 UTC (rev 1178) +++ firmware/fuxusb/trunk/src/config.h 2008-05-20 12:59:06 UTC (rev 1179) @@ -27,11 +27,9 @@ #include "lib_mcu/reg_5131.h" #include "lib_mcu/ext_5131.h" #include "lib_mcu/5131_drv.h" -#include <stdio.h> -/* Enable the HID interface */ -#define HID_DEVICE + /* Debug modes : Don't forget to define MAIN_DEBUG to be able to use printf */ //#define MAIN_DEBUG //#define BL_EP_DEBUG @@ -54,105 +52,20 @@ #define False 0 #define True 1 -/* USB Configuration */ -/* Endpoints */ +/** \name Endpoints + * @{ */ #define EP_AUDIO_IN 1 #define EP_AUDIO_OUT 2 #define EP_AUDIO_OUT_TTS 3 #define EP_CMD_IN 4 #define EP_CMD_OUT 5 -/* Device specifications and classes */ -#define USB_SPECIFICATION 0x1001 -#define DEVICE_CLASS 0x00 -#define DEVICE_SUB_CLASS 0 -#define DEVICE_PROTOCOL 0 -#define EP_CONTROL_LENGTH 32 -#define NB_CONFIGURATION 1 - -/* Version - PID/VID */ -#define VENDOR_ID 0xEB03 /* Atmel vendor ID = 03EBh */ -#define PRODUCT_ID 0x07FF /* Product ID: FF07h*/ -#define RELEASE_NUMBER (0x0100*VER_UPDATE) + (0x1000*VER_MINOR) +\ - (0x0001*VER_MAJOR) - -/* CONFIGURATION DESCRIPTOR */ -#ifdef HID_DEVICE -# define SIZE_OF_REPORT 0x22 -# define CONF_LENGTH 0x2901 // 297 -# define NB_INTERFACE 6 -#else -# define CONF_LENGTH 0x2001 // 288 -# define NB_INTERFACE 6 -#endif - -#define CONF_NB 1 -#define CONF_ATTRIBUTES USB_CONFIG_BUSPOWERED -#define MAX_POWER 50 /* 100 mA */ - -#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 EP_CONTROL 0 +#define EP_IN 0x01 #define ENDPOINT_0 0x00 #define ENDPOINT_1 0x81 +/* @} */ -#define RX_EP 2 -#define TX_EP 1 -#define TX_EP_SIZE 32 -/* STRING INDEX */ -/*******************************************/ - -#define MAN_STRING_INDEX 1 -#define PROD_STRING_INDEX 2 -#define SN_STRING_INDEX 3 -#define CONFIG_STRING_INDEX 4 -#define AUDIO_SPEAKER_INDEX 5 -#define AUDIO_MICRO_INDEX 6 -#define AUDIO_TTS_INDEX 7 -#define AUDIO_NORMAL_INDEX 8 - - -#define USB_MANUFACTURER_NAME {'K'<<8, 'y'<<8, 's'<<8, 'o'<<8, 'h'<<8} -#define USB_MN_LENGTH 5 - -#define USB_PRODUCT_NAME {'T'<<8, 'u'<<8, 'x'<<8, 'D'<<8, \ - 'r'<<8, 'o'<<8, 'i'<<8, 'd'<<8} -#define USB_PN_LENGTH 8 - -#define USB_SERIAL_NUMBER {'1'<<8, '0'<<8, '0'<<8, '0'<<8, '1'<<8} -#define USB_SN_LENGTH 5 - -#define USB_CONFIG_NAME {'T'<<8, 'u'<<8, 'x'<<8, 'D'<<8, \ - 'r'<<8, 'o'<<8, 'i'<<8, 'd'<<8} -#define USB_CONFIG_LENGTH 8 - -#define AUDIO_NORMAL_NAME {'T'<<8, 'u'<<8, 'x'<<8, 'D'<<8, \ - 'r'<<8, 'o'<<8, 'i'<<8, 'd'<<8, '-'<<8, 'A'<<8, 'u'<<8, 'd'<<8, \ - 'i'<<8, 'o'<<8} -#define AUDIO_NORMAL_LENGTH 14 - -#define AUDIO_SPEAKER_NAME {'T'<<8, 'u'<<8, 'x'<<8, 'D'<<8, \ - 'r'<<8, 'o'<<8, 'i'<<8, 'd'<<8, '-'<<8, 'S'<<8, 'p'<<8, 'e'<<8, \ - 'a'<<8, 'k'<<8,'e'<<8,'r'<<8} -#define AUDIO_SPEAKER_LENGTH 16 - - -#define AUDIO_MICRO_NAME {'T'<<8, 'u'<<8, 'x'<<8, 'D'<<8, \ - 'r'<<8, 'o'<<8, 'i'<<8, 'd'<<8, '-'<<8, 'M'<<8, 'i'<<8, 'c'<<8, \ - 'r'<<8, 'o'<<8} -#define AUDIO_MICRO_LENGTH 14 - - -#define AUDIO_TTS_NAME {'T'<<8, 'u'<<8, 'x'<<8, 'D'<<8, \ - 'r'<<8, 'o'<<8, 'i'<<8, 'd'<<8, '-'<<8, 'T'<<8, 'T'<<8, 'S'<<8} -#define AUDIO_TTS_LENGTH 12 - -#define LANG_ID 0x00 -#define LANGUAGE_ID 0x0904 #endif // _CONFIG_H_ Modified: firmware/fuxusb/trunk/src/global.c =================================================================== --- firmware/fuxusb/trunk/src/global.c 2008-05-20 12:25:48 UTC (rev 1178) +++ firmware/fuxusb/trunk/src/global.c 2008-05-20 12:59:06 UTC (rev 1179) @@ -17,10 +17,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id:$ */ +/* $Id$ */ +#include "global.h" #include "config.h" -#include "global.h" #include "version.h" uint8_t Command_Ctr; Modified: firmware/fuxusb/trunk/src/global.h =================================================================== --- firmware/fuxusb/trunk/src/global.h 2008-05-20 12:25:48 UTC (rev 1178) +++ firmware/fuxusb/trunk/src/global.h 2008-05-20 12:59:06 UTC (rev 1179) @@ -139,7 +139,6 @@ * \defgroup mcu MCU libs */ - #include "common\api.h" #include "common\defines.h" @@ -169,10 +168,28 @@ extern code author_t info_author; -#define wait_reset() \ -{\ -WDTRST = 0x1E; \ -WDTRST = 0xE1; \ -while(1); \ -} +/** + * \brief Reset the dongle. + * This function configure the watchdog timer and wait the timer OVF. + * \ingroup misc + */ +#define wait_reset() {\ + WDTRST = 0x1E; \ + WDTRST = 0xE1; \ + while(1); \ + } + +/** + * \brief reattach USB. + * This function simulate a disconnexion/connexion of the USB device. + * This is used when the device has to be re-enumerated (ISP mode for example). + * \ingroup usb_misc + */ +#define reattach_usb() { \ + long tc; \ + tc=10000; \ + Usb_detach(); \ + while(tc) tc --; \ + Usb_attach(); \ + } #endif // _GLOBAL_H_ Modified: firmware/fuxusb/trunk/src/usb_commands.c =================================================================== --- firmware/fuxusb/trunk/src/usb_commands.c 2008-05-20 12:25:48 UTC (rev 1178) +++ firmware/fuxusb/trunk/src/usb_commands.c 2008-05-20 12:59:06 UTC (rev 1179) @@ -28,7 +28,6 @@ #include "global.h" #include "usb_ep.h" #include "usb_commands.h" -#include "usb_misc.h" #include "spi_task.h" #include "bootloader.h" #include "fifo_stt.h" Modified: firmware/fuxusb/trunk/src/usb_desc.h =================================================================== --- firmware/fuxusb/trunk/src/usb_desc.h 2008-05-20 12:25:48 UTC (rev 1178) +++ firmware/fuxusb/trunk/src/usb_desc.h 2008-05-20 12:59:06 UTC (rev 1179) @@ -27,9 +27,11 @@ #ifndef _USB_DESC_H_ #define _USB_DESC_H_ -#include "config.h" #include "version.h" +/** Enable the HID interface */ +#undef HID_DEVICE + /** \name Descriptors type * @{ */ /** \name Standard descriptors @@ -100,7 +102,121 @@ /*! @} */ /*! @} */ +/** \name Strings + * @{ */ +/** \name Manufacturer + * @{ */ +#define MAN_STRING_INDEX 1 +#define USB_MANUFACTURER_NAME {'K'<<8, 'y'<<8, 's'<<8, 'o'<<8, 'h'<<8} +#define USB_MN_LENGTH 5 +/* @} */ +/** \name Product + * @{ */ +#define PROD_STRING_INDEX 2 +#define USB_PRODUCT_NAME {'T'<<8, 'u'<<8, 'x'<<8, 'D'<<8, \ + 'r'<<8, 'o'<<8, 'i'<<8, 'd'<<8} +#define USB_PN_LENGTH 8 +/* @} */ + +/** \name Serial number + * @{ */ +#define SN_STRING_INDEX 3 +#define USB_SERIAL_NUMBER {'1'<<8, '0'<<8, '0'<<8, '0'<<8, '1'<<8} +#define USB_SN_LENGTH 5 +/* @} */ + +/** \name Configuration + * @{ */ +#define CONFIG_STRING_INDEX 4 +#define USB_CONFIG_NAME {'T'<<8, 'u'<<8, 'x'<<8, 'D'<<8, \ + 'r'<<8, 'o'<<8, 'i'<<8, 'd'<<8} +#define USB_CONFIG_LENGTH 8 +/* @} */ + +/** \name Speaker interface + * @{ */ +#define AUDIO_SPEAKER_INDEX 5 +#define AUDIO_SPEAKER_NAME {'T'<<8, 'u'<<8, 'x'<<8, 'D'<<8, \ + 'r'<<8, 'o'<<8, 'i'<<8, 'd'<<8, '-'<<8, 'S'<<8, 'p'<<8, 'e'<<8, \ + 'a'<<8, 'k'<<8,'e'<<8,'r'<<8} +#define AUDIO_SPEAKER_LENGTH 16 +/* @} */ + +/** \name Microphone interface + * @{ */ +#define AUDIO_MICRO_INDEX 6 +#define AUDIO_MICRO_NAME {'T'<<8, 'u'<<8, 'x'<<8, 'D'<<8, \ + 'r'<<8, 'o'<<8, 'i'<<8, 'd'<<8, '-'<<8, 'M'<<8, 'i'<<8, 'c'<<8, \ + 'r'<<8, 'o'<<8} +#define AUDIO_MICRO_LENGTH 14 +/* @} */ + +/** \name TTS interface + * @{ */ +#define AUDIO_TTS_INDEX 7 +#define AUDIO_TTS_NAME {'T'<<8, 'u'<<8, 'x'<<8, 'D'<<8, \ + 'r'<<8, 'o'<<8, 'i'<<8, 'd'<<8, '-'<<8, 'T'<<8, 'T'<<8, 'S'<<8} +#define AUDIO_TTS_LENGTH 12 +/* @} */ + +/** \name Normal audio control interface + * @{ */ +#define AUDIO_NORMAL_INDEX 8 +#define AUDIO_NORMAL_NAME {'T'<<8, 'u'<<8, 'x'<<8, 'D'<<8, \ + 'r'<<8, 'o'<<8, 'i'<<8, 'd'<<8, '-'<<8, 'A'<<8, 'u'<<8, 'd'<<8, \ + 'i'<<8, 'o'<<8} +#define AUDIO_NORMAL_LENGTH 14 +/* @} */ +/* @} */ + + + +/** \name USB configuration + * @{ */ + + +/** \name Device specifications and classes + * @} */ +#define USB_SPECIFICATION 0x1001 +#define DEVICE_CLASS 0x00 +#define DEVICE_SUB_CLASS 0 +#define DEVICE_PROTOCOL 0 +#define EP_CONTROL_LENGTH 32 +#define NB_CONFIGURATION 1 +/* @} */ + +/** \name Version - PID/VID + * @{ */ +#define VENDOR_ID 0xEB03 /* Atmel vendor ID = 03EBh */ +#define PRODUCT_ID 0x07FF /* Product ID: FF07h*/ +#define RELEASE_NUMBER (0x0100*VER_UPDATE) + (0x1000*VER_MINOR) +\ + (0x0001*VER_MAJOR) +/* @} */ + +/** \name Configuration descriptor + * @{ */ +#ifdef HID_DEVICE +# define SIZE_OF_REPORT 0x22 +# define CONF_LENGTH 0x2901 // 297 +# define NB_INTERFACE 6 +#else +# define CONF_LENGTH 0x2001 // 288 +# define NB_INTERFACE 6 +#endif + +#define CONF_NB 1 +#define CONF_ATTRIBUTES USB_CONFIG_BUSPOWERED +#define MAX_POWER 50 /* 100 mA */ +/* @} */ + +/** \name Languages + * @{ */ +#define LANG_ID 0x00 +#define LANGUAGE_ID 0x0904 +/* @} */ +/* @} */ + struct usb_st_device_descriptor { uint8_t bLength; /* Size of this descriptor in bytes */ Modified: firmware/fuxusb/trunk/src/usb_misc.c =================================================================== --- firmware/fuxusb/trunk/src/usb_misc.c 2008-05-20 12:25:48 UTC (rev 1178) +++ firmware/fuxusb/trunk/src/usb_misc.c 2008-05-20 12:59:06 UTC (rev 1179) @@ -69,20 +69,3 @@ FIFO_STT_init(); } -/** - * \brief reattach USB. - * This function simulate a disconnexion/connexion of the USB device. - * This is used when the device has to be re-enumerated (ISP mode for example). - * \ingroup usb_misc - */ -void reattach_usb(void) -{ - long tc; - - tc=10000; - Usb_detach(); - while(tc) tc --; - Usb_attach(); -} - - Modified: firmware/fuxusb/trunk/src/usb_misc.h =================================================================== --- firmware/fuxusb/trunk/src/usb_misc.h 2008-05-20 12:25:48 UTC (rev 1178) +++ firmware/fuxusb/trunk/src/usb_misc.h 2008-05-20 12:59:06 UTC (rev 1179) @@ -30,7 +30,6 @@ void suspend_usb(void); void resume_usb(void); void reset_usb(void); -void reattach_usb(void); #endif // _USB_MISC_H_ |