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
51 module GateProcess inherits IGateProvider
52 {
53 /*! Status returned by {@link #getReferenceCount} when there is an error */
54 const Int GETREFCOUNT_FAILED = -1;
55
56 /*! Proxy that needs to be bound to an OS specific delegate. */
57 proxy Proxy inherits IGateProcessSupport;
58
59 /*! Assert when an invalid key is passed to create */
60 config Assert.Id A_invalidKey = {
61 msg: "A_invalidKey: the key must be set to a non-default value"
62 };
63
64 instance:
65
66 /*!
67 * globally unique key for SysV-style semaphore
68 *
69 * This is a required parameter.
70 */
71 config Int key = -1;
72
73 /*!
74 * ======== create ========
75 * Create a GateProcess object.
76 *
77 * This function creates a new `GateProcess` object which is initialized to
78 * count. All gates created with the same key reference the same
79 * underlying synchronization object and work between processes. For
80 * compatibility with the IGateProvider interface the argument key is
81 * passes in the params struct rather than as a full argument, but it is
82 * required. Therefore calling this function with a `NULL` params struct
83 * is illegal.
84 */
85 override create();
86
87 /*!
88 * ======== getReferenceCount ========
89 * Get the number of processes with references to this Gate.
90 *
91 * @param(eb) Pointer to Error.Block
92 * @a(returns) Returns the number of processes that possess a
93 * reference to this gate, or GETREFCOUNT_FAILED if an
94 * error occured.
95 */
96 Int getReferenceCount(Error.Block *eb);
97
98 internal:
99
100 struct Instance_State {
101 Proxy.Handle proxyHandle;
102 }
103 }
104 /*
105 * @(#) xdc.runtime.knl; 1, 0, 0,101; 9-14-2010 16:36:40; /db/ztree/library/trees/xdc/xdc-v49x/src/packages/
106 */
107