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     *  ======== GateProcess.xdc ========
    15     */
    16    
    17    import xdc.runtime.Assert;
    18    import xdc.runtime.Error;
    19    import xdc.runtime.IGateProvider;
    20    import xdc.runtime.knl.IGateProcessSupport;
    21    
    22    /*!
    23     *  ======== GateProcess ========
    24     *  Provides protection of critical sections across processes.
    25     *
    26     *  This module provides services through its proxy
    27     *  IGateProcessSupport interface. It has a module wide config parameter
    28     *  {@link #Proxy} which needs to be bound to an OS specific delegate before
    29     *  this module can be used.
    30     *
    31     *  Here is an example showing how the proxy is bound to an BIOS 6.x specific
    32     *  delegate.
    33     *
    34     *  @p(code)
    35     *  var GateProcess = xdc.useModule('xdc.runtime.knl.GateProcess');
    36     *  GateProcess.Proxy =
    37     *      xdc.useModule('ti.sysbios.xdcruntime.GateProcessSupport');
    38     *  @p
    39     *
    40     *  Typically the package containing the delegates have a Settings module that 
    41     *  will bind all {@link xdc.runtime.knl} proxies. The following
    42     *  example sets up all the xdc.runtime.knl proxies.
    43     *
    44     *  @p(code)
    45     *  xdc.useModule("ti.sysbios.xdcruntime.Settings");
    46     *  @p
    47     */
    48    @InstanceInitError      /* because initialization can fail */
    49    @InstanceFinalize       /* have to GateProcess_Proxy_delete(gate) on delete */
    50    @RomConsts
    51    
    52    module GateProcess inherits IGateProvider
    53    {
    54        /*! Status returned by {@link #getReferenceCount} when there is an error */
    55        const Int GETREFCOUNT_FAILED = -1;
    56    
    57        /*! Proxy that needs to be bound to an OS specific delegate. */
    58        proxy Proxy inherits IGateProcessSupport;
    59    
    60        /*! Assert when  an invalid key is passed to create */
    61        config Assert.Id A_invalidKey = {
    62            msg: "A_invalidKey: the key must be set to a non-default value"
    63        };
    64    
    65    instance:
    66    
    67        /*! 
    68         *  globally unique key for SysV-style semaphore 
    69         *
    70         *  This is a required parameter.
    71         */
    72        config Int key = -1;
    73    
    74       /*!
    75        *  ======== create ========
    76        *  Create a GateProcess object.
    77        *
    78        *  This function creates a new `GateProcess` object which is initialized to
    79        *  count.  All gates created with the same key reference the same
    80        *  underlying synchronization object and work between processes.  For
    81        *  compatibility with the IGateProvider interface the argument key is
    82        *  passes in the params struct rather than as a full argument, but it is
    83        *  required.  Therefore calling this function with a `NULL` params struct
    84        *  is illegal.
    85        */
    86        override create();
    87    
    88        /*!
    89         *  ======== getReferenceCount ========
    90         *  Get the number of processes with references to this Gate.
    91         *
    92         *  @param(eb)        Pointer to Error.Block
    93         *  @a(returns)       Returns the number of processes that possess a 
    94         *                    reference to this gate, or GETREFCOUNT_FAILED if an 
    95         *            error occured.
    96         */
    97        Int getReferenceCount(Error.Block *eb);
    98        
    99    internal:
   100    
   101        struct Instance_State {
   102            Proxy.Handle proxyHandle;
   103        }
   104    }
   105    /*
   106     *  @(#) xdc.runtime.knl; 1, 0, 0,0; 7-26-2016 11:46:36; /db/ztree/library/trees/xdc/xdc-B21/src/packages/
   107     */
   108