diff --git a/include/rm_loc.h b/include/rm_loc.h
index bebad4543fee3e30ca5a64394746da9931199bb7..dd6539ff6f938771ad989acc9ba25a64e3ae7964 100644 (file)
--- a/include/rm_loc.h
+++ b/include/rm_loc.h
* General private data structures of Resource Manager.
*
* ============================================================================
- * (C) Copyright 2012, Texas Instruments, Inc.
+ * (C) Copyright 2012-2013, Texas Instruments, Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* \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_policy.h>
-#include <ti/drv/rm/rm_transport.h>
-#if 0
-/* RM permissions structure for CPPI DMA channels and flows */
-typedef struct
-{
- /** Array of pointers to each DMAs channel or flow permissions
- * From CPPI LLD - DMA 0 = SRIO
- * DMA 1 = AIF
- * DMA 2 = FFTC A
- * DMA 3 = FFTC B
- * DMA 4 = PASS
- * DMA 5 = QMSS
- * DMA 6 = FFTC C
- * DMA 7 = BCP
- *
- * Note: Some DMAs may not be supported based on the device */
- Rm_Perms *dmaPermPtrs[RM_CPPI_MAX_DMAS];
-} Rm_CppiChAndFlowPerms;
-
-/* RM Cache Line Alignment Defines and Macros */
-
-#define RM_MAX_CACHE_ALIGN 128 /* Maximum alignment for cache line size */
-
-/* This macro generates compiler error if postulate is false, so
- * allows 0 overhead compile time size check. This "works" when
- * the expression contains sizeof() which otherwise doesn't work
- * with preprocessor */
-#define RM_COMPILE_TIME_SIZE_CHECK(postulate) \
- do { \
- typedef struct { \
- uint8_t NegativeSizeIfPostulateFalse[((int)(postulate))*2 - 1];\
- } PostulateCheck_t; \
- } \
- while (0)
-
-/* Macro to pad out internal permission structures to multiple of RM_MAX_CACHE_ALIGN bytes
- * The macro prevent something else from being placed on same cache line as the permission.
- * arrays. Note that pad[0] is illegal, so must add full RM_MAX_CACHE_ALIGN if structure
- * is already padded by chance. */
-#define RM_ALIGN_PERMISSIONS_ARRAY(numElements, permStructType) ( \
- (((sizeof(permStructType) * (numElements)) % RM_MAX_CACHE_ALIGN) == 0) ? (numElements) : \
- ((numElements) + \
- (RM_MAX_CACHE_ALIGN - \
- ((sizeof(permStructType) * (numElements)) % RM_MAX_CACHE_ALIGN))/sizeof(permStructType)))
-
-/* RM Global Sync Object (unpadded) */
-typedef struct
-{
- /** Rm_init/Rm_start synchronization object. */
- uint8_t globalSyncObj;
-} Rm_Sync_Obj_Unpadded;
-
-/* RM Global Sync Object (padded) */
-typedef struct
-{
- /** Data structure without padding, so sizeof() can compute padding */
- Rm_Sync_Obj_Unpadded obj;
- /** Pad out to end of RM_MAX_CACHE_ALIGN bytes to prevent something else
- * from being placed on same cache line as Rm_Synci_Obj. Note that
- * pad[0] is illegal, so must add full RM_MAX_CACHE_ALIGN if structure
- * is already padded by chance. */
- uint8_t pad[RM_MAX_CACHE_ALIGN -
- (sizeof(Rm_Sync_Obj_Unpadded) % RM_MAX_CACHE_ALIGN)];
-} Rm_Sync_Obj;
-#endif
-
-/** Maximum size of a transmittable RM policy in bytes */
-#define RM_MAX_POLICY_SIZE_BYTES (64) // Placeholder: This will change
- // during development
-
-/** Pointer to RM instance's transport routing map */
-typedef void *Rm_TransportRouteMap;
-
-/** Pointer to RM instance's transaction queue */
-typedef void *Rm_TransactionQueue;
-
-/** Pointer to the RM instance's allocators */
-typedef void *Rm_Allocators;
-
-/**
- * @brief RM transaction details values. Details values provide more fine-grained
- * information regarding a transaction request or response
- */
-typedef enum {
- /** Transaction is being processed */
- Rm_transactionState_PROCESSING = 0,
- /** Transaction has been approved */
- Rm_transactionState_TRANSACTION_APPROVED = 1,
- /** Transaction has been denied */
- Rm_transactionState_TRANSACTION_DENIED = 2
-} Rm_TransactionState;
-
-/**
- * @brief RM protocol packet resource information
- */
-typedef struct {
- /** Resource name of resource affected by command */
- char name[RM_RESOURCE_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, range of specified resource, starting from base, affected by command */
- uint32_t range;
- /** 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 nsName[RM_RESOURCE_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.
- */
-typedef struct {
- /** Transaction service type */
- Rm_ServiceType type;
- /** Local ID of the transaction. */
- uint32_t localId;
- /** ID of transaction on lower level 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 transaction originated from */
- char sourceInstName[RM_INSTANCE_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;
- /** Resource information */
- Rm_ResourceInfo resourceInfo;
- /** Link to the next transaction in the queue */
- void *nextTransaction;
+/* 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>
+
+/* 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
+ * 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 *allocatorData;
- int32_t allocatorLen;
- const void *rangeData;
- int32_t rangeLen;
- const void *nsAssignData;
- int32_t nsAssignLen;
-} Rm_ResourceProperties;
-
-typedef enum {
- Rm_allocatorType_INTEGER = 0,
- Rm_allocatorType_TREE = 1,
-} Rm_AllocatorType;
-
+ /* 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 {
- uint32_t value;
- bool allocated;
- char allocatedTo[RM_INSTANCE_NAME_MAX_CHARS];
-} Rm_IntegerEntry;
-
+ /* 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 {
- uint32_t numResourceElements;
- Rm_IntegerEntry *resourceArrayBase;
-} Rm_IntegerAllocatorRootEntry;
-
+ /* 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_ClientInstData;
+
+/* Shared Client-specific instance data */
typedef struct {
- char resourceName[RM_RESOURCE_NAME_MAX_CHARS];
- Rm_AllocatorType type;
- /** Pointer to the first resource entry in the allocator */
- void *allocatorRootEntry;
- /** Pointer to next resource allocator */
- void *nextAllocator;
-} Rm_Allocator;
+ /* Shared Server instance handle */
+ Rm_Handle sharedServerHandle;
+} Rm_SharedClientInstData;
+/* RM instance structure */
typedef struct {
- char name[RM_INSTANCE_NAME_MAX_CHARS];
- Rm_InstType instType;
- bool registeredWithDelegateOrServer;
- Rm_PolicyHandle policyDtb;
- Rm_Allocators allocators;
- /* RM instance transport parameters */
- Rm_TransportRouteMap routeMap;
- /* RM Transaction sequence number counter */
- uint32_t transactionSeqNum;
- /* RM transaction queue */
- Rm_TransactionQueue transactionQueue;
- /* Transport API function pointers - not global in case application wants to
- * hook up different transports to RM */
- Rm_TransportCallouts transport;
+ /* 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 *Rm_transactionQueueAdd(Rm_Inst *rmInst);
-Rm_Transaction *Rm_transactionQueueFind(Rm_Inst *rmInst, uint32_t transactionId);
-int32_t Rm_transactionQueueDelete(Rm_Inst *rmInst, uint32_t transactionId);
-uint32_t Rm_transactionGetSequenceNum(Rm_Inst *rmInst);
-
-void Rm_transactionProcessor (Rm_Inst *rmInst, Rm_Transaction *transaction);
+Rm_Transaction *rmTransactionQueueAdd(Rm_Inst *rmInst);
+Rm_Transaction *rmTransactionQueueFind(Rm_Inst *rmInst, uint32_t transactionId);
+int32_t rmTransactionQueueDelete(Rm_Inst *rmInst, uint32_t transactionId);
+void rmProcessRouter(Rm_Inst *rmInst, Rm_Transaction *transaction);
#ifdef __cplusplus
}
#endif
-#endif /* RMLOC_H_ */
+#endif /* RM_LOC_H_ */