1    /*
     2     * Copyright (c) 2016, Texas Instruments Incorporated
     3     * All rights reserved.
     4     *
     5     * Redistribution and use in source and binary forms, with or without
     6     * modification, are permitted provided that the following conditions
     7     * are met:
     8     *
     9     * *  Redistributions of source code must retain the above copyright
    10     *    notice, this list of conditions and the following disclaimer.
    11     *
    12     * *  Redistributions in binary form must reproduce the above copyright
    13     *    notice, this list of conditions and the following disclaimer in the
    14     *    documentation and/or other materials provided with the distribution.
    15     *
    16     * *  Neither the name of Texas Instruments Incorporated nor the names of
    17     *    its contributors may be used to endorse or promote products derived
    18     *    from this software without specific prior written permission.
    19     *
    20     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    21     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    22     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    23     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    24     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    25     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    26     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    27     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    28     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    29     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    30     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    31     */
    32    
    33    /*!
    34     *  ======== Timer_A2 ========
    35     *  MSP430 Timer_A2 timer
    36     */
    37    metaonly module Timer_A2 inherits ITimer_A {
    38    
    39    instance:
    40        /*! TACTL, Timer_A2 Control Register */
    41        config TACTL_t TACTL = {
    42            TASSEL : TASSEL_0,
    43            ID : ID_0,
    44            MC : MC_0,
    45            TACLR : TACLR_OFF,
    46            TAIE : TAIE_OFF,
    47            TAIFG : TAIFG_OFF
    48        };
    49    
    50        /*! TACCTL0, Capture/Compare Control Register 0 */
    51        config TACCTLx_t TACCTL0 = {
    52            CM : CM_0,
    53            CCIS : CCIS_0,
    54            SCS : SCS_OFF,
    55            SCCI : SCCI_OFF,
    56            CAP : CAP_OFF,
    57            OUTMOD : OUTMOD_0,
    58            CCIE : CCIE_OFF,
    59            CCI : CCI_OFF,
    60            OUT : OUT_OFF,
    61            COV : COV_OFF,
    62            CCIFG : CCIFG_OFF
    63        };
    64    
    65        /*! TACCTL1, Capture/Compare Control Register 1 */
    66        config TACCTLx_t TACCTL1 = {
    67            CM : CM_0,
    68            CCIS : CCIS_0,
    69            SCS : SCS_OFF,
    70            SCCI : SCCI_OFF,
    71            CAP : CAP_OFF,
    72            OUTMOD : OUTMOD_0,
    73            CCIE : CCIE_OFF,
    74            CCI : CCI_OFF,
    75            OUT : OUT_OFF,
    76            COV : COV_OFF,
    77            CCIFG : CCIFG_OFF
    78        };
    79    
    80        /*! TACCR0, Timer_A Capture/Compare Register 0 */
    81        config Bits16 TACCR0 = 0;
    82        /*! TACCR1, Timer_A Capture/Compare Register 1 */
    83        config Bits16 TACCR1 = 0;
    84    
    85        /*! Timer interrupt enables */
    86        config regIntVect_t interruptSource[3];
    87    
    88        /*! Determine if each Register needs to be forced set or not */
    89        readonly config ForceSetDefaultRegister_t forceSetDefaultRegister[] =
    90        [
    91            { register : "TACTL"   , regForceSet : false },
    92            { register : "TACCTL0" , regForceSet : false },
    93            { register : "TACCTL1" , regForceSet : false },
    94            { register : "TACCR0"  , regForceSet : false },
    95            { register : "TACCR1"  , regForceSet : false }
    96        ];
    97    }