1 /**
2 * @file rm_policy.h
3 *
4 * @brief
5 * This is the RM include file for the policy APIs
6 *
7 * \par
8 * ============================================================================
9 * @n (C) Copyright 2012, Texas Instruments, Inc.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 *
18 * Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the
21 * distribution.
22 *
23 * Neither the name of Texas Instruments Incorporated nor the names of
24 * its contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 *
39 * \par
40 */
42 #ifndef RM_POLICY_H_
43 #define RM_POLICY_H_
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
49 /**
50 @addtogroup RM_POLICY_API
51 @{
52 */
53 /**
54 * @brief Maximum number of characters in the policy name
55 */
56 #define RM_MAX_POLICY_NAME_LENGTH 8
58 /**
59 * @brief Policy handle
60 */
61 typedef uint32_t *Rm_PolicyHandle;
63 /**
64 * @brief Result of RM policy operations
65 */
66 typedef int32_t Rm_PolicyResult;
68 /**
69 * @brief Structure populated by policy API with basic RM policy information
70 */
71 typedef struct {
72 /** Policy name */
73 char policyName[RM_MAX_POLICY_NAME_LENGTH] ;
74 /** Policy handle */
75 Rm_PolicyHandle policyHandle;
76 } Rm_PolicyInfo;
78 /**
79 * @b Description
80 * @n
81 * This function returns the number of policies located within a RM
82 * instance tree
83 *
84 * @param[in] serverHandle
85 * RM tree's server handle. Used to report the number of policies for
86 * the given server handle's instance tree
87 *
88 * @retval
89 * Number of policies located within the instance tree
90 */
91 uint32_t Rm_numPoliciesInTree(Rm_Handle serverHandle);
93 /**
94 * @b Description
95 * @n
96 * This function returns a list of all policies within the system. The
97 * list will contain a policy name and handle for each policy.
98 *
99 * @param[in] serverHandle
100 * RM tree's server handle. Used to query the policy information for
101 * the given server handle's instance tree
102 *
103 * @param[in] *policyInfoArray
104 * An array of Rm_PolicyInfo structures that will contain information for
105 * all policies within the instance tree upon function return.
106 *
107 * Note: The size of the array passed must be equal to or greater than
108 * the number of policies returned by the Rm_numPoliciesInTree API
109 *
110 * @retval
111 * SUCCESS - 0
112 * @retval
113 * FAILURE - non-zero value
114 */
115 Rm_PolicyResult Rm_listPolicies(Rm_Handle serverHandle, Rm_PolicyInfo *policyInfoArray);
117 The following API input parameters are not finalized yet as they are a wrapper around the DTB modification APIs provided in the dtc library. The input parameters will be finalized as the operation of the dtc API is better understood.
119 /* Policy create/delete APIs */
121 /* May not allow additional input parameters. Created policies can be
122 * modified using the policy modification APIs */
123 Rm_PolicyHandle Rm_createPolicy(Rm_Handle serverHandle, ...);
124 Rm_PolicyResult Rm_deletePolicy(Rm_PolicyHandle);
126 /* Policy modification APIs */
127 Rm_PolicyResult Rm_addInstToPolicy(Rm_PolicyHandle, ...);
128 Rm_PolicyResult Rm_deleteInstFromPolicy(Rm_PolicyHandle, ...);
129 Rm_PolicyResult Rm_addResourceToPolicy(Rm_PolicyHandle, instName, ...);
130 Rm_PolicyResult Rm_deleteResourceFromPolicy(Rm_PolicyHandle, instName, ...);
131 Rm_PolicyResult Rm_modifyResourceProp(Rm_PolicyHandle, instName, resName ...);
133 /* Read Policy APIs */
134 Rm_PolicyResult Rm_listPolicyInstances(Rm_PolicyHandle, ...);
135 Rm_PolicyResult Rm_listInstResources(Rm_PolicyHandle, instName, ...);
136 Rm_PolicyResult Rm_listPolicyResourceProperties(Rm_PolicyHandle, instName,
137 resourceName, ...);
140 /**
141 @}
142 */
144 #ifdef __cplusplus
145 }
146 #endif
148 #endif /* RM_POLICY_H_ */