1    /* --COPYRIGHT--,EPL
     2     *  Copyright (c) 2008 Texas Instruments and others.
     3     *  All rights reserved. This program and the accompanying materials
     4     *  are made available under the terms of the Eclipse Public License v1.0
     5     *  which accompanies this distribution, and is available at
     6     *  http://www.eclipse.org/legal/epl-v10.html
     7     *
     8     *  Contributors:
     9     *      Texas Instruments - initial implementation
    10     *
    11     * --/COPYRIGHT--*/
    12    /*!
    13     *  ======== Comparator_D ========
    14     *  MSP430FR5xx Family Comparator_D Module
    15     */
    16    metaonly module Comparator_D inherits IComparator {
    17    
    18        enum CDIE_t{
    19            CDIE_OFF    = 0x0000,       /*! Interrupt not enabled */
    20            CDIE        = 0x0100        /*! Interrupt enabled */
    21        };
    22        
    23        enum CDIIE_t{
    24            CDIIE_OFF   = 0x0000,       /*! Interrupt not enabled inverted polarity*/
    25            CDIIE       = 0x0200        /*! Interrupt enabled inverted polarity */
    26        };
    27    
    28        enum CDIFG_t{
    29            CDIFG_OFF   = 0x00,         /*! No interrupt pending */
    30            CDIFG       = 0x01          /*! Interrupt pending */
    31        };
    32        
    33        enum CDIIFG_t{
    34            CDIIFG_OFF  = 0x00,         /*! No inverted interrupt pending */
    35            CDIIFG      = 0x02          /*! Inverted interrupt pending */
    36        };
    37        
    38        struct CDIEALL_t {
    39            CDIE_t      CDIE;          /*!  Comparator D interrupt enable. This
    40                                        *   bit enables the CDIFG interrupt for
    41                                        *   comparator mode.
    42                                        *   0  Interrupt disabled
    43                                        *   1  Interrupt enabled */
    44                                        
    45            CDIIE_t      CDIIE;         /*! Comparator D interrupt enable inverted polarity. This
    46                                        *   bit enables the CDIIFG interrupt for
    47                                        *   comparator mode.
    48                                        *   0  Interrupt disabled
    49                                        *   1  Interrupt enabled */
    50        }
    51        
    52        struct CDIFGALL_t {
    53            CDIFG_t      CDIFG;         /*! Comparator D interrupt flag.
    54                                         *  0  No interrupt pending
    55                                         *  1  Interrupt pending */
    56                                         
    57            CDIIFG_t     CDIIFG;         /*! Comparator D interrupt flag.
    58                                         *  0  No inverted interrupt pending
    59                                         *  1  Inverted interrupt pending */
    60        }
    61    instance:
    62        /*!
    63         *  ======== baseAddr ========
    64         *  Address of the peripheral's control register.
    65         *
    66         *  A peripheral's registers are commonly accessed through a structure
    67         *  that defines the offsets of a particular register from the lowest
    68         *  address mapped to a peripheral. That lowest address is specified by
    69         *  this parameter.
    70         */
    71        config UInt baseAddr;
    72        
    73         /*! 
    74         *  ======== interruptSource ========
    75         *  Comparator_D has own interrupt enables
    76         *  thus interruptSource is defined here
    77         */
    78        config regIntVect_t interruptSource[2];
    79    
    80        /*! 
    81         *  ======== CDIEALL ========
    82         * All the Interrupt Enables in Comparator_D
    83         */
    84        config CDIEALL_t CDIEALL = {
    85            CDIE        : CDIE_OFF,
    86            CDIIE       : CDIIE_OFF
    87        };
    88    
    89        /*! 
    90         *  ======== CDIFGALL ========
    91         * All the Interrupt Flags in Comparator_D
    92         */
    93        config CDIFGALL_t CDIFGALL = {
    94            CDIFG       : CDIFG_OFF,
    95            CDIIFG      : CDIIFG_OFF
    96        };
    97        
    98        /*!
    99        *   ======== forceSetDefaultRegister ========
   100        * Determine if each Register needs to be forced set or not 
   101        */
   102        readonly config ForceSetDefaultRegister_t forceSetDefaultRegister[] =
   103        [
   104            { register : "CDIEALL" , regForceSet : false },
   105            { register : "CDIFGALL" , regForceSet : false },
   106        ];
   107    }