]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/rm-lld.git/blobdiff - include/rm_loc.h
.gitignore left out k2e/k2l makefile
[keystone-rtos/rm-lld.git] / include / rm_loc.h
index 870b7bea5134762574ce3151337eb7d426de055f..dd6539ff6f938771ad989acc9ba25a64e3ae7964 100644 (file)
  *  \par
 */
 
-#ifndef RMLOC_H_
-#define RMLOC_H_
+#ifndef RM_LOC_H_
+#define RM_LOC_H_
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 /* RM external includes */
+#include <ti/drv/rm/rm.h>
 #include <ti/drv/rm/rm_services.h>
-#include <ti/drv/rm/rm_transport.h>
 
 /* RM internal includes */
+#include <ti/drv/rm/include/rm_internal.h>
+#include <ti/drv/rm/include/rm_allocatorloc.h>
 #include <ti/drv/rm/include/rm_policyloc.h>
+#include <ti/drv/rm/include/rm_transportloc.h>
 #include <ti/drv/rm/include/rm_nameserverloc.h>
 #include <ti/drv/rm/include/rm_treeloc.h>
 
-/**
- * @brief RM protocol packet resource information
- */
-typedef struct {
-    /** Resource name of resource affected by command */
-    char     name[RM_NAME_MAX_CHARS];
-    /** If applicable, start of resource range affected by command.  If
-     *  RM_RESOURCE_UNSPECIFIED is assigned the higher level RM agent*/
-    int32_t  base;
-    /** If applicable, number of specified resource, starting from base, affected by command */
-    uint32_t length;
-    /** If applicable, the alignment of the resource affected by the command */
-    int32_t  alignment;
-    /** If applicable, the NameServer name assigned to the specified
-     *  resource.  Used for commands centering on RM NameServer actions */
-    char     nameServerName[RM_NAME_MAX_CHARS];
-} Rm_ResourceInfo;
-
-/**
- * @brief RM transactions are the internalized version of service requests received 
- *        from components and RM commands received from other RM instances.
- *        Transactions that cannot immediately be serviced are placed in the RM
- *        instance's transaction queue.  The transactions track all service
- *        requests within the RM infrastructure.
- */
+/* Service transaction linked list node */
 typedef struct Rm_Transaction_s {
-    /** Transaction service type */
-    Rm_ServiceType type;
-    /** Local ID of the transaction. */
-    uint32_t localId;
-    /** ID of transaction in RM instance that generated the
-     *  packet that resulted in the creation of the transaction.  The
-     *  originating ID will be placed in the transaction's response packet
-     *  to the lower level RM instance.  The lower level RM instance will 
-     *  match the response packet with the originating request using the ID */
-    uint32_t remoteOriginatingId;
-    /** Name of the RM instance the RM packet, that spawned the transaction,
-     *  originated from */
-    char pktSrcInstName[RM_NAME_MAX_CHARS];
-    /** Transaction's associated callback function */
-    Rm_ServiceCallback callback;
-    /** Transaction state.  The codes are externally visible and tracked
-     *  in rmservices.h */
-    int32_t state;
-    /** Transaction has been forwarded to CD or Server instance.  Waiting for response */
-    bool hasBeenForwarded;
-    /** Name of the RM instance the service originated from */
-    char serviceSrcInstName[RM_NAME_MAX_CHARS];    
-    /** Resource information */
-    Rm_ResourceInfo resourceInfo;
-    /** Link to the next transaction in the queue */
+    /* Transaction service type */
+    Rm_ServiceType           type;
+    /* Local ID of the transaction. */
+    uint32_t                 localId;
+    /* ID of transaction in RM instance that generated the
+     * packet that resulted in the creation of the transaction.  The
+     * originating ID will be placed in the transaction's response packet
+     * The RM instance that receives the response will 
+     * match the response packet with the originating request using the ID */
+    uint32_t                 remoteOriginatingId;
+    /* Transaction response mechanism union */
+    union {
+        /* Service callback function if received locally via Service API */
+        Rm_ServiceCallback   callback;
+        /* Transport handle to send response packet on if received via Transport rcv API */
+        Rm_Transport        *respTrans;
+    } u;
+    /* Transaction state.  The codes are defined in rm.h */
+    int32_t                  state;
+    /* Transaction has been forwarded to CD or Server instance.  Waiting for response */
+    int8_t                   hasBeenForwarded;
+    /* The transaction ID for a transaction pending on a CD while this
+     * transaction is sent to the Server as a request for data required to complete
+     * pending transaction */
+    uint32_t                 pendingTransactionId;
+    /* Name of the RM instance the service originated from */
+    char                     serviceSrcInstName[RM_NAME_MAX_CHARS];    
+    /* Resource information */
+    Rm_ResourceInfo          resourceInfo;
+    /* Link to the next transaction in the queue */
     struct Rm_Transaction_s *nextTransaction;    
 } Rm_Transaction;
 
+/* Server-specific instance data */
 typedef struct {
-    const void *rangeData;
-    int32_t     rangeLen;
-    const void *nsAssignData;
-    int32_t     nsAssignLen;
-    const void *linuxAliasData;
-    int32_t     linuxAliasLen;
-} Rm_ResourceProperties;
-
-typedef enum {
-    Rm_allocatorOp_ALLOCATE = 0,
-    Rm_allocatorOp_FREE,
-    Rm_allocatorOp_PRE_ALLOCATE
-} Rm_AllocatorOp;
+    /* Pointer to the global policy */
+    void                   *globalPolicy;
+    /* Policy size in bytes */
+    uint32_t                policySize;
+    /* Pointer to root entry of the global policy valid instance tree */
+    Rm_PolicyValidInstTree *globalValidInstTree;
+    /* Pointer to the linked list of allocators */
+    Rm_Allocator           *allocators;
+    /* Pointer to the root entry of the NameServer */
+    Rm_NameServerTree      *nameServer;
+} Rm_ServerInstData;
 
+/* Client Delegate-specific instance data */
 typedef struct {
-    Rm_PolicyValidInstNode *serviceSrcInstNode;
-    Rm_AllocatorOp          operation;
-    uint32_t                allocType;
-    Rm_ResourceInfo        *resourceInfo;
-} Rm_AllocatorOpInfo;
-
-typedef struct Rm_Allocator_s {
-    char                   resourceName[RM_NAME_MAX_CHARS];
-    /** Pointer to the first resource entry in the allocator */
-    void                  *allocatorRootEntry;
-    /** Pointer to next resource allocator */
-    struct Rm_Allocator_s *nextAllocator;
-} Rm_Allocator;
-
+    /* Pointer to the cd policy if provided */
+    void                   *cdPolicy;
+    /* Pointer to the root entry of the valid instance tree
+     * extracted from the cd policy */
+    Rm_PolicyValidInstTree *cdValidInstTree;
+    /* Pointer to the linked list of allocators */
+    Rm_Allocator           *allocators;    
+} Rm_ClientDelegateInstData;
+
+/* Client-specific instance data */
 typedef struct {
+    /* Pointer to the static policy if provided */
     void                   *staticPolicy;
+    /* Pointer to the root entry of the valid instance tree
+     * extracted from the static policy */
     Rm_PolicyValidInstTree *staticValidInstTree;
-} Rm_StaticInfo;
+} Rm_ClientInstData;
 
+/* Shared Client-specific instance data */
 typedef struct {
-    char                    instName[RM_NAME_MAX_CHARS];
-    Rm_InstType             instType;
-    /* Instance locks if static request fails when checked against global policy */
-    bool                    isLocked;
-    Rm_ServiceHandle       *serviceHandle;
-    bool                    registeredWithDelegateOrServer;
-    void                   *policy;
-    Rm_PolicyValidInstTree *validInstances;    
-    Rm_Allocator           *allocators;
-    Rm_NameServerTree      *nameServer;
-    void                   *transports;
-    uint32_t                transactionSeqNum;
-    Rm_Transaction         *transactionQueue;
-    Rm_TransportCallouts    transportCallouts;
-    Rm_StaticInfo           staticInfo;
+    /* Shared Server instance handle */
+    Rm_Handle sharedServerHandle;
+} Rm_SharedClientInstData;
+
+/* RM instance structure */
+typedef struct {
+    /* Name given to the RM instance.  Policy will assign resources based
+     * on the names assigned to instances at instance init */
+    char              instName[RM_NAME_MAX_CHARS];
+    /* Instance type */
+    Rm_InstType       instType;
+    /* Instance lock status.  Instance locks if static request fails when
+     * checked against global policy */
+    int8_t            isLocked;
+    /* Tracks whether the instance has registered with a CD or Server.
+     * Applicable to CD and Client instances */
+    int8_t            registeredWithDelegateOrServer;    
+    /* Pointer to the serviceHandle opened from the instance */
+    Rm_ServiceHandle *serviceHandle;
+    /* Linked list of transports registered by the application */
+    Rm_Transport     *transports;
+    /* Service transaction sequence number tracker */
+    uint32_t          transactionSeqNum;
+    /* Service transaction linked list queue */
+    Rm_Transaction   *transactionQueue; 
+    /* Block handle provided through OSAL for when RM needs to block due to
+     * a service request that requires a blocking operation to complete and
+     * a service callback function has not been provided */
+    void             *blockHandle;
+    /* Instance-type specific constructs */
+    union {
+        /* Server-specific instance data */
+        Rm_ServerInstData         server;
+        /* Client Delegate-specific instance data */
+        Rm_ClientDelegateInstData cd;
+        /* Client-specific instance data */
+        Rm_ClientInstData         client;
+        /* Shared Client-specific instance data */
+        Rm_SharedClientInstData   sharedClient;
+    } u;
 } Rm_Inst;
 
 Rm_Transaction *rmTransactionQueueAdd(Rm_Inst *rmInst);
 Rm_Transaction *rmTransactionQueueFind(Rm_Inst *rmInst, uint32_t transactionId);
 int32_t rmTransactionQueueDelete(Rm_Inst *rmInst, uint32_t transactionId);
-Rm_Allocator *rmAllocatorFind(Rm_Allocator *allocatorList, char *resourceName);
-void rmTransactionProcessor (Rm_Inst *rmInst, Rm_Transaction *transaction);
+void rmProcessRouter(Rm_Inst *rmInst, Rm_Transaction *transaction);
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* RMLOC_H_ */
+#endif /* RM_LOC_H_ */