00001 /* ---------------------------------------------------------------------------- */ 00002 /* Atmel Microcontroller Software Support */ 00003 /* SAM Software Package License */ 00004 /* ---------------------------------------------------------------------------- */ 00005 /* Copyright (c) 2015, Atmel Corporation */ 00006 /* */ 00007 /* All rights reserved. */ 00008 /* */ 00009 /* Redistribution and use in source and binary forms, with or without */ 00010 /* modification, are permitted provided that the following condition is met: */ 00011 /* */ 00012 /* - Redistributions of source code must retain the above copyright notice, */ 00013 /* this list of conditions and the disclaimer below. */ 00014 /* */ 00015 /* Atmel's name may not be used to endorse or promote products derived from */ 00016 /* this software without specific prior written permission. */ 00017 /* */ 00018 /* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */ 00019 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ 00020 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */ 00021 /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, */ 00022 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ 00023 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ 00024 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */ 00025 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ 00026 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ 00027 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 00028 /* ---------------------------------------------------------------------------- */ 00029 00030 /** \file 00031 * Definitions and methods for USB CDC Notifications. 00032 */ 00033 00034 #ifndef _CDCNOTIFICATIONS_H_ 00035 #define _CDCNOTIFICATIONS_H_ 00036 /** \addtogroup usb_cdc 00037 *@{ 00038 */ 00039 00040 /*---------------------------------------------------------------------------- 00041 * Includes 00042 *----------------------------------------------------------------------------*/ 00043 00044 #include <stdint.h> 00045 00046 /*---------------------------------------------------------------------------- 00047 * Definitions 00048 *----------------------------------------------------------------------------*/ 00049 00050 /** \addtogroup cdc_serial_states CDC SerialState bits 00051 * @{ 00052 * This page lists the bit map for CDC Serial States. 00053 * 00054 * - \ref CDCSerialState_RXDRIVER 00055 * - \ref CDCSerialState_TXCARRIER 00056 * - \ref CDCSerialState_BREAK 00057 * - \ref CDCSerialState_RINGSIGNAL 00058 * - \ref CDCSerialState_FRAMING 00059 * - \ref CDCSerialState_PARITY 00060 * - \ref CDCSerialState_OVERRUN 00061 */ 00062 00063 /** Indicates the receiver carrier signal is present */ 00064 #define CDCSerialState_RXDRIVER (1 << 0) 00065 /** Indicates the transmission carrier signal is present */ 00066 #define CDCSerialState_TXCARRIER (1 << 1) 00067 /** Indicates a break has been detected */ 00068 #define CDCSerialState_BREAK (1 << 2) 00069 /** Indicates a ring signal has been detected */ 00070 #define CDCSerialState_RINGSIGNAL (1 << 3) 00071 /** Indicates a framing error has occurred */ 00072 #define CDCSerialState_FRAMING (1 << 4) 00073 /** Indicates a parity error has occurred */ 00074 #define CDCSerialState_PARITY (1 << 5) 00075 /** Indicates a data overrun error has occurred */ 00076 #define CDCSerialState_OVERRUN (1 << 6) 00077 /** @}*/ 00078 00079 /*---------------------------------------------------------------------------- 00080 * Types 00081 *----------------------------------------------------------------------------*/ 00082 #pragma pack(1) 00083 #if defined ( __CC_ARM ) /* Keil ¦̀Vision 4 */ 00084 #elif defined ( __ICCARM__ ) /* IAR Ewarm */ 00085 #define __attribute__(...) 00086 #define __packed__ packed 00087 #elif defined ( __GNUC__ ) /* GCC CS3 */ 00088 #define __packed__ aligned(1) 00089 #endif 00090 /** USB CDC SerialState struct (bitmap) */ 00091 typedef struct _CDCSerialState { 00092 uint16_t bRxCarrier:1, /**< State of receive carrier detection (V2.4 signal 00093 109 and RS-232 signal DCD) */ 00094 bTxCarrier:1, /**< State of transmission carrier */ 00095 bBreak:1, /**< State of break detection */ 00096 bRingSignal:1, /**< State of ring signal */ 00097 bFraming:1, /**< Framing error */ 00098 bParity:1, /**< Parity error */ 00099 bOverRun:1, /**< Received data discarded due to overrun error */ 00100 reserved:9; /**< Reserved */ 00101 } __attribute__ ((__packed__)) CDCSerialState; 00102 00103 #pragma pack() 00104 00105 /*---------------------------------------------------------------------------- 00106 * Functions 00107 *----------------------------------------------------------------------------*/ 00108 00109 /**@}*/ 00110 #endif /* #ifndef _CDCNOTIFICATIONS_H_ */ 00111