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    import ti.catalog.msp430.peripherals.clock.IClock;
    13    
    14    /*!
    15     * Universal Serial Communication Interface B0 I2C 2xx
    16     */
    17    metaonly module USCI_B0_I2C_2xx inherits IUSCI_B0_I2C {
    18    
    19        /*
    20         *  ======== create ========
    21         */
    22        create(IClock.Instance clock);
    23    
    24        /*! Not-acknowledge interrupt enable */
    25        enum UCNACKIE_t {
    26            UCNACKIE_OFF = 0x00,    /*! Interrupt disabled */
    27            UCNACKIE = 0x80         /*! Interrupt enabled */
    28        };
    29    
    30        /*! Stop condition interrupt enable */
    31        enum UCSTPIE_t {
    32            UCSTPIE_OFF = 0x00,     /*! Interrupt disabled */
    33            UCSTPIE = 0x80          /*! Interrupt enabled */
    34        };
    35    
    36        /*! Start condition interrupt enable */
    37        enum UCSTTIE_t {
    38            UCSTTIE_OFF = 0x00,     /*! Interrupt disabled */
    39            UCSTTIE = 0x80          /*! Interrupt enabled */
    40        };
    41    
    42        /*! Arbitration lost interrupt enable */
    43        enum UCALIE_t {
    44            UCALIE_OFF = 0x00,      /*! Interrupt disabled */
    45            UCALIE = 0x80           /*! Interrupt enabled */
    46        };
    47    
    48        /*! USCI_Bx I2C Interrupt Enable Register */
    49        struct UCBxI2CIE_t {
    50            UCNACKIE_t  UCNACKIE;   /*! Not-acknowledge interrupt enable
    51                                     *  0  Interrupt disabled
    52                                     *  1  Interrupt enabled */
    53            UCSTPIE_t   UCSTPIE;    /*! Stop condition interrupt enable
    54                                     *  0  Interrupt disabled
    55                                     *  1  Interrupt enabled */
    56            UCSTTIE_t   UCSTTIE;    /*! Start condition interrupt enable
    57                                     *  0  Interrupt disabled
    58                                     *  1  Interrupt enabled */
    59            UCALIE_t    UCALIE;    /*! Arbitration lost interrupt enable
    60                                     *  0  Interrupt disabled
    61                                     *  1  Interrupt enabled */
    62        }
    63    
    64    instance:
    65        /*! @_nodoc */
    66        config IClock.Instance clock;
    67    
    68        /*! USCI_Bx I2C Interrupt Enable Register */
    69        config UCBxI2CIE_t UCB0I2CIE = {
    70            UCNACKIE    : UCNACKIE_OFF,
    71            UCSTPIE     : UCSTPIE_OFF,
    72            UCSTTIE     : UCSTTIE_OFF,
    73            UCALIE      : UCALIE_OFF,
    74        };
    75    
    76       /*!
    77        *  ======== setUCNACKIE ========
    78        *  Sets UCNACKIE bit
    79        *
    80        *  @see #setUCNACKIE
    81        */
    82        Bool setUCNACKIE(Bool set);
    83    
    84       /*!
    85        *  ======== getUCNACKIE ========
    86        *  Gets UCNACKIE bit
    87        *
    88        *  @see #getUCNACKIE
    89        */
    90        Bool getUCNACKIE();
    91    
    92       /*!
    93        *  ======== setUCSTPIE ========
    94        *  Sets UCSTPIE bit
    95        *
    96        *  @see #setUCSTPIE
    97        */
    98        Bool setUCSTPIE(Bool set);
    99    
   100       /*!
   101        *  ======== getUCSTPIE ========
   102        *  Gets UCSTPIE bit
   103        *
   104        *  @see #getUCSTPIE
   105        */
   106        Bool getUCSTPIE();
   107    
   108       /*!
   109        *  ======== setUCSTTIE ========
   110        *  Sets UCSTTIE bit
   111        *
   112        *  @see #setUCSTTIE
   113        */
   114        Bool setUCSTTIE(Bool set);
   115    
   116       /*!
   117        *  ======== getUCSTTIE ========
   118        *  Gets UCSTTIE bit
   119        *
   120        *  @see #getUCSTTIE
   121        */
   122        Bool getUCSTTIE();
   123    
   124       /*!
   125        *  ======== setUCALIE ========
   126        *  Sets UCALIE bit
   127        *
   128        *  @see #setUCALIE
   129        */
   130        Bool setUCALIE(Bool set);
   131    
   132       /*!
   133        *  ======== getUCALIE ========
   134        *  Gets UCALIE bit
   135        *
   136        *  @see #getUCALIE
   137        */
   138        Bool getUCALIE();
   139    
   140        /*! USCI_B0 I2C interrupt enables */
   141        config regIntVect_t interruptSource[4];
   142    
   143        /*! Determine if each Register needs to be forced set or not */
   144        readonly config ForceSetDefaultRegister_t forceSetDefaultRegister[] =
   145        [
   146            { register : "UCB0CTL0"   , regForceSet : false },
   147            { register : "UCB0CTL1"   , regForceSet : false },
   148            { register : "UCB0BR0"    , regForceSet : false },
   149            { register : "UCB0BR1"    , regForceSet : false },
   150            { register : "UCB0STAT"   , regForceSet : false },
   151            { register : "UCB0RXBUF"  , regForceSet : false },
   152            { register : "UCB0TXBUF"  , regForceSet : false },
   153            { register : "UCB0I2COA"  , regForceSet : false },
   154            { register : "UCB0I2CSA"  , regForceSet : false },
   155            { register : "UCB0I2CIE"  , regForceSet : false }
   156        ];
   157    }