1 2 3 4 5 6 7 8 9 10 11 12
13 14 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
46 @InstanceFinalize
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
104 105 106
107