1    /* 
     2     * Copyright (c) 2009
     3     * Texas Instruments
     4     *
     5     *  All rights reserved.  Property of Texas Instruments
     6     *  Restricted rights to use, duplicate or disclose this code are
     7     *  granted through contract.
     8     * 
     9     * */
    10    /*
    11     *  ======== Timer.xdc ========
    12     *
    13     */
    14    package ti.sysbios.hal;
    15    
    16    import xdc.rov.ViewInfo;
    17    
    18    /*!
    19     *  ======== Timer ========
    20     *  Timer Manager Proxy.
    21     *
    22     *  This module behaves as a proxy to the generic Timer module functions 
    23     *  as defined in ITimer.xdc.
    24     *
    25     *  The actual implementations of the Timer module functions are
    26     *  provided by the Timer module delegates.
    27     *
    28     *  Additional, family specific Timer module APIs may also be provided by
    29     *  the Timer module delegates.
    30     *
    31     *  Follow the link below to determine which Timer delegate is used
    32     *  for your Target/Device:
    33     *
    34     *      {@link ./../family/doc-files/delegates.html Delegate Mappings}
    35     *
    36     *  @p(html)
    37     *  <h3> Calling Context </h3>
    38     *  <table border="1" cellpadding="3">
    39     *    <colgroup span="1"></colgroup> <colgroup span="5" align="center"></colgroup>
    40     *
    41     *    <tr><th> Function                 </th><th>  Hwi   </th><th>  Swi   </th><th>  Task  </th><th>  Main  </th><th>  Startup  </th></tr>
    42     *    <!--                                                                                                                 -->
    43     *    <tr><td> {@link #getNumTimers}            </td><td>   Y    </td><td>   Y    </td><td>   Y    </td><td>   Y    </td><td>   N    </td></tr>
    44     *    <tr><td> {@link #getStatus}               </td><td>   Y    </td><td>   Y    </td><td>   Y    </td><td>   Y    </td><td>   N    </td></tr>
    45     *    <tr><td> {@link #Params_init}             </td><td>   Y    </td><td>   Y    </td><td>   Y    </td><td>   Y    </td><td>   N    </td></tr>
    46     *    <tr><td> {@link #construct}               </td><td>   Y    </td><td>   Y    </td><td>   Y    </td><td>   Y    </td><td>   N    </td></tr>
    47     *    <tr><td> {@link #create}                  </td><td>   N    </td><td>   N    </td><td>   Y    </td><td>   Y    </td><td>   N    </td></tr>
    48     *    <tr><td> {@link #delete}                  </td><td>   N    </td><td>   N    </td><td>   Y    </td><td>   Y    </td><td>   N    </td></tr>
    49     *    <tr><td> {@link #destruct}                </td><td>   Y    </td><td>   Y    </td><td>   Y    </td><td>   Y    </td><td>   N    </td></tr>
    50     *    <tr><td> {@link #getFreq}                 </td><td>   Y    </td><td>   Y    </td><td>   Y    </td><td>   Y    </td><td>   N    </td></tr>
    51     *    <tr><td> {@link #getPeriod}               </td><td>   Y    </td><td>   Y    </td><td>   Y    </td><td>   Y    </td><td>   N    </td></tr>
    52     *    <tr><td> {@link #setPeriod}               </td><td>   Y    </td><td>   Y    </td><td>   Y    </td><td>   Y    </td><td>   N    </td></tr>
    53     *    <tr><td> {@link #setPeriodMicroSecs}      </td><td>   Y    </td><td>   Y    </td><td>   Y    </td><td>   Y    </td><td>   N    </td></tr>
    54     *    <tr><td> {@link #start}                   </td><td>   Y    </td><td>   Y    </td><td>   Y    </td><td>   N    </td><td>   N    </td></tr>
    55     *    <tr><td> {@link #stop}                    </td><td>   Y    </td><td>   Y    </td><td>   Y    </td><td>   N    </td><td>   N    </td></tr>
    56     *    <tr><td colspan="6"> Definitions: <br />
    57     *       <ul>
    58     *         <li> <b>Hwi</b>: API is callable from a Hwi thread. </li>
    59     *         <li> <b>Swi</b>: API is callable from a Swi thread. </li>
    60     *         <li> <b>Task</b>: API is callable from a Task thread. </li>
    61     *         <li> <b>Main</b>: API is callable during any of these phases: </li>
    62     *           <ul>
    63     *             <li> In your module startup after this module is started (e.g. Timer_Module_startupDone() returns TRUE). </li>
    64     *             <li> During xdc.runtime.Startup.lastFxns. </li>
    65     *             <li> During main().</li>
    66     *             <li> During BIOS.startupFxns.</li>
    67     *           </ul>
    68     *         <li> <b>Startup</b>: API is callable during any of these phases:</li>
    69     *           <ul>
    70     *             <li> During xdc.runtime.Startup.firstFxns.</li>
    71     *             <li> In your module startup before this module is started (e.g. Timer_Module_startupDone() returns FALSE).</li>
    72     *           </ul>
    73     *       </ul>
    74     *    </td></tr>
    75     *
    76     *  </table>
    77     *  @p
    78     */
    79    
    80    @ModuleStartup
    81    @InstanceFinalize       /* Needed to forward Timer_delete() call to proxy */
    82    @InstanceInitError      /* To report unavailability of timer */
    83    
    84    module Timer inherits ti.sysbios.interfaces.ITimer 
    85    {
    86        metaonly struct BasicView {
    87            String      label;
    88            String      delegateTimerHandle;
    89            UInt        id;
    90            String      startMode;
    91            String      runMode;
    92            UInt        period;
    93            String      periodType;
    94            UInt        intNum;
    95            String      tickFxn;
    96            UArg        arg;
    97            String      HwiHandle;
    98        };
    99    
   100        metaonly struct ModuleView {
   101            String      delegateTimerModule;
   102        };
   103    
   104        @Facet
   105        metaonly config ViewInfo.Instance rovViewInfo = 
   106            ViewInfo.create({
   107                viewMap: [
   108                    ['Basic',    {type: ViewInfo.INSTANCE, viewInitFxn: 'viewInitBasic',    structName: 'BasicView'}],
   109                    ['Module',   {type: ViewInfo.MODULE,   viewInitFxn: 'viewInitModule',   structName: 'ModuleView'}]
   110                ]
   111            });
   112    
   113    internal:   /* not for client use */
   114    
   115        /*! target/device specific Timer implementation. */
   116        proxy TimerProxy inherits ti.sysbios.interfaces.ITimer;
   117    
   118        struct Instance_State {
   119            TimerProxy.Handle pi;
   120        };
   121    }
   122    /*
   123     *  @(#) ti.sysbios.hal; 2, 0, 0, 0,351; 12-18-2009 15:12:46; /db/vtree/library/trees/avala/avala-m19x/src/
   124     */
   125