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 * ======== Sync.xdc ========
15 */
16 import xdc.runtime.Error;
17 import xdc.runtime.Assert;
18 import xdc.runtime.knl.ISync;
19
20 /*!
21 * ======== Sync ========
22 * Provides synchronization APIs when an ISync.Handle is available.
23 *
24 * The application must first obtain an ISync.Handle.
25 * It can get such a handle by directly calling {@link SyncGeneric#create} or
26 * {@link SyncSemThread#create}. Then the application can use the generic
27 * APIs provided by this module.
28 */
29
30 module Sync
31 {
32 /*!
33 * ======== WaitStatus ========
34 * Error codes returned by Sync_wait
35 */
36 enum WaitStatus {
37 WaitStatus_ERROR = -1,
38 WaitStatus_TIMEOUT = 0,
39 WaitStatus_SUCCESS = 1
40 };
41
42 /*!
43 * Proxy used for optimization.
44 *
45 * If ALL ISync.Handles were created using the same module
46 * (e.g SyncSemProcess) then setting this Proxy to SyncSemProcess and
47 * setting Sync.Proxy.abstractInstances$ = false,
48 * Sync APIs can have better performance.
49 */
50 proxy Proxy inherits ISync;
51
52 /*!
53 * ======== query ========
54 * Query for a particular quality.
55 *
56 * FALSE is returned if quality not supported.
57 *
58 * @param(sync) sync handle
59 * @param(qual) quality
60 * @b(returns) TRUE or FALSE.
61 */
62 Bool query(ISync.Handle sync, Int qual);
63
64 /*!
65 * ======== signal ========
66 * Called at completion of an activity.
67 *
68 * This function is non-blocking. It is also required that the underlying
69 * sync be binary in nature.
70 *
71 * @param(sync) sync handle
72 */
73 Void signal(ISync.Handle sync);
74
75 /*!
76 * ======== wait ========
77 * Called to wait/poll for completion of an activity.
78 *
79 * This function can block. Non-blocking implementations should return
80 * ;
81 * Wait for the semaphore to become available.
82 *
83 * @p(blist) 84 * -{@link #WaitStatus_ERROR} if an error occured.
85 * -{@link #WaitStatus_TIMEOUT} denotes timeout.
86 * -{@link #WaitStatus_SUCCESS} semaphore was decremented.
87 * @p 88 *
89 * @param(sync) sync handle
90 * @param(timeout) timeout in microseconds
91 * @b(returns) see description above
92 */
93 Int wait(ISync.Handle sync, UInt timeout, Error.Block *eb);
94 }
95 /*
96 * @(#) xdc.runtime.knl; 1, 0, 0,88; 5-27-2010 16:42:31; /db/ztree/library/trees/xdc/xdc-v38x/src/packages/
97 */
98