1    /*
     2     * Copyright (c) 2016, Texas Instruments Incorporated
     3     * All rights reserved.
     4     *
     5     * Redistribution and use in source and binary forms, with or without
     6     * modification, are permitted provided that the following conditions
     7     * are met:
     8     *
     9     * *  Redistributions of source code must retain the above copyright
    10     *    notice, this list of conditions and the following disclaimer.
    11     *
    12     * *  Redistributions in binary form must reproduce the above copyright
    13     *    notice, this list of conditions and the following disclaimer in the
    14     *    documentation and/or other materials provided with the distribution.
    15     *
    16     * *  Neither the name of Texas Instruments Incorporated nor the names of
    17     *    its contributors may be used to endorse or promote products derived
    18     *    from this software without specific prior written permission.
    19     *
    20     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    21     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    22     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    23     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    24     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    25     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    26     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    27     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    28     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    29     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    30     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    31     */
    32    
    33    
    34    /*!
    35     *  ======== Clock ========
    36     *  MSP430 Master Clock
    37     */
    38    metaonly interface IClock inherits xdc.platform.IPeripheral {
    39    
    40        /*!
    41        *  ======== ForceSetDefaultRegister_t ========
    42        *  Force Set Default Register
    43        *
    44        *  Type to store if each register needs to be forced initialized
    45        *  even if the register is in default state.
    46        *
    47        *  @see #ForceSetDefaultRegister_t
    48        */
    49        struct ForceSetDefaultRegister_t {
    50            String     register;
    51            Bool       regForceSet;
    52        }
    53    
    54        /*!
    55        *  ======== AvailableClockVariations_t ========
    56        *  Available variations of clock in a device
    57        *
    58        *  Stores true/false if any of the clock variations are
    59        *  available.
    60        *
    61        *  @see #AvailableClockVariations_t
    62        */
    63        struct AvailableClockVariations_t {
    64            String     clockType;
    65            Bool       hasClock;
    66        }
    67    
    68    instance:
    69    
    70        /*!
    71         *  ======== baseAddr ========
    72         *  Address of the peripheral's control register.
    73         *
    74         *  A peripheral's registers are commonly accessed through a structure
    75         *  that defines the offsets of a particular register from the lowest
    76         *  address mapped to a peripheral. That lowest address is specified by
    77         *  this parameter.
    78         */
    79        config UInt baseAddr;
    80    
    81        /*!
    82         *  ======== hasHFXT1 ========
    83         *  Specify if HFXT1 is available on the device.
    84         *
    85         *  Not all devices have high frequency clock. This specifies if
    86         *  it is available for a particular device.
    87         */
    88        config Bool hasHFXT1 = false;
    89    
    90        /*!
    91         *  ======== hasXT2 ========
    92         *  Specify if XT2 is available on the device.
    93         *
    94         *  Not all devices have XT2 clock available. This specifies if
    95         *  it is available for a particular device.
    96         */
    97        config Bool hasXT2 = false;
    98    
    99        /*!
   100         *  ======== hasRosc ========
   101         *  Specify if Rosc is available on the device.
   102         *
   103         *  Not all devices have Rosc circuitry. This specifies if
   104         *  it is available for a particular device.
   105         */
   106        config Bool hasRosc = false;
   107    
   108        /*!
   109         *  ======== hasVLO ========
   110         *  Specify if VLO is available on the device.
   111         *
   112         *  Not all devices have very low frequency clock VLO. This specifies if
   113         *  it is available for a particular device.
   114         */
   115        config Bool hasVLO = false;
   116    
   117        /*!
   118         *  ======== hasAllCal ========
   119         *  Specify if device has all calibration constants.
   120         *
   121         *  G1 devices do not.
   122         */
   123        config Bool hasAllCal = false;
   124    
   125        /*!
   126         *  ======== maxCpuFrequency ========
   127         *  Maximum CPU frequency in Hertz
   128         */
   129        config Float maxCpuFrequency = 0;
   130    
   131        /*!
   132         *  ======== DCOCLKHz ========
   133         *  DCO clock frequency in Hertz
   134         */
   135        readonly config Float DCOCLKHz = 1000000;
   136    
   137        /*!
   138         *  ======== ACLKHz ========
   139         *  ACLK frequency in Hertz
   140         */
   141        readonly config Float ACLKHz;
   142    
   143        /*!
   144         *  ======== MCLKHz ========
   145         *  MCLK frequency in Hertz
   146         */
   147        readonly config Float MCLKHz;
   148    
   149        /*!
   150         *  ======== SMCLKHz ========
   151         *  SMCLK frequency in Hertz
   152         */
   153        readonly config Float SMCLKHz;
   154    
   155        /*!
   156         *  ======== computeDCOCLKHz ========
   157         *  Initialize to the nearest available DCO clock frequency
   158         */
   159        void computeDCOCLKHz(Float DCOCLKHz);
   160    }