aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'packages/xdais/ti/xdais/ires_common.h')
-rw-r--r--packages/xdais/ti/xdais/ires_common.h207
1 files changed, 207 insertions, 0 deletions
diff --git a/packages/xdais/ti/xdais/ires_common.h b/packages/xdais/ti/xdais/ires_common.h
new file mode 100644
index 0000000..5562d45
--- /dev/null
+++ b/packages/xdais/ti/xdais/ires_common.h
@@ -0,0 +1,207 @@
1/*
2 * Copyright (c) 2006-2012, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 */
33/**
34 * @file ti/xdais/ires_common.h
35 *
36 * @brief IRES Resource Protocol Definitions - IRES Resource
37 */
38
39#ifndef IRES_COMMON_
40#define IRES_COMMON_
41
42/** @ingroup DSPIRES */
43/*@{*/
44
45
46#ifdef __cplusplus
47extern "C" {
48#endif
49
50#include "ialg.h"
51
52
53/**
54 * @brief IRES_Status defines the standard error and success codes
55 * returned by IRES APIs.
56 */
57typedef enum IRES_Status {
58 IRES_OK = 0, /**< Success */
59 IRES_EALG = 1, /**< Error in algorithm IRES_Fxns functions */
60 IRES_EEXISTS = 2, /**< Error, already exists */
61 IRES_EFAIL = 3, /**< Generic Error Message */
62 IRES_EINIT = 4, /**< Error, already initialized */
63 IRES_ENOINIT = 5, /**< Error, not initialized */
64 IRES_ENOMEM = 6, /**< Error, not enough memory */
65 IRES_ENORESOURCE = 7, /**< Error, resource unavailable*/
66 IRES_ENOTFOUND = 8 /**< Error, not found */
67} IRES_Status;
68
69/**
70 * @brief Protocol revision type.
71 * Used to ensure the given 'protocol' revision can be validated.
72 */
73typedef struct IRES_ProtocolRevision {
74 unsigned int Major;
75 unsigned int Source;
76 unsigned int Radius; /* Using unsigned int here to support
77 * xdc/std.h as well as tistdtypes.h
78 */
79} IRES_ProtocolRevision;
80
81
82/**
83 * @brief Mode in which resources can be requested.
84 */
85typedef enum IRES_RequestMode {
86 IRES_SCRATCH, /**< Indicates that resource requested
87 * can be shared with other
88 * algorithms in the same group.
89 */
90 IRES_PERSISTENT, /**< Indicates that resource requested
91 * for allocation exclusively for
92 * this algorithm.
93 */
94 IRES_LATEACQUIRE /**< Indicates that resource requested
95 * will not be granted immediately, but
96 * afterwards. Specific IRES APIs will need
97 * to be called, to ensure that a particular
98 * algorithm is the only user of these
99 * resources.
100 */
101} IRES_RequestMode;
102
103
104/**
105 * @brief Abstract Protocol Arguments structure definition.
106 * Actual arguments passed by the algorithm to request a resource
107 * from a specific IRES Protocol will extend and supply the
108 * concrete definitions.
109 */
110typedef struct IRES_ProtocolArgs {
111
112 Int32 size; /**< Size of this structure. */
113 IRES_RequestMode mode; /**< Resource request mode.
114 *
115 * @sa IRES_RequestMode
116 */
117} IRES_ProtocolArgs;
118
119/**
120 * @brief Descriptor to Logical Resource.
121 */
122typedef struct IRES_ResourceDescriptor {
123
124 /**
125 * String containing the package name to identify the resource.
126 */
127 String resourceName;
128
129 /**
130 * @brief Pointer to the Resource Protocol Arguments.
131 *
132 * @remark The Resource Manager selects the appropriate resource protocol
133 * based on the supplied @c resourceName, and uses the protocol to
134 * construct the IRES Resource Handle.
135 */
136 struct IRES_ProtocolArgs *protocolArgs;
137
138 /**
139 * @brief The revision of the IRES_ResourceProtocol Interface expected
140 * by the client algorithm.
141 *
142 * @remark Depending on the resource manager implementation,
143 * the returned resource may/may not coincide with the version
144 * being requested. Resource manager will update this field with
145 * the version of the handle it returns (and supports).
146 */
147 IRES_ProtocolRevision *revision;
148
149 /**
150 * The handle to the object representing the requested resource.
151 * The handle is initially set to 'null' by the requesting algorithm.
152 * The 'resource manager' allocates the resource and constructs the
153 * handle.
154 */
155 struct IRES_Obj *handle;
156
157} IRES_ResourceDescriptor;
158
159/**
160 * @brief Abstract Resource Properties structure/pointer definition.
161 * Actual resource protocol will supply the concrete property
162 * definitions.
163 * The list of attributes for the actual resource will expose the
164 * relevant features that needs to be known to a client to use the
165 * resource, such as: resource register base addresses and offsets,
166 * critical register and memory region addresses, ...
167 */
168typedef struct IRES_Properties {
169 Int32 size; /**< Size of this structure. */
170} IRES_Properties;
171
172/**
173 * @brief IRES_Obj holds the private state associated with each
174 * logical resource.
175 */
176typedef struct IRES_Obj {
177
178 /**
179 * Indicates if the resource has been allocated as persistent.
180 */
181 Int32 persistent;
182
183 /**
184 * Obtain the static properties associated with this resource
185 * This could include information like the register layer of the
186 * device etc.
187 */
188 Void (*getStaticProperties)(struct IRES_Obj *resourceHandle,
189 IRES_Properties *resourceProperties);
190
191} IRES_Obj;
192
193/**
194 * @brief Handle to "logical" resource
195 */
196typedef struct IRES_Obj *IRES_Handle;
197
198
199
200#ifdef __cplusplus
201}
202#endif /* extern "C" */
203
204/*@}*/
205
206#endif /* IRES_COMMON_ */
207