]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/rm-lld.git/blob - include/rm_loc.h
Converted boolean variables to ints
[keystone-rtos/rm-lld.git] / include / rm_loc.h
1 /*
2  *  file  rm_loc.h
3  *
4  *  General private data structures of Resource Manager.
5  *
6  *  ============================================================================
7  *      (C) Copyright 2012-2013, Texas Instruments, Inc.
8  * 
9  *  Redistribution and use in source and binary forms, with or without 
10  *  modification, are permitted provided that the following conditions 
11  *  are met:
12  *
13  *    Redistributions of source code must retain the above copyright 
14  *    notice, this list of conditions and the following disclaimer.
15  *
16  *    Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the 
18  *    documentation and/or other materials provided with the   
19  *    distribution.
20  *
21  *    Neither the name of Texas Instruments Incorporated nor the names of
22  *    its contributors may be used to endorse or promote products derived
23  *    from this software without specific prior written permission.
24  *
25  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
26  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
27  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
29  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
30  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
31  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
34  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
35  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  *
37  *  \par
38 */
40 #ifndef RM_LOC_H_
41 #define RM_LOC_H_
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
47 /* RM external includes */
48 #include <ti/drv/rm/rm.h>
49 #include <ti/drv/rm/rm_services.h>
51 /* RM internal includes */
52 #include <ti/drv/rm/include/rm_internal.h>
53 #include <ti/drv/rm/include/rm_allocatorloc.h>
54 #include <ti/drv/rm/include/rm_policyloc.h>
55 #include <ti/drv/rm/include/rm_transportloc.h>
56 #include <ti/drv/rm/include/rm_nameserverloc.h>
57 #include <ti/drv/rm/include/rm_treeloc.h>
59 /* Static allocation configuration structure */
60 typedef struct {
61     /* Instance name */
62     char                   *instName;
63     /* Static policy */
64     void                   *staticPolicy;
65     /* Static valid instance tree */
66     Rm_PolicyValidInstTree *staticValidInstTree;
67 } Rm_StaticAllocCfg;
69 /* Service transaction linked list node */
70 typedef struct Rm_Transaction_s {
71     /* Transaction service type */
72     Rm_ServiceType           type;
73     /* Local ID of the transaction. */
74     uint32_t                 localId;
75     /* ID of transaction in RM instance that generated the
76      * packet that resulted in the creation of the transaction.  The
77      * originating ID will be placed in the transaction's response packet
78      * The RM instance that receives the response will 
79      * match the response packet with the originating request using the ID */
80     uint32_t                 remoteOriginatingId;
81     /* Name of the RM instance that generated the packet that resulted
82      * in the creation of the service transaction.  Used to send the response
83      * packet. */
84     char                     pktSrcInstName[RM_NAME_MAX_CHARS];
85     /* Transaction service callback function */
86     Rm_ServiceCallback       callback;
87     /* Transaction state.  The codes are defined in rm.h */
88     int32_t                  state;
89     /* Transaction has been forwarded to CD or Server instance.  Waiting for response */
90     int8_t                   hasBeenForwarded;
91     /* Name of the RM instance the service originated from */
92     char                     serviceSrcInstName[RM_NAME_MAX_CHARS];    
93     /* Resource information */
94     Rm_ResourceInfo          resourceInfo;
95     /* Link to the next transaction in the queue */
96     struct Rm_Transaction_s *nextTransaction;    
97 } Rm_Transaction;
99 /* Server-specific instance data */
100 typedef struct {
101     /* Pointer to the global policy */
102     void                   *globalPolicy;
103     /* Pointer to root entry of the global policy valid instance tree */
104     Rm_PolicyValidInstTree *globalValidInstTree;
105     /* Pointer to the linked list of allocators */
106     Rm_Allocator           *allocators;
107     /* Pointer to the root entry of the NameServer */
108     Rm_NameServerTree      *nameServer;
109 } Rm_ServerInstData;
111 /* Client Delegate-specific instance data */
112 typedef struct {
113     /* Pointer to the static policy if provided */
114     void                   *staticPolicy;
115     /* Pointer to the root entry of the valid instance tree
116      * extracted from the static policy */
117     Rm_PolicyValidInstTree *staticValidInstTree;
118 } Rm_ClientDelegateInstData;
120 /* Client-specific instance data */
121 typedef struct {
122     /* Pointer to the static policy if provided */
123     void                   *staticPolicy;
124     /* Pointer to the root entry of the valid instance tree
125      * extracted from the static policy */
126     Rm_PolicyValidInstTree *staticValidInstTree;
127 } Rm_ClientInstData;
129 /* RM instance structure */
130 typedef struct {
131     /* Name given to the RM instance.  Policy will assign resources based
132      * on the names assigned to instances at instance init */
133     char              instName[RM_NAME_MAX_CHARS];
134     /* Instance type */
135     Rm_InstType       instType;
136     /* Instance lock status.  Instance locks if static request fails when
137      * checked against global policy */
138     int8_t            isLocked;
139     /* Tracks whether the instance has registered with a CD or Server.
140      * Applicable to CD and Client instances */
141     int8_t            registeredWithDelegateOrServer;    
142     /* Pointer to the serviceHandle opened from the instance */
143     Rm_ServiceHandle *serviceHandle;
144     /* Linked list of transports registered by the application */
145     Rm_Transport     *transports;
146     /* Service transaction sequence number tracker */
147     uint32_t          transactionSeqNum;
148     /* Service transaction linked list queue */
149     Rm_Transaction   *transactionQueue; 
150     /* Block handle provided through OSAL for when RM needs to block due to
151      * a service request that requires a blocking operation to complete and
152      * a service callback function has not been provided */
153     void             *blockHandle;
154     /* Instance-type specific constructs */
155     union {
156         /* Server-specific instance data */
157         Rm_ServerInstData         server;
158         /* Client Delegate-specific instance data */
159         Rm_ClientDelegateInstData cd;
160         /* Client-specific instance data */
161         Rm_ClientInstData         client;        
162     } u;
163 } Rm_Inst;
165 Rm_Transaction *rmTransactionQueueAdd(Rm_Inst *rmInst);
166 Rm_Transaction *rmTransactionQueueFind(Rm_Inst *rmInst, uint32_t transactionId);
167 int32_t rmTransactionQueueDelete(Rm_Inst *rmInst, uint32_t transactionId);
168 void rmProcessRouter(Rm_Inst *rmInst, Rm_Transaction *transaction);
170 #ifdef __cplusplus
172 #endif
174 #endif /* RM_LOC_H_ */