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     *  ======== IOA ========
    14     *  MSP430 General Purpose Operational Amplifier
    15     */
    16    metaonly interface IOA inherits xdc.platform.IPeripheral {
    17        
    18        /*! Inverting input selection */
    19        enum OAN_t {
    20          OAN_0 = (0*0x400u),       /*! OAxI0 */
    21          OAN_1 = (1*0x400u),       /*! OAxI1 */
    22          OAN_2 = (2*0x400u),       /*! OAxI2 */
    23          OAN_3 = 3*0x400u          /*! OAxI3 */
    24        };
    25    
    26        /*! Non-inverting input selection */
    27        enum OAP_t {
    28          OAP_0 = (0*0x400u),       /*! OAxI0 */
    29          OAP_1 = (1*0x400u),       /*! OAxI1 */
    30          OAP_2 = (2*0x400u),       /*! OAxI2 */
    31          OAP_3 = 3*0x400u          /*! OAxI3 */
    32        };
    33         
    34        /*! Slew rate select */
    35        enum OAPM_t {
    36          OAPM_0 = (0*0x400u),      /*! Off, output high Z */
    37          OAPM_1 = (1*0x400u),      /*! Slow */
    38          OAPM_2 = (2*0x400u),      /*! Medium */
    39          OAPM_3 = 3*0x400u         /*! Fast */
    40        };
    41        
    42        enum OAADC0_t {
    43          OAADC0_OFF = (0x00),      /*! OAx output to ADC12 input channel select 0 */
    44          OAADC0 = 0x01             /*! OAx output to ADC12 input channel select 0 */
    45        };
    46        
    47        enum OAADC1_t {
    48          OAADC1_OFF = (0x00),      /*! OAx output to ADC12 input channel select 1 */
    49          OAADC1 = 0x02             /*! OAx output to ADC12 input channel select 1 */
    50        };
    51        
    52        /*! OAx feedback resistor select */
    53        enum OAFBR_t {
    54          OAFBR_0 = (0*0x100u),     /*! OAx Feedback resistor: Tap 0 */
    55          OAFBR_1 = (1*0x100u),     /*! OAx Feedback resistor: Tap 1 */
    56          OAFBR_2 = (2*0x100u),     /*! OAx Feedback resistor: Tap 2 */
    57          OAFBR_3 = (3*0x100u),     /*! OAx Feedback resistor: Tap 3 */
    58          OAFBR_4 = (4*0x100u),     /*! OAx Feedback resistor: Tap 4 */
    59          OAFBR_5 = (5*0x100u),     /*! OAx Feedback resistor: Tap 5 */
    60          OAFBR_6 = (6*0x100u),     /*! OAx Feedback resistor: Tap 6 */
    61          OAFBR_7 = 7*0x100u        /*! OAx Feedback resistor: Tap 7 */
    62        };
    63    
    64        /*! OAx function control */
    65        enum OAFC_t {
    66          OAFC_0 = (0*0x100u),      /*! General Purpose */
    67          OAFC_1 = (1*0x100u),      /*! Unity gain buffer for three-opamp differential amplifier */
    68          OAFC_2 = (2*0x100u),      /*! Unity gain buffer */
    69          OAFC_3 = (3*0x100u),      /*! Comparator */
    70          OAFC_4 = (4*0x100u),      /*! Non-inverting PGA */
    71          OAFC_5 = (5*0x100u),      /*! Cascaded non-inverting PGA */
    72          OAFC_6 = (6*0x100u),      /*! Inverting PGA */
    73          OAFC_7 = 7*0x100u         /*! Differential amplifier */
    74        };
    75    
    76        enum OARRIP_t {
    77          OARRIP_OFF = 0x00,        /*! Rtop = AVss, Rbottom = AVcc */
    78          OARRIP     = 0x01         /*! Rtop = AVcc, Rbottom = AVss */
    79        };
    80        
    81        enum OANEXT_t {
    82          OANEXT_OFF = 0x00,        /*! OAx inverting input not externally available */
    83          OANEXT     = 0x02         /*! OAx inverting input externally available */
    84        };
    85          
    86       /*!
    87        *  ======== OAxCTL0_t ========
    88        *  Opamp Control Register 0 Definition
    89        *
    90        *  @see #OAxCTL0_t
    91        */
    92        struct OAxCTL0_t {
    93          OAN_t     OAN;            /*! Inverting input select. These bits select the input signal for the OA inverting
    94                                      * input.
    95                                      *  00  OAxI0
    96                                      *  01  OAxI1
    97                                      *  10  OAxIA (see the device-specific data sheet for connected signal)
    98                                      *  11  OAxIB (see the device-specific data sheet for connected signal) */
    99          OAP_t     OAP;            /*! Non-inverting input select. These bits select the input signal for the OA
   100                                      * non-inverting input.
   101                                      *  00  OAxI0
   102                                      *  01  OA0I1
   103                                      *  10  OAxIA (see the device-specific data sheet for connected signal)
   104                                      *  11  OAxIB (see the device-specific data sheet for connected signal) */
   105          OAPM_t    OAPM;           /*! Slew rate select. These bits select the slew rate vs. current consumption
   106                                      * for the OA.
   107                                      *  00  Off, output high Z
   108                                      *  01  Slow
   109                                      *  10  Medium
   110                                      *  11  Fast */
   111          OAADC0_t  OAADC0;         /*! OA output select. These bits, together with the OAFCx bits, control the
   112                                      * routing of the OAx output when OAPMx > 0.
   113                                      * When OAFCx = 0:
   114                                      *  00  OAxOUT connected to external pins and ADC input A1, A3, or A5
   115                                      *  01  OAxOUT connected to external pins and ADC input A12, A13, or A14
   116                                      *  10  OAxOUT connected to external pins and ADC input A1, A3, or A5
   117                                      *  11  OAxOUT connected to external pins and ADC input A12, A13, or A14
   118                                      * When OAFCx > 0:
   119                                      *  00  OAxOUT used for internal routing only
   120                                      *  01  OAxOUT connected to external pins and ADC input A12, A13, or A14
   121                                      *  10  OAxOUT connected to external pins and ADC input A1, A3, or A5
   122                                      *  11  OAxOUT connected internally to ADC input A12, A13 , or A14.
   123                                      * External A12, A13, or A14 pin connections are disconnected from the
   124                                      * ADC. */
   125          OAADC1_t  OAADC1;         /*! OA output select. These bits, together with the OAFCx bits, control the
   126                                      * routing of the OAx output when OAPMx > 0.
   127                                      * When OAFCx = 0:
   128                                      *  00  OAxOUT connected to external pins and ADC input A1, A3, or A5
   129                                      *  01  OAxOUT connected to external pins and ADC input A12, A13, or A14
   130                                      *  10  OAxOUT connected to external pins and ADC input A1, A3, or A5
   131                                      *  11  OAxOUT connected to external pins and ADC input A12, A13, or A14
   132                                      * When OAFCx > 0:
   133                                      *  00  OAxOUT used for internal routing only
   134                                      *  01  OAxOUT connected to external pins and ADC input A12, A13, or A14
   135                                      *  10  OAxOUT connected to external pins and ADC input A1, A3, or A5
   136                                      *  11  OAxOUT connected internally to ADC input A12, A13 , or A14.
   137                                      * External A12, A13, or A14 pin connections are disconnected from the
   138                                      * ADC. */
   139        }
   140        
   141        /*!
   142        *  ======== OAxCTL1_t ========
   143        *  Opamp Control Register 1 Definition
   144        *
   145        *  @see #OAxCTL1_t
   146        */
   147        struct OAxCTL1_t {
   148          OAFBR_t   OAFBR;          /*! OAx feedback resistor select
   149                                      *  000  Tap 0 - 0R/16R
   150                                      *  001  Tap 1 - 4R/12R
   151                                      *  010  Tap 2 - 8R/8R
   152                                      *  011  Tap 3 - 10R/6R
   153                                      *  100  Tap 4 - 12R/4R
   154                                      *  101  Tap 5 - 13R/3R
   155                                      *  110  Tap 6 - 14R/2R
   156                                      *  111  Tap 7 - 15R/1R */
   157          OAFC_t    OAFC;           /*! OAx function control. This bit selects the function of OAx
   158                                      *  000  General purpose opamp
   159                                      *  001  Unity gain buffer for three-opamp differential amplifier
   160                                      *  010  Unity gain buffer
   161                                      *  011  Comparator
   162                                      *  100  Non-inverting PGA amplifier
   163                                      *  101  Cascaded non-inverting PGA amplifier
   164                                      *  110  Inverting PGA amplifier
   165                                      *  111  Differential amplifier */
   166          OANEXT_t  OANEXT;         /*! OAx inverting input externally available. This bit, when set, connects the
   167                                      * inverting OAx input to the external pin when the integrated resistor network
   168                                      * is used.
   169                                      *  0  OAx inverting input not externally available
   170                                      *  1  OAx inverting input externally available */
   171          OARRIP_t  OARRIP;         /*! OAx reverse resistor connection in comparator mode
   172                                      *  0  RTOP is connected to AVSS and RBOTTOM is connected to AVCC when
   173                                      *     OAFCx = 3
   174                                      *  1  RTOP is connected to AVCC and RBOTTOM is connected to AVSS when
   175                                      *     OAFCx = 3. */
   176        }
   177    
   178        /*!
   179        *  ======== ForceSetDefaultRegister_t ========
   180        *  Force Set Default Register
   181        *
   182        *  Type to store if each register needs to be forced initialized
   183        *  even if the register is in default state.
   184        *
   185        *  @see #ForceSetDefaultRegister_t
   186        */
   187        struct ForceSetDefaultRegister_t {
   188            String     register;
   189            Bool       regForceSet;
   190        }
   191        
   192    instance:
   193    
   194        /*! Returns the number of available OA */
   195        UChar getNumberOfOA();
   196    }