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.
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
49 @InstanceFinalize
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 107
108