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     *  ======== Boot.xdc ========
    35     *
    36     */
    37    
    38    package ti.catalog.c2800.init;
    39    
    40    import xdc.rov.ViewInfo;
    41    
    42    /*!
    43     *  ======== Boot ========
    44     *  28x Boot Support.
    45     *
    46     *  The Boot module supports boot initialization for the 28x devices.
    47     *  A special boot init function is created based on the configuration
    48     *  settings for this module.  This function is hooked into the
    49     *  xdc.runtime.Reset.fxns[] array and called very early at boot time (prior
    50     *  to cinit processing).
    51     *
    52     *  The code to support the boot module is placed in a separate section
    53     *  named `".text:.bootCodeSection"` to allow placement of this section in
    54     *  the linker .cmd file if necessary. This section is a subsection of the
    55     *  `".text"` section so this code will be placed into the .text section unless
    56     *  explicitly placed, either through
    57     *  `{@link xdc.cfg.Program#sectMap Program.sectMap}` or through a linker
    58     *  command file.
    59     */
    60    @Template("./Boot.xdt")
    61    @NoRuntime
    62    module Boot
    63    {
    64        /*! PLL type */
    65        metaonly enum Type {
    66            Type_280x,   /*! 280x (PLL configuration not supported for this type) */
    67            Type_281x,   /*! 281x (PLL configuration not supported for this type) */
    68            Type_282xx_283xx,         /*! 282xx or 283xx */
    69            Type_2802x_2803x_2806x,   /*! 2802x or 2803x or 2806x */
    70            Type_2834x                /*! 2834x */
    71        };
    72    
    73        metaonly struct ModuleView {
    74            Bool         disableWatchdog;
    75            Bool         configurePll;
    76            UInt         pllcrDIV;
    77            UInt         pllstsDIVSEL;
    78        }
    79    
    80        @Facet
    81        metaonly config ViewInfo.Instance rovViewInfo =
    82            ViewInfo.create({
    83                viewMap: [
    84                [
    85                    'Module',
    86                    {
    87                        type: ViewInfo.MODULE,
    88                        viewInitFxn: 'viewInitModule',
    89                        structName: 'ModuleView'
    90                    }
    91                ],
    92                ]
    93            });
    94    
    95        /*!
    96         *  Watchdog disable flag, default is false.
    97         *
    98         *  Set to true to disable the watchdog timer.
    99         */
   100        metaonly config Bool disableWatchdog = false;
   101    
   102        /*!
   103         *  PLL type.
   104         *
   105         *  The default will be determined by platform specification, or by the
   106         *  device ID for the generic (tms320c28) platform.
   107         */
   108        metaonly config Type pllType;
   109    
   110        /*!
   111         *  PLL configuration flag, default is false.
   112         *
   113         *  Set to true to configure the PLL.
   114         */
   115        metaonly config Bool configurePll = false;
   116    
   117        /*!
   118         *  OSCCLK input frequency to PLL, in MHz. Default is 10 MHz.
   119         *
   120         *  This is the frequency of the oscillator clock (OSCCLK) input to the
   121         *  PLL.  On some devices (e.g., TMS320C28346) this will correspond to the
   122         *  frequency of an external crystal or clock input.  On others
   123         *  (e.g., TMS320F28069) this will correspond to the frequency of an
   124         *  internal oscillator which is the default OSCCLK coming out of reset.
   125         */
   126        metaonly config UInt pllOSCCLK = 10;
   127    
   128        /*!
   129         *  PLLCR[DIV] clocking ratio value. Default is 10.
   130         *
   131         *  This is the actual value written to the DIV bits in
   132         *  the PLL Control Register (PLLCR)
   133         */
   134        metaonly config UInt pllcrDIV = 10;
   135    
   136        /*!
   137         *  PLLSTS[DIVSEL] divide select value. Default is 2.
   138         *
   139         *  This is the actual value written to the DIVSEL bits in
   140         *  the PLL Status Register (PLLSTS).
   141         *
   142         *  This configuration parameter applies for all of the
   143         *  enumerated PLL types, except for "Type_280x".
   144         */
   145        metaonly config UInt pllstsDIVSEL = 2;
   146    
   147        /*!
   148         *  Function to be called when Limp mode is detected.
   149         *
   150         *  This function is called when the Boot module is about to configure
   151         *  the PLL, but finds the device operating in Limp mode (i.e., the mode
   152         *  when a missing OSCCLK input has been detected).
   153         *
   154         *  If this function is not specified by the application, a default
   155         *  function will be used, which does an ESTOP0 and then enters an
   156         *  infinite loop.
   157         */
   158        metaonly config Fxn limpAbortFunction;
   159    
   160        /*!
   161         *  Boot from FLASH flag, default is false.
   162         *
   163         *  Set to true to enable booting from FLASH.  When set to true,
   164         *  a long branch (LB) to the c_int00 entry point will be placed at
   165         *  the BEGIN section address defined in the linker command file.
   166         */
   167        metaonly config Bool bootFromFlash = false;
   168    
   169        /*!
   170         * Configure the external memory interface (XINTF) for eZdsp283xx
   171         * boards.
   172         *
   173         * This external memory interface configuration is applicable only for
   174         * eZdsp283xx boards; it should not be enabled for any other boards.
   175         */
   176        metaonly config Bool enableEzdspXintfConfig = false;
   177    
   178        /*!
   179         * @_nodoc
   180         *  Default abort function to be called when PLL Limp mode is detected
   181         */
   182        metaonly Void defaultLimpAbort();
   183    
   184        /*!
   185         *  ======== getFrequency ========
   186         *  Gets the resulting output frequency (in Hz) given the PLL configuration
   187         *  parameters.
   188         */
   189        metaonly UInt32 getFrequency();
   190    
   191        /*!
   192         *  ======== registerFreqListener ========
   193         *  Register a module to be notified whenever the frequency changes.
   194         *
   195         *  The registered module must have a function named 'fireFrequencyUpdate'
   196         *  which takes the new frequency as an argument.
   197         */
   198        metaonly function registerFreqListener(listener);
   199    
   200    internal:
   201    
   202        /* Used to display the computed frequency value in the Grace page. */
   203        metaonly config String displayFrequency;
   204    
   205        /* Used to indicate if using on a Concerto device */
   206        metaonly config Bool concertoDevice = false;
   207    
   208    };