1    /* 
     2     *  Copyright (c) 2008 Texas Instruments. All rights reserved.
     3     *  This program and the accompanying materials are made available under the
     4     *  terms of the Eclipse Public License v1.0 and Eclipse Distribution License
     5     *  v. 1.0 which accompanies this distribution. The Eclipse Public License is
     6     *  available at http://www.eclipse.org/legal/epl-v10.html and the Eclipse
     7     *  Distribution License is available at
     8     *  http://www.eclipse.org/org/documents/edl-v10.php.
     9     *
    10     *  Contributors:
    11     *      Texas Instruments - initial implementation
    12     * */
    13    /*
    14     *  ======== GateH.xdc ========
    15     */
    16    
    17    import xdc.runtime.IGateProvider;
    18    
    19    /*!
    20     *  ======== GateH ========
    21     *  Provides APIs to protect critical sections when an IGate.Handle is
    22     *  available.
    23     *
    24     *  An application can isolate itself from IGate implementations by using
    25     *  this module. The application must first obtain an IGate.Handle.
    26     *  It can get such a handle by directly calling {@link GateThread#create} or
    27     *  {@link GateProcess#create}. Then the application can use the generic
    28     *  APIs provided by this module.
    29     *
    30     *  The underlying gates are nesting in nature and users have to leave
    31     *  the gate as many times as they entered it.
    32     */
    33    @DirectCall
    34    
    35    module GateH
    36    {
    37        /*!
    38         *  Proxy used for optimization.
    39         *
    40         *  The GateH.Proxy config param may be used to optimize this module. If all
    41         *  the instances supplied to GateH functions are created using the same
    42         *  module (e.g. GateMutex), then setting this Proxy to that module and
    43         *  disabling abstract instances will allow for better run-time
    44         *  optimization.
    45         *
    46         *  Caution: all instances used by GateH in a given executable must be
    47         *  created by the same module in order to use this optimization technique.
    48         *
    49         * Configuration Script
    50         *
    51         * @p(code)
    52         * var GateH = xdc.useModule('xdc.runtime.knl.GateH');
    53         * GateH.Proxy = xdc.useModule('ti.sysbios.gates.GateMutex');
    54         * GateH.Proxy.abstractInstances$ = false;
    55         * @p
    56         *
    57         * Target Code
    58         *
    59         * @p(code)
    60         * #include <xdc/runtime/IGateProvider.h>
    61         * #include <xdc/runtime/knl/GateH.h>
    62         * #include <ti/sysbios/gates/GateMutex.h>
    63         *
    64         * GateMutex_Handle gate;
    65         * IGateProvider_Handle igate;
    66         * IArg key;
    67         *
    68         * gate = GateMutex_create(NULL, NULL);
    69         * igate = GateMutex_Handle_upCast(gate);
    70         *
    71         * key = GateH_enter(igate);
    72         * ...
    73         * GateH_leave(igate, key);
    74         * @p
    75         */
    76        proxy Proxy inherits IGateProvider;
    77    
    78        /*!
    79         * ======== enter ========
    80         * Enter a gate
    81         *
    82         * @param(hdl)    IGateProvider.Handle
    83         * @a(returns)    key
    84         */
    85        IArg enter(IGateProvider.Handle hdl);
    86    
    87        /*!
    88         * ======== leave ========
    89         * Leave a gate
    90         *
    91         * @param(hdl)    IGateProvider.Handle
    92         * @param(key)    key returned by enter();
    93         */
    94        Void leave(IGateProvider.Handle hdl, IArg key);
    95    }
    96    /*
    97     *  @(#) xdc.runtime.knl; 1, 0, 0,0; 2-20-2019 10:22:54; /db/ztree/library/trees/xdc/xdc-F09/src/packages/
    98     */
    99