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