1
0
mirror of https://github.com/elua/elua.git synced 2025-01-08 20:56:17 +08:00

avr32 usb-cdc cleanup: remove tabs and ^Ms and add Atmel copyright

This commit is contained in:
Martin Guy 2012-02-01 18:28:13 +01:00
parent 3e48d16846
commit cd81e0d3dd
2 changed files with 63 additions and 54 deletions

View File

@ -1,3 +1,32 @@
/* Copyright (c) 2009 Atmel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an Atmel
* AVR product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
*/
#include <string.h>
#include "compiler.h"
@ -216,7 +245,7 @@ Status_bool_t usb_init_device(void)
{
return Is_usb_id_device() && !Is_usb_endpoint_enabled(EP_CONTROL) &&
Usb_configure_endpoint(EP_CONTROL,
AVR32_USBB_UECFG0_EPTYPE_CONTROL,
AVR32_USBB_UECFG0_EPTYPE_CONTROL,
AVR32_USBB_UECFG0_EPDIR_OUT,
EP_CONTROL_LENGTH,
AVR32_USBB_UECFG0_EPBK_SINGLE);

View File

@ -1,22 +1,3 @@
/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
/*This file is prepared for Doxygen automatic documentation generation.*/
/*! \file ******************************************************************
*
* \brief USB identifiers.
*
* This file contains the USB parameters that uniquely identify the USB
* application through descriptor tables.
*
* - Compiler: IAR EWAVR32 and GNU GCC for AVR32
* - Supported devices: All AVR32 devices with a USB module can be used.
* - AppNote:
*
* \author Atmel Corporation: http://www.atmel.com \n
* Support and FAQ: http://support.atmel.no/
*
***************************************************************************/
/* Copyright (c) 2009 Atmel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -45,7 +26,6 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
*
*/
#ifndef _USB_CDC_H_
@ -82,7 +62,7 @@
#define EVT_HOST_HWUP 10 // Host wake-up detected
#define EVT_HOST_DISCONNECTION 11 // The target device is disconnected
#define NB_MS_BEFORE_FLUSH 1
#define NB_MS_BEFORE_FLUSH 1
#define AVR32_USBB_usbcon (AVR32_USBB.usbcon)
#define AVR32_USBB_udintclr (AVR32_USBB.udintclr)
@ -175,7 +155,7 @@
#define Usb_disable_resume_interrupt() (AVR32_USBB_udinteclr = AVR32_USBB_UDINTECLR_EORSMEC_MASK)
#define Usb_enable_suspend_interrupt() (AVR32_USBB_udinteset = AVR32_USBB_UDINTESET_SUSPES_MASK)
#define Usb_enable_reset_interrupt() (AVR32_USBB_udinteset = AVR32_USBB_UDINTESET_EORSTES_MASK)
#define Usb_force_full_speed_mode() (Wr_bitfield(AVR32_USBB_udcon, AVR32_USBB_UDCON_SPDCONF_MASK, 3))
#define Usb_force_full_speed_mode() (Wr_bitfield(AVR32_USBB_udcon, AVR32_USBB_UDCON_SPDCONF_MASK, 3))
#define Is_usb_id_device() (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_ID_MASK))
#define Usb_ack_id_transition() (AVR32_USBB_usbstaclr = AVR32_USBB_USBSTACLR_IDTIC_MASK)
#define Usb_raise_id_transition() (AVR32_USBB_usbstaset = AVR32_USBB_USBSTASET_IDTIS_MASK)
@ -236,7 +216,7 @@
#define Usb_set_configuration_action() Usb_enable_sof_interrupt()
#define Usb_reset_endpoint(ep) (Set_bits(AVR32_USBB_uerst, AVR32_USBB_UERST_EPRST0_MASK << (ep)),\
Clr_bits(AVR32_USBB_uerst, AVR32_USBB_UERST_EPRST0_MASK << (ep)))
Clr_bits(AVR32_USBB_uerst, AVR32_USBB_UERST_EPRST0_MASK << (ep)))
#define Is_usb_vbus_transition() (Tst_bits(AVR32_USBB_usbsta, AVR32_USBB_USBSTA_VBUSTI_MASK))
#define Is_usb_resume_interrupt_enabled() (Tst_bits(AVR32_USBB_udinte, AVR32_USBB_UDINTE_EORSME_MASK))
#define Is_usb_wake_up() (Tst_bits(AVR32_USBB_udint, AVR32_USBB_UDINT_WAKEUP_MASK))
@ -308,8 +288,8 @@
#define Pep_fifo_access_16_post_inc() ++
#define Pep_fifo_access_8_post_inc() ++
#define TX_EP 0x01
#define RX_EP 0x02
#define TX_EP 0x01
#define RX_EP 0x02
#define INT_EP 0x03
#define GET_STATUS 0x00
#define GET_DEVICE 0x01
@ -325,8 +305,8 @@
#define SET_INTERFACE 0x0B
#define SYNCH_FRAME 0x0C
#define GET_DEVICE_DESCRIPTOR 1
#define GET_CONFIGURATION_DESCRIPTOR 4
#define GET_DEVICE_DESCRIPTOR 1
#define GET_CONFIGURATION_DESCRIPTOR 4
#define REQUEST_DEVICE_STATUS 0x80
#define REQUEST_INTERFACE_STATUS 0x81
@ -354,19 +334,19 @@
//_____ M A C R O S ________________________________________________________
#define Usb_unicode(c) (Usb_format_mcu_to_usb_data(16, (U16)(c)))
#define Usb_get_dev_desc_pointer() (&(usb_dev_desc.bLength))
#define Usb_get_dev_desc_length() (sizeof(usb_dev_desc))
#define Usb_get_conf_desc_pointer() (&(usb_conf_desc_fs.cfg.bLength))
#define Usb_get_conf_desc_length() (sizeof(usb_conf_desc_fs))
#define Usb_get_conf_desc_hs_pointer() (&(usb_conf_desc_hs.cfg.bLength))
#define Usb_get_conf_desc_hs_length() (sizeof(usb_conf_desc_hs))
#define Usb_get_conf_desc_fs_pointer() (&(usb_conf_desc_fs.cfg.bLength))
#define Usb_get_conf_desc_fs_length() (sizeof(usb_conf_desc_fs))
#define Usb_get_qualifier_desc_pointer() (&(usb_qualifier_desc.bLength))
#define Usb_get_qualifier_desc_length() (sizeof(usb_qualifier_desc))
#define Usb_unicode(c) (Usb_format_mcu_to_usb_data(16, (U16)(c)))
#define Usb_get_dev_desc_pointer() (&(usb_dev_desc.bLength))
#define Usb_get_dev_desc_length() (sizeof(usb_dev_desc))
#define Usb_get_conf_desc_pointer() (&(usb_conf_desc_fs.cfg.bLength))
#define Usb_get_conf_desc_length() (sizeof(usb_conf_desc_fs))
#define Usb_get_conf_desc_hs_pointer() (&(usb_conf_desc_hs.cfg.bLength))
#define Usb_get_conf_desc_hs_length() (sizeof(usb_conf_desc_hs))
#define Usb_get_conf_desc_fs_pointer() (&(usb_conf_desc_fs.cfg.bLength))
#define Usb_get_conf_desc_fs_length() (sizeof(usb_conf_desc_fs))
#define Usb_get_qualifier_desc_pointer() (&(usb_qualifier_desc.bLength))
#define Usb_get_qualifier_desc_length() (sizeof(usb_qualifier_desc))
//_____ U S B D E F I N E S _____________________________________________
// USB Device descriptor
@ -385,11 +365,11 @@
#define NB_CONFIGURATION 1
// CONFIGURATION
#define NB_INTERFACE 2 //! The number of interfaces for this configuration
#define CONF_NB 1 //! Number of this configuration
#define CONF_INDEX 0
#define CONF_ATTRIBUTES USB_CONFIG_BUSPOWERED
#define MAX_POWER 200 // 400 mA
#define NB_INTERFACE 2 //! The number of interfaces for this configuration
#define CONF_NB 1 //! Number of this configuration
#define CONF_INDEX 0
#define CONF_ATTRIBUTES USB_CONFIG_BUSPOWERED
#define MAX_POWER 200 // 400 mA
// Interface 0 descriptor
#define INTERFACE_NB_0 0 //! The number of this interface
@ -439,7 +419,7 @@
#define INTERFACE_STATUS 0x00 // TBD
#define LANG_ID 0x00
#define USB_MN_LENGTH 5
#define USB_MANUFACTURER_NAME \
{\
@ -572,14 +552,14 @@ typedef struct __attribute__((__packed__))
U16 bscUSB; //!< Binay Coded Decimal Spec. release
U8 bDeviceClass; //!< Class code assigned by the USB
U8 bDeviceSubClass; //!< Subclass code assigned by the USB
U8 bDeviceProtocol; //!< Protocol code assigned by the USB
U8 bDeviceProtocol; //!< Protocol code assigned by the USB
U8 bMaxPacketSize0; //!< Max packet size for EP0
U8 bNumConfigurations; //!< Number of possible configurations
U8 bReserved; //!< Reserved for future use, must be zero
} S_usb_device_qualifier_descriptor;
//! USB Language Descriptor
typedef struct __attribute__((__packed__))
{
@ -803,10 +783,10 @@ extern U32 usb_read_ep_rxpacket (U8, void *, U32, vo
extern volatile U8 usb_configuration_nb;
void UsbCdcFlush (void);
int UsbCdcSendChar(int);
int UsbCdcReadChar( int *);
Bool UsbCdcTxReady(void);
Bool UsbCdcTestHit(void);
void UsbCdcFlush (void);
int UsbCdcSendChar(int);
int UsbCdcReadChar( int *);
Bool UsbCdcTxReady(void);
Bool UsbCdcTestHit(void);
#endif