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