1    /*
     2     *  Copyright (c) 2015 by 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     * */
    12    
    13    /*
    14     *  ======== Boot.xdc ========
    15     *
    16     */
    17    
    18    package ti.catalog.c2800.initF2837x;
    19    
    20    import xdc.rov.ViewInfo;
    21    
    22    /*!
    23     *  ======== Boot ========
    24     *  Soprano Boot Support.
    25     *
    26     *  The Boot module supports boot initialization for the C28 Soprano cores.
    27     *  A special boot init function is created based on the configuration
    28     *  settings for this module.  This function is hooked into the
    29     *  xdc.runtime.Reset.fxns[] array and called very early at boot time (prior
    30     *  to cinit processing).
    31     *
    32     *  The code to support the boot module is placed in a separate section
    33     *  named `".text:.bootCodeSection"` to allow placement of this section in
    34     *  the linker .cmd file if necessary. This section is a subsection of the
    35     *  `".text"` section so this code will be placed into the .text section unless
    36     *  explicitly placed, either through
    37     *  `{@link xdc.cfg.Program#sectMap Program.sectMap}` or through a linker
    38     *  command file.
    39     */
    40    @Template("./Boot.xdt")
    41    @NoRuntime
    42    module Boot
    43    {
    44        /*! System PLL Fractional Multiplier (SPLLFMULT) value */
    45        metaonly enum FractMult {
    46            Fract_0  = 0x000,       /*! Fractional multiplier is 0    */
    47            Fract_25 = 0x100,       /*! Fractional multiplier is 0.25 */
    48            Fract_50 = 0x200,       /*! Fractional multiplier is 0.5  */
    49            Fract_75 = 0x300        /*! Fractional multiplier is 0.75 */
    50        }
    51    
    52        metaonly struct ModuleView {
    53            Bool configureClocks;
    54            UInt OSCCLK;
    55            UInt SPLLIMULT;
    56            String SPLLFMULT;
    57            String SYSCLKDIVSEL;
    58            Bool bootCPU2;
    59        }
    60    
    61        @Facet
    62        metaonly config ViewInfo.Instance rovViewInfo =
    63            ViewInfo.create({
    64                viewMap: [
    65                [
    66                    'Module',
    67                    {
    68                        type: ViewInfo.MODULE,
    69                        viewInitFxn: 'viewInitModule',
    70                        structName: 'ModuleView'
    71                    }
    72                ],
    73                ]
    74            });
    75    
    76        /*!
    77         *  Clock configuration flag, default is false.
    78         *
    79         *  Set to true to configure the PLL and system subsystem clock
    80         *  dividers.
    81         */
    82        config Bool configureClocks = false;
    83    
    84        /*!
    85         *  Watchdog disable flag, default is false.
    86         *
    87         *  Set to true to disable the watchdog timer.
    88         */
    89        metaonly config Bool disableWatchdog = false;
    90    
    91        /*!
    92         *  OSCCLK input frequency to PLL, in MHz. Default is 10 MHz.
    93         *
    94         *  This is the frequency of the oscillator clock (OSCCLK) input to the
    95         *  PLL.
    96         */
    97        metaonly config UInt OSCCLK = 20;
    98    
    99        /*! System PLL Integer Multiplier (SPLLIMULT) value */
   100        metaonly config UInt SPLLIMULT = 1;
   101    
   102        /*! System PLL Fractional Multiplier (SPLLFMULT) value */
   103        metaonly config FractMult SPLLFMULT = Fract_0;
   104    
   105        /*! System Clock Divider Select (SYSCLKDIVSEL) value */
   106        metaonly config UInt SYSCLKDIVSEL = 2;
   107    
   108        /*!
   109         *  Flash controller configuration flag, default is true.
   110         *
   111         *  Set to true to enable the configuration of the Flash controller
   112         *  wait states, program and data cache.
   113         */
   114        metaonly config Bool configureFlashController = true;
   115    
   116        /*!
   117         *  Flash controller wait states configuration flag, default is true.
   118         *
   119         *  Set to true to configure the Flash controller wait states.  The number
   120         *  of wait states is computed based upon the CPU frequency.
   121         */
   122        metaonly config Bool configureFlashWaitStates = true;
   123    
   124        /*!
   125         *  Flash controller program cache enable flag, default is true.
   126         *
   127         *  Set to true to enable the Flash controller's program cache.
   128         */
   129        metaonly config Bool enableFlashProgramCache = true;
   130    
   131        /*!
   132         *  Flash controller data cache enable flag, default is true.
   133         *
   134         *  Set to true to enable the Flash controller's data cache.
   135         */
   136        metaonly config Bool enableFlashDataCache = true;
   137    
   138        /*!
   139         *  Function to be called when Limp mode is detected.
   140         *
   141         *  This function is called when the Boot module is about to configure
   142         *  the PLL, but finds the device operating in Limp mode (i.e., the mode
   143         *  when a missing OSCCLK input has been detected).
   144         *
   145         *  If this function is not specified by the application, a default
   146         *  function will be used, which spins in an infinite loop.
   147         */
   148        metaonly config Fxn limpAbortFunction;
   149    
   150        /*!
   151         *  Boot from Flash flag.  Default is true.
   152         *
   153         *  Set to true to enable booting CPU1 from Flash.
   154         */
   155        metaonly config Bool bootFromFlash = true;
   156    
   157        /*!
   158         *  Initiate booting of the CPU2 processor.  Default is false.
   159         *
   160         *  Set to true to enable CPU1 to initiate boot of CPU2.
   161         *
   162         *  If enabled, this will occur after the optional clock configuration
   163         *  step, enabled by `{@link #configureClocks}`.
   164         */
   165        metaonly config Bool bootCPU2 = false;
   166    
   167        /*!
   168         *  Configure Shared RAM regions before booting the C28 processor.
   169         *  Default is true.
   170         *
   171         *  Set to true to enable Shared RAM regions S0-S7, to set the
   172         *  owner of each region and the write access permissions for the onwer.
   173         */
   174        metaonly config Bool configSharedRAMs = true;
   175    
   176       /*!
   177         *  ======== sharedMemoryOwnerMask ========
   178         *  Shared RAM owner select mask.
   179         *
   180         *  This parameter is used for writing the GSxMSEL register.
   181         *  By default, each value of each shared RAM select bit is '0'.
   182         *  This means the CPU1 is the owner and has write access.
   183         *  Setting a '1' in any bit position makes CPU2 the owner of that
   184         *  shared RAM segment.
   185         */
   186        metaonly config Bits32 sharedMemoryOwnerMask = 0;
   187    
   188        /*!
   189         *  ======== loadSegment ========
   190         *  Specifies where to load the flash function (include the 'PAGE' number)
   191         *
   192         *  If 'configureFlashWaitStates' is true, then this parameter
   193         *  determines where the ".ti_catalog_c2800_initF2837x_flashfuncs"
   194         *  section gets loaded.
   195         */
   196        metaonly config String loadSegment;
   197    
   198        /*!
   199         *  ======== runSegment ========
   200         *  Specifies where to run the flash function (include the 'PAGE' number)
   201         *
   202         *  If 'configureFlashWaitStates' is true then this parameter
   203         *  determines where the ".ti_catalog_c2800_initF2837x_flashfuncs"
   204         *  section gets executed at runtime.
   205         */
   206        metaonly config String runSegment;
   207    
   208        /*!
   209         *  @_nodoc
   210         *  ======== getFrequency ========
   211         *  Gets the resulting CPU frequency (in Hz) given the Clock
   212         *  configuration parameters.
   213         *
   214         */
   215        UInt32 getFrequency();
   216    
   217        /*!
   218         *  @_nodoc
   219         *  ======== registerFreqListener ========
   220         *  Register a module to be notified whenever the frequency changes.
   221         *
   222         *  The registered module must have a function named 'fireFrequencyUpdate'
   223         *  which takes the new frequency as an argument.
   224         */
   225        function registerFreqListener();
   226    
   227    internal:
   228    
   229        /* The computed timestamp frequency */
   230        metaonly config UInt timestampFreq;
   231    
   232        /* Used to display the computed CPU frequency value in the Grace page. */
   233        metaonly config String displayFrequency;
   234    
   235        /* The computed Flash wait states */
   236        metaonly config UInt flashWaitStates = 3;
   237    
   238    };
   239    /*
   240     *  @(#) ti.catalog.c2800.initF2837x; 1, 0, 0,; 8-14-2015 13:38:25; /db/ztree/library/trees/platform/platform-q07/src/
   241     */
   242