1    /* 
     2     * Copyright (c) 2011, 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     *  ======== Idle.xdc ========
    34     *
    35     */
    36    package ti.sysbios.knl;
    37    
    38    import xdc.rov.ViewInfo;
    39    
    40    /*!
    41     *  ======== Idle ========
    42     *  Idle Thread Manager.
    43     *
    44     *  The Idle module is used to specify the list of functions to be called
    45     *  when no other tasks are running in the system. 
    46     *  
    47     *  If tasking is enabled, then the Task module will create an "Idle task" 
    48     *  with the lowest possible priority. When no other tasks are running, this
    49     *  idle task runs in an infinite loop, calling the list of functions 
    50     *  specified by the Idle module. 
    51     *
    52     *  If tasking is disabled, then the idle functions are called in an infinite
    53     *  loop after main and any Module startup functions.
    54     *
    55     *  The list of idle functions is only statically configurable; it cannot be
    56     *  modified at runtime.
    57     */
    58    
    59    module Idle
    60    {
    61        /*! Idle function type definition. */
    62        typedef Void (*FuncPtr)();
    63    
    64        metaonly struct ModuleView {
    65            UInt    index;
    66            String  fxn;
    67        }
    68        
    69        /*! @_nodoc */
    70        @Facet
    71        metaonly config ViewInfo.Instance rovViewInfo = 
    72            xdc.rov.ViewInfo.create({
    73                viewMap: [
    74                    ['Idle.funcList',
    75                        {
    76                            type: ViewInfo.MODULE_DATA,   
    77                            viewInitFxn: 'viewInitModule',   
    78                            structName: 'ModuleView'
    79                        }
    80                    ]
    81                ]
    82            });
    83        
    84        /*!
    85         *  ======== funcList ========
    86         *  The array of functions to be called when no other Tasks are running.
    87         */
    88        config FuncPtr funcList[length] = [];
    89        
    90        /*!
    91         *  ======== addFunc ========
    92         *  Statically add a function to the Idle function list.
    93         */
    94        metaonly Void addFunc(FuncPtr func);
    95        
    96        /*!
    97         *  ======== loop ========
    98         *  @_nodoc
    99         *  Idle loop which calls the idle functions in an infinite loop.
   100         *
   101         *  This function is called internally and is not normally intended
   102         *  to be called by the client.
   103         *
   104         *  When tasking is enabled, the Task module creates an Idle task which
   105         *  simply calls this function. If tasking is disabled, then this function
   106         *  is called after main and any module startup functions.
   107         *
   108         *  The body of this function is an infinite loop that calls the "run" 
   109         *  function.
   110         */
   111        @DirectCall
   112        Void loop(UArg arg1, UArg arg2);
   113    
   114        /*!
   115         *  ======== run ========
   116         *  Make one pass through idle functions
   117         *
   118         *  This function is called internally by the Idle task when
   119         *  the Idle task has been enabled in the Task module 
   120         *  (see {@link Task#enableIdleTask}). 
   121         *
   122         *  This function makes one pass through the array of functions defined
   123         *  in the {@link #funcList Idle.funcList}, calling one function after 
   124         *  the next. This function returns after all functions have been 
   125         *  executed one time.
   126         *
   127         *  @see Task#enableIdleTask
   128         *  @see Task#allBlockedFunc
   129         */
   130        @DirectCall
   131        Void run();
   132    
   133    }
   134    /*
   135     *  @(#) ti.sysbios.knl; 2, 0, 0, 0,451; 2-2-2011 15:07:13; /db/vtree/library/trees/avala/avala-o27x/src/ xlibrary
   136    
   137     */
   138