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.communication.USI as USI;
    13    import ti.catalog.msp430.peripherals.adc.SD16_A as SD16_A;
    14    
    15    /*!
    16     *  ======== GPIO for MSP430F20x3 ========
    17     *  MSP430 General Purpose Input Output Ports
    18     */
    19    metaonly module GPIO_MSP430F20x3 inherits IGPIO {
    20        /*!
    21         *  ======== create ========
    22         *  Create an instance of this peripheral. 
    23         */
    24            create(USI.Instance usi, SD16_A.Instance sd16_A);
    25            
    26    instance:
    27        /*! @_nodoc */
    28        config USI.Instance usi;
    29    
    30        /*! @_nodoc */
    31        config SD16_A.Instance sd16_A;
    32    
    33       /*! Define an array to describe all device pins. The 1st dimension
    34        *  denotes the port, the second the pin on that port. On an
    35        *  MSP430F20x3 device, there are 8 + 2 = 10 pins total.
    36        */
    37            
    38            /* TODO: This here should really be a module-wide feature, rather than an instance feature,
    39             * however due to limitations in XDCtools 3.21.0.0 the data is located here */
    40        readonly config DevicePin_t devicePins[2][8] =
    41        [
    42            [
    43                {
    44                    pinName : "P1.0",
    45                    pinFunction : {
    46                        functionName : [
    47                            "GPIO Input",
    48                            "GPIO Output",
    49                            "Timer_A2.TACLK/INCLK",
    50                            "ACLK",
    51                            "A0+"
    52                        ],
    53                        functionConfig : [
    54                            [
    55                                { register : "P1DIR", bitSetMask : 0x00, bitClearMask : 0x01 },
    56                                { register : "P1SEL", bitSetMask : 0x00, bitClearMask : 0x01 },
    57                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x01 }
    58                            ],
    59                            [
    60                                { register : "P1DIR", bitSetMask : 0x01, bitClearMask : 0x00 },
    61                                { register : "P1SEL", bitSetMask : 0x00, bitClearMask : 0x01 },
    62                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x01 }
    63                            ],
    64                            [
    65                                { register : "P1DIR", bitSetMask : 0x00, bitClearMask : 0x01 },
    66                                { register : "P1SEL", bitSetMask : 0x01, bitClearMask : 0x00 },
    67                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x01 }
    68                            ],
    69                            [
    70                                { register : "P1DIR", bitSetMask : 0x01, bitClearMask : 0x00 },
    71                                { register : "P1SEL", bitSetMask : 0x01, bitClearMask : 0x00 },
    72                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x01 }
    73                            ],
    74                            [
    75                                { register : "SD16AE", bitSetMask : 0x01, bitClearMask : 0x00 }
    76                            ]
    77                        ]
    78                    }
    79                },
    80                {
    81                    pinName : "P1.1",
    82                    pinFunction : {
    83                        functionName : [
    84                            "GPIO Input",
    85                            "GPIO Output",
    86                            "Timer_A2.CCI0A",
    87                            "Timer_A2.TA0",
    88                            "A0-/A4+"
    89                        ],
    90                        functionConfig : [
    91                            [
    92                                { register : "P1DIR", bitSetMask : 0x00, bitClearMask : 0x02 },
    93                                { register : "P1SEL", bitSetMask : 0x00, bitClearMask : 0x02 },
    94                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x02 }
    95                            ],
    96                            [
    97                                { register : "P1DIR", bitSetMask : 0x02, bitClearMask : 0x00 },
    98                                { register : "P1SEL", bitSetMask : 0x00, bitClearMask : 0x02 },
    99                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x02 }
   100                            ],
   101                            [
   102                                { register : "P1DIR", bitSetMask : 0x00, bitClearMask : 0x02 },
   103                                { register : "P1SEL", bitSetMask : 0x02, bitClearMask : 0x00 },
   104                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x02 }
   105                            ],
   106                            [
   107                                { register : "P1DIR", bitSetMask : 0x02, bitClearMask : 0x00 },
   108                                { register : "P1SEL", bitSetMask : 0x02, bitClearMask : 0x00 },
   109                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x02 }
   110                            ],
   111                            [
   112                                { register : "SD16AE", bitSetMask : 0x02, bitClearMask : 0x00 }
   113                            ]
   114                        ]
   115                    }
   116                },
   117                {
   118                    pinName : "P1.2",
   119                    pinFunction : {
   120                        functionName : [
   121                            "GPIO Input",
   122                            "GPIO Output",
   123                            "Timer_A2.CCI1A",
   124                            "Timer_A2.TA1",
   125                            "A1+/A4-"
   126                        ],
   127                        functionConfig : [
   128                            [
   129                                { register : "P1DIR", bitSetMask : 0x00, bitClearMask : 0x04 },
   130                                { register : "P1SEL", bitSetMask : 0x00, bitClearMask : 0x04 },
   131                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x04 }
   132                            ],
   133                            [
   134                                { register : "P1DIR", bitSetMask : 0x04, bitClearMask : 0x00 },
   135                                { register : "P1SEL", bitSetMask : 0x00, bitClearMask : 0x04 },
   136                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x04 }
   137                            ],
   138                            [
   139                                { register : "P1DIR", bitSetMask : 0x00, bitClearMask : 0x04 },
   140                                { register : "P1SEL", bitSetMask : 0x04, bitClearMask : 0x00 },
   141                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x04 }
   142                            ],
   143                            [
   144                                { register : "P1DIR", bitSetMask : 0x04, bitClearMask : 0x00 },
   145                                { register : "P1SEL", bitSetMask : 0x04, bitClearMask : 0x00 },
   146                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x04 }
   147                            ],
   148                            [
   149                                { register : "SD16AE", bitSetMask : 0x04, bitClearMask : 0x00 }
   150                            ]
   151                        ]
   152                    }
   153                },
   154                {
   155                    pinName : "P1.3",
   156                    pinFunction : {
   157                        functionName : [
   158                            "GPIO Input",
   159                            "GPIO Output",
   160                            "VREF",
   161                            "A1-"
   162                        ],
   163                        functionConfig : [
   164                            [
   165                                { register : "P1DIR", bitSetMask : 0x00, bitClearMask : 0x08 },
   166                                { register : "P1SEL", bitSetMask : 0x00, bitClearMask : 0x08 },
   167                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x08 }
   168                            ],
   169                            [
   170                                { register : "P1DIR", bitSetMask : 0x08, bitClearMask : 0x00 },
   171                                { register : "P1SEL", bitSetMask : 0x00, bitClearMask : 0x08 },
   172                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x08 }
   173                            ],
   174                            [
   175                                { register : "P1SEL", bitSetMask : 0x08, bitClearMask : 0x00 },
   176                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x08 }
   177                            ],
   178                            [
   179                                { register : "SD16AE", bitSetMask : 0x08, bitClearMask : 0x00 }
   180                            ]
   181                        ]
   182                    }
   183                },
   184                {
   185                    pinName : "P1.4",
   186                    pinFunction : {
   187                        functionName : [
   188                            "GPIO Input",
   189                            "GPIO Output",
   190                            "SMCLK",
   191                            "A2+"
   192                        ],
   193                        functionConfig : [
   194                            [
   195                                { register : "P1DIR", bitSetMask : 0x00, bitClearMask : 0x10 },
   196                                { register : "P1SEL", bitSetMask : 0x00, bitClearMask : 0x10 },
   197                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x10 }
   198                            ],
   199                            [
   200                                { register : "P1DIR", bitSetMask : 0x10, bitClearMask : 0x00 },
   201                                { register : "P1SEL", bitSetMask : 0x00, bitClearMask : 0x10 },
   202                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x10 }
   203                            ],
   204                            [
   205                                { register : "P1DIR", bitSetMask : 0x10, bitClearMask : 0x00 },
   206                                { register : "P1SEL", bitSetMask : 0x10, bitClearMask : 0x00 },
   207                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x10 }
   208                            ],
   209                            [
   210                                { register : "SD16AE", bitSetMask : 0x10, bitClearMask : 0x00 }
   211                            ]
   212                        ]
   213                    }
   214                },
   215                {
   216                    pinName : "P1.5",
   217                    pinFunction : {
   218                        functionName : [
   219                            "GPIO Input",
   220                            "GPIO Output",
   221                            "Timer_A2.TA0",
   222                            "SCLK",
   223                            "A2-"
   224                        ],
   225                        functionConfig : [
   226                            [
   227                                { register : "P1DIR", bitSetMask : 0x00, bitClearMask : 0x20 },
   228                                { register : "P1SEL", bitSetMask : 0x00, bitClearMask : 0x20 },
   229                                { register : "USICTL0", bitSetMask : 0x00, bitClearMask : 0x20 },
   230                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x20 }
   231                            ],
   232                            [
   233                                { register : "P1DIR", bitSetMask : 0x20, bitClearMask : 0x00 },
   234                                { register : "P1SEL", bitSetMask : 0x00, bitClearMask : 0x20 },
   235                                { register : "USICTL0", bitSetMask : 0x00, bitClearMask : 0x20 },
   236                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x20 }
   237                            ],
   238                            [
   239                                { register : "P1DIR", bitSetMask : 0x20, bitClearMask : 0x00 },
   240                                { register : "P1SEL", bitSetMask : 0x20, bitClearMask : 0x00 },
   241                                { register : "USICTL0", bitSetMask : 0x00, bitClearMask : 0x20 },
   242                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x20 }
   243                            ],
   244                            [
   245                                { register : "USICTL0", bitSetMask : 0x20, bitClearMask : 0x00 },
   246                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x20 }
   247                            ],
   248                            [
   249                                { register : "USICTL0", bitSetMask : 0x00, bitClearMask : 0x20 },
   250                                { register : "SD16AE", bitSetMask : 0x20, bitClearMask : 0x00 }
   251                            ]
   252                        ]
   253                    }
   254                },
   255                {
   256                    pinName : "P1.6",
   257                    pinFunction : {
   258                        functionName : [
   259                            "GPIO Input",
   260                            "GPIO Output",
   261                            "Timer_A2.CCI1B",
   262                            "Timer_A2.TA1",
   263                            "SDO/SCL",
   264                            "A3+"
   265                        ],
   266                        functionConfig : [
   267                            [
   268                                { register : "P1DIR", bitSetMask : 0x00, bitClearMask : 0x40 },
   269                                { register : "P1SEL", bitSetMask : 0x00, bitClearMask : 0x40 },
   270                                { register : "USICTL0", bitSetMask : 0x00, bitClearMask : 0x40 },
   271                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x40 }
   272                            ],
   273                            [
   274                                { register : "P1DIR", bitSetMask : 0x40, bitClearMask : 0x00 },
   275                                { register : "P1SEL", bitSetMask : 0x00, bitClearMask : 0x40 },
   276                                { register : "USICTL0", bitSetMask : 0x00, bitClearMask : 0x40 },
   277                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x40 }
   278                            ],
   279                            [
   280                                { register : "P1DIR", bitSetMask : 0x00, bitClearMask : 0x40 },
   281                                { register : "P1SEL", bitSetMask : 0x40, bitClearMask : 0x00 },
   282                                { register : "USICTL0", bitSetMask : 0x00, bitClearMask : 0x40 },
   283                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x40 }
   284                            ],
   285                            [
   286                                { register : "P1DIR", bitSetMask : 0x40, bitClearMask : 0x00 },
   287                                { register : "P1SEL", bitSetMask : 0x40, bitClearMask : 0x00 },
   288                                { register : "USICTL0", bitSetMask : 0x00, bitClearMask : 0x40 },
   289                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x40 }
   290                            ],
   291                            [
   292                                { register : "USICTL0", bitSetMask : 0x40, bitClearMask : 0x00 },
   293                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x40 }
   294                            ],
   295                            [
   296                                { register : "USICTL0", bitSetMask : 0x00, bitClearMask : 0x40 },
   297                                { register : "SD16AE", bitSetMask : 0x40, bitClearMask : 0x00 }
   298                            ]
   299                        ]
   300                    }
   301                },
   302                {
   303                    pinName : "P1.7",
   304                    pinFunction : {
   305                        functionName : [
   306                            "GPIO Input",
   307                            "GPIO Output",
   308                            "DVss",
   309                            "SDI/SDA",
   310                            "A3-"
   311                        ],
   312                        functionConfig : [
   313                            [
   314                                { register : "P1DIR", bitSetMask : 0x00, bitClearMask : 0x80 },
   315                                { register : "P1SEL", bitSetMask : 0x00, bitClearMask : 0x80 },
   316                                { register : "USICTL0", bitSetMask : 0x00, bitClearMask : 0x80 },
   317                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x80 }
   318                            ],
   319                            [
   320                                { register : "P1DIR", bitSetMask : 0x80, bitClearMask : 0x00 },
   321                                { register : "P1SEL", bitSetMask : 0x00, bitClearMask : 0x80 },
   322                                { register : "USICTL0", bitSetMask : 0x00, bitClearMask : 0x80 },
   323                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x80 }
   324                            ],
   325                            [
   326                                { register : "P1DIR", bitSetMask : 0x80, bitClearMask : 0x00 },
   327                                { register : "P1SEL", bitSetMask : 0x80, bitClearMask : 0x00 },
   328                                { register : "USICTL0", bitSetMask : 0x00, bitClearMask : 0x80 },
   329                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x80 }
   330                            ],
   331                            [
   332                                { register : "USICTL0", bitSetMask : 0x80, bitClearMask : 0x00 },
   333                                { register : "SD16AE", bitSetMask : 0x00, bitClearMask : 0x80 }
   334                            ],
   335                            [
   336                                { register : "USICTL0", bitSetMask : 0x00, bitClearMask : 0x80 },
   337                                { register : "SD16AE", bitSetMask : 0x80, bitClearMask : 0x00 }
   338                            ]
   339                        ]
   340                    }
   341                }
   342            ],
   343            [
   344                {
   345                    pinName : "P2.0",
   346                    pinFunction : {
   347                        functionName : [
   348                            ""
   349                        ],
   350                        functionConfig : [
   351                            [
   352    
   353                            ]
   354                        ]
   355                    }
   356                },
   357                {
   358                    pinName : "P2.1",
   359                    pinFunction : {
   360                        functionName : [
   361                            ""
   362                        ],
   363                        functionConfig : [
   364                            [
   365    
   366                            ]
   367                        ]
   368                    }
   369                },
   370                {
   371                    pinName : "P2.2",
   372                    pinFunction : {
   373                        functionName : [
   374                            ""
   375                        ],
   376                        functionConfig : [
   377                            [
   378    
   379                            ]
   380                        ]
   381                    }
   382                },
   383                {
   384                    pinName : "P2.3",
   385                    pinFunction : {
   386                        functionName : [
   387                            ""
   388                        ],
   389                        functionConfig : [
   390                            [
   391    
   392                            ]
   393                        ]
   394                    }
   395                },
   396                {
   397                    pinName : "P2.4",
   398                    pinFunction : {
   399                        functionName : [
   400                            ""
   401                        ],
   402                        functionConfig : [
   403                            [
   404    
   405                            ]
   406                        ]
   407                    }
   408                },
   409                {
   410                    pinName : "P2.5",
   411                    pinFunction : {
   412                        functionName : [
   413                            ""
   414                        ],
   415                        functionConfig : [
   416                            [
   417    
   418                            ]
   419                        ]
   420                    }
   421                },
   422                {
   423                    pinName : "P2.6",
   424                    pinFunction : {
   425                        functionName : [
   426                            "GPIO Input",
   427                            "GPIO Output",
   428                            "XIN",
   429                            "Timer_A2.TA1"
   430                        ],
   431                        functionConfig : [
   432                            [
   433                                { register : "P2DIR", bitSetMask : 0x00, bitClearMask : 0x40 },
   434                                { register : "P2SEL", bitSetMask : 0x00, bitClearMask : 0x40 }
   435                            ],
   436                            [
   437                                { register : "P2DIR", bitSetMask : 0x40, bitClearMask : 0x00 },
   438                                { register : "P2SEL", bitSetMask : 0x00, bitClearMask : 0x40 }
   439                            ],
   440                            [
   441                                { register : "P2DIR", bitSetMask : 0x00, bitClearMask : 0x40 },
   442                                { register : "P2SEL", bitSetMask : 0x40, bitClearMask : 0x00 }
   443                            ],
   444                            [
   445                                { register : "P2DIR", bitSetMask : 0x40, bitClearMask : 0x00 },
   446                                { register : "P2SEL", bitSetMask : 0x40, bitClearMask : 0x00 }
   447                            ]
   448                        ]
   449                    }
   450                },
   451                {
   452                    pinName : "P2.7",
   453                    pinFunction : {
   454                        functionName : [
   455                            "GPIO Input",
   456                            "GPIO Output",
   457                            "XOUT"
   458                        ],
   459                        functionConfig : [
   460                            [
   461                                { register : "P2DIR", bitSetMask : 0x00, bitClearMask : 0x80 },
   462                                { register : "P2SEL", bitSetMask : 0x00, bitClearMask : 0x80 }
   463                            ],
   464                            [
   465                                { register : "P2DIR", bitSetMask : 0x80, bitClearMask : 0x00 },
   466                                { register : "P2SEL", bitSetMask : 0x00, bitClearMask : 0x80 }
   467                            ],
   468                            [
   469                                { register : "P2SEL", bitSetMask : 0x80, bitClearMask : 0x00 }
   470                            ]
   471                        ]
   472                    }
   473                }
   474            ],
   475        ];
   476    
   477            /*! Implementation of Device Pin Functional Configuration */
   478            override config DevicePinFunctionSetting_t devicePinSetting[2][8];
   479    
   480            /*! Determine if each Register needs to be forced set or not */
   481            readonly config ForceSetDefaultRegister_t forceSetDefaultRegister[] =
   482            [
   483                    { register : "P1OUT" , regForceSet : true  },
   484                    { register : "P1SEL" , regForceSet : false },
   485                    { register : "P1DIR" , regForceSet : false },
   486                    { register : "P1REN" , regForceSet : false },
   487                    { register : "P1IES" , regForceSet : true },
   488                    { register : "P1IFG" , regForceSet : true },
   489                    { register : "P1IE"  , regForceSet : false },
   490                    { register : "P2OUT" , regForceSet : true  },
   491                    { register : "P2SEL" , regForceSet : false },
   492                    { register : "P2DIR" , regForceSet : false },
   493                    { register : "P2REN" , regForceSet : false },
   494                    { register : "P2IES" , regForceSet : true },
   495                    { register : "P2IFG" , regForceSet : true },
   496                    { register : "P2IE"  , regForceSet : false }
   497            ];
   498            
   499        /*
   500         *  GPIO Digital I/O Registers
   501         *
   502         *  One GIPO instance defines the configuration of an entire,
   503         *  8-bit wide digital I/O port.
   504         */
   505         
   506        /*! Port 1 Output Register */ 
   507        config GpioBits8PxOut_t P1OUT = {
   508            Bit0        : BIT0_OFF,
   509            Bit1        : BIT1_OFF,
   510            Bit2        : BIT2_OFF,
   511            Bit3        : BIT3_OFF,
   512            Bit4        : BIT4_OFF,
   513            Bit5        : BIT5_OFF,
   514            Bit6        : BIT6_OFF,
   515            Bit7        : BIT7_OFF
   516        };
   517    
   518        /*! Port 1 Port Select Register */
   519        config GpioBits8PxSel_t P1SEL = {
   520            Bit0        : BIT0_OFF,
   521            Bit1        : BIT1_OFF,
   522            Bit2        : BIT2_OFF,
   523            Bit3        : BIT3_OFF,
   524            Bit4        : BIT4_OFF,
   525            Bit5        : BIT5_OFF,
   526            Bit6        : BIT6_OFF,
   527            Bit7        : BIT7_OFF
   528        };
   529        
   530        /*! Port 1 Direction Register */
   531        config GpioBits8PxDir_t P1DIR = {
   532            Bit0        : BIT0_OFF,
   533            Bit1        : BIT1_OFF,
   534            Bit2        : BIT2_OFF,
   535            Bit3        : BIT3_OFF,
   536            Bit4        : BIT4_OFF,
   537            Bit5        : BIT5_OFF,
   538            Bit6        : BIT6_OFF,
   539            Bit7        : BIT7_OFF
   540        };
   541        
   542        /*! Port 1 Resistor Enable Register */
   543        config GpioBits8PxRen_t P1REN = {
   544            Bit0        : BIT0_OFF,
   545            Bit1        : BIT1_OFF,
   546            Bit2        : BIT2_OFF,
   547            Bit3        : BIT3_OFF,
   548            Bit4        : BIT4_OFF,
   549            Bit5        : BIT5_OFF,
   550            Bit6        : BIT6_OFF,
   551            Bit7        : BIT7_OFF
   552        };
   553        
   554        /*! Port 1 Interrupt Edge Select Register */
   555        config GpioBits8PxIes_t P1IES = {
   556            Bit0        : BIT0_OFF,
   557            Bit1        : BIT1_OFF,
   558            Bit2        : BIT2_OFF,
   559            Bit3        : BIT3_OFF,
   560            Bit4        : BIT4_OFF,
   561            Bit5        : BIT5_OFF,
   562            Bit6        : BIT6_OFF,
   563            Bit7        : BIT7_OFF
   564        };
   565        
   566        /*! Port 1 Interrupt Flag Register */
   567        config GpioBits8PxIfg_t P1IFG = {
   568            Bit0        : BIT0_OFF,
   569            Bit1        : BIT1_OFF,
   570            Bit2        : BIT2_OFF,
   571            Bit3        : BIT3_OFF,
   572            Bit4        : BIT4_OFF,
   573            Bit5        : BIT5_OFF,
   574            Bit6        : BIT6_OFF,
   575            Bit7        : BIT7_OFF
   576        };
   577        
   578        /*! Port 1 Interrupt Enable Register */
   579        config GpioBits8PxIe_t P1IE = {
   580            Bit0        : BIT0_OFF,
   581            Bit1        : BIT1_OFF,
   582            Bit2        : BIT2_OFF,
   583            Bit3        : BIT3_OFF,
   584            Bit4        : BIT4_OFF,
   585            Bit5        : BIT5_OFF,
   586            Bit6        : BIT6_OFF,
   587            Bit7        : BIT7_OFF
   588        };
   589    
   590        /*! Port 2 Output Register */ 
   591        config GpioBits8PxOut_t P2OUT = {
   592            Bit0        : BIT0_OFF,
   593            Bit1        : BIT1_OFF,
   594            Bit2        : BIT2_OFF,
   595            Bit3        : BIT3_OFF,
   596            Bit4        : BIT4_OFF,
   597            Bit5        : BIT5_OFF,
   598            Bit6        : BIT6_OFF,
   599            Bit7        : BIT7_OFF
   600        };
   601    
   602        /*! Port 2 Port Select Register */
   603        config GpioBits8PxSel_t P2SEL = {
   604            Bit0        : BIT0_OFF,
   605            Bit1        : BIT1_OFF,
   606            Bit2        : BIT2_OFF,
   607            Bit3        : BIT3_OFF,
   608            Bit4        : BIT4_OFF,
   609            Bit5        : BIT5_OFF,
   610            Bit6        : BIT6,         /* POR default for all 2xx devices */
   611            Bit7        : BIT7          /* POR default for all 2xx devices */
   612        };
   613        
   614        /*! Port 2 Direction Register */
   615        config GpioBits8PxDir_t P2DIR = {
   616            Bit0        : BIT0_OFF,
   617            Bit1        : BIT1_OFF,
   618            Bit2        : BIT2_OFF,
   619            Bit3        : BIT3_OFF,
   620            Bit4        : BIT4_OFF,
   621            Bit5        : BIT5_OFF,
   622            Bit6        : BIT6_OFF,
   623            Bit7        : BIT7_OFF
   624        };
   625        
   626        /*! Port 2 Resistor Enable Register */
   627        config GpioBits8PxRen_t P2REN = {
   628            Bit0        : BIT0_OFF,
   629            Bit1        : BIT1_OFF,
   630            Bit2        : BIT2_OFF,
   631            Bit3        : BIT3_OFF,
   632            Bit4        : BIT4_OFF,
   633            Bit5        : BIT5_OFF,
   634            Bit6        : BIT6_OFF,
   635            Bit7        : BIT7_OFF
   636        };
   637        
   638        /*! Port 2 Interrupt Edge Select Register */
   639        config GpioBits8PxIes_t P2IES = {
   640            Bit0        : BIT0_OFF,
   641            Bit1        : BIT1_OFF,
   642            Bit2        : BIT2_OFF,
   643            Bit3        : BIT3_OFF,
   644            Bit4        : BIT4_OFF,
   645            Bit5        : BIT5_OFF,
   646            Bit6        : BIT6_OFF,
   647            Bit7        : BIT7_OFF
   648        };
   649        
   650        /*! Port 2 Interrupt Flag Register */
   651        config GpioBits8PxIfg_t P2IFG = {
   652            Bit0        : BIT0_OFF,
   653            Bit1        : BIT1_OFF,
   654            Bit2        : BIT2_OFF,
   655            Bit3        : BIT3_OFF,
   656            Bit4        : BIT4_OFF,
   657            Bit5        : BIT5_OFF,
   658            Bit6        : BIT6_OFF,
   659            Bit7        : BIT7_OFF
   660        };
   661        
   662        /*! Port 2 Interrupt Enable Register */
   663        config GpioBits8PxIe_t P2IE = {
   664            Bit0        : BIT0_OFF,
   665            Bit1        : BIT1_OFF,
   666            Bit2        : BIT2_OFF,
   667            Bit3        : BIT3_OFF,
   668            Bit4        : BIT4_OFF,
   669            Bit5        : BIT5_OFF,
   670            Bit6        : BIT6_OFF,
   671            Bit7        : BIT7_OFF
   672        };
   673    }