]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/rm-lld.git/commitdiff
Fixed copyrights, unified MAX_NAME_LENGTH, removed rm_types
authorJustin Sobota <jsobota@ti.com>
Tue, 29 Jan 2013 21:13:54 +0000 (16:13 -0500)
committerJustin Sobota <jsobota@ti.com>
Tue, 29 Jan 2013 21:13:54 +0000 (16:13 -0500)
33 files changed:
build/buildlib.xs
config.bld
docs/Module.xs
include/Module.xs
include/rm_dtb_utilloc.h
include/rm_loc.h
include/rm_nameserverloc.h
include/rm_policyloc.h
include/rm_servicesloc.h
include/rm_transportloc.h
include/rm_treeloc.h
package.bld
package.xdc
rm.h
rm_osal.h
rm_services.h
rm_transport.h
rm_types.h [deleted file]
rmver.h.xdt
setupenv.bat
src/Module.xs
src/rm.c
src/rm_dtb_util.c
src/rm_nameserver.c
src/rm_policy.c
src/rm_services.c
src/rm_transport.c
src/rm_tree.c
test/Module.xs
test/rm_osal.c
test/rm_osal.h
test/rm_test.c
test/rm_test.cfg

index 555360e8e1f855853fa20c4814b2feedd1d0713f..4934b5a6745894e38b6b67030dcb00a9cb5da3c9 100644 (file)
@@ -7,7 +7,7 @@
  *  This file contains common routines that are used by the various RM \r
  *  components.\r
  *\r
- * Copyright (C) 2012, Texas Instruments, Inc.\r
+ * Copyright (C) 2012-2013, Texas Instruments, Inc.\r
  *****************************************************************************/\r
 \r
 /**************************************************************************\r
index 52364eca5f438daab5c059bebea32e7d602214dd..5f9ef0e8f92ab195844d5727b7d2e137deed69b1 100644 (file)
@@ -8,7 +8,7 @@
  *  and is responsible for configuration of the paths for the various tools\r
  *  required to build RM.\r
  *\r
- * Copyright (C) 2012, Texas Instruments, Inc.\r
+ * Copyright (C) 2012-2013, Texas Instruments, Inc.\r
  *****************************************************************************/\r
 \r
 /* Get the Tools Base directory from the Environment Variable. */\r
index d72e3b5c7e6208cfffecb48c2d7c11212592a3d0..0c36291b99ac3cb0f4d549a4d19d324ee079df86 100644 (file)
@@ -6,7 +6,7 @@
  * DESCRIPTION: \r
  *  This file contains the module specification for the RM Documentation.\r
  *\r
- * Copyright (C) 2012, Texas Instruments, Inc.\r
+ * Copyright (C) 2012-2013, Texas Instruments, Inc.\r
  *****************************************************************************/\r
 \r
 /* Load the library utility. */\r
index e246743ef9261fe06023f1f98bc7957f42fed397..39336f91adf7b31120b04357d575ff80cb9be86d 100644 (file)
@@ -6,7 +6,7 @@
  * DESCRIPTION: 
  *  This file contains the module specification for RM include directory
  *
- * Copyright (C) 2012, Texas Instruments, Inc.
+ * Copyright (C) 2012-2013, Texas Instruments, Inc.
  *****************************************************************************/
 
 /* Load the library utility. */
index 78fcaa5fbe3ec9015f6740289bbcedc4f0306662..c7273c105b8b4c303a9e60dfcdeeca37f4d75ee1 100644 (file)
@@ -4,7 +4,7 @@
  *  Private Resource List and Policy DTB Parsing Utilities
  *
  *  ============================================================================
- *      (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 
@@ -44,9 +44,8 @@
 extern "C" {
 #endif
 
-/**********************************************************************
- *************Common RM DTB Parsing Defines and Functions**************
- **********************************************************************/
+/* RM external includes */
+#include <ti/drv/rm/rm.h>
 
 /** 
 * @brief LIBFDT's return codes start at 1.  Map a return value of 0 to an okay result
@@ -61,6 +60,18 @@ extern "C" {
 * @brief DTB starting depth for parsing
 */
 #define RM_DTB_UTIL_STARTING_DEPTH 0
+/** 
+* @brief Linux DTB alias offset not set
+*/
+#define RM_DTB_LINUX_ALIAS_OFFSET_NOT_SET 0xFFFF
+/** 
+* @brief Depth of the RM instance nodes in the policy DTB
+*/
+#define RM_POLICY_DTB_INSTANCE_DEPTH 1
+
+/**********************************************************************
+ ******************* Common DTB Parsing Definitions *******************
+ **********************************************************************/
 
 typedef struct Rm_ResourceRange_s {
     uint32_t                   base;
@@ -74,14 +85,9 @@ typedef struct Rm_ResourceValue_s {
 } Rm_ResourceValue;
 
 /**********************************************************************
- ***********Resource List DTB Parsing Defines and Functions************
+ ************* Global Resource List Parsing Definitions ***************
  **********************************************************************/
 
-/** 
-* @brief Linux DTB alias offset not set
-*/
-#define RM_DTB_LINUX_ALIAS_OFFSET_NOT_SET 0xFFFF
-
 typedef enum {
     /** Resource DTB unknown property type */
     Rm_resourcePropType_UNKNOWN = 0,  
@@ -90,7 +96,7 @@ typedef enum {
     /** Resource DTB resource alias path in Linux DTB */
     Rm_resourcePropType_RESOURCE_LINUX_ALIAS,    
     /** Resource DTB NameServer assignment property type */
-    Rm_resourcePropType_NSASSIGNMENT,    
+    Rm_resourcePropType_NSASSIGNMENT  
 } Rm_ResourcePropType;
 
 typedef struct Rm_LinuxAlias_s {
@@ -101,31 +107,16 @@ typedef struct Rm_LinuxAlias_s {
 } Rm_LinuxAlias;
 
 typedef struct Rm_NsAssignment_s {
-    char                      nsName[RM_RESOURCE_NAME_MAX_CHARS];
+    char                      nsName[RM_NAME_MAX_CHARS];
     uint32_t                  resourceBase;
     uint32_t                  resourceLength;
     struct Rm_NsAssignment_s *nextNsAssignment;
 } Rm_NsAssignment;
 
-Rm_ResourcePropType rmDtbUtilResGetPropertyType(const char *propertyName);
-Rm_ResourceRange *rmDtbUtilResExtractRange(const void *dtbDataPtr, int32_t dtbDataLen);
-void rmDtbUtilResFreeRange(Rm_ResourceRange *rangeList);
-Rm_LinuxAlias *rmDtbUtilResExtractLinuxAlias(const void *dtbDataPtr, int32_t dtbDataLen,
-                                             int32_t *result);
-void rmDtbUtilResFreeLinuxAlias(Rm_LinuxAlias *aliasList);
-Rm_NsAssignment *rmDtbUtilResExtractNsAssignment(const void *dtbDataPtr, int32_t dtbDataLen, 
-                                                 int32_t *result);
-void rmDtbUtilResFreeNsAssignmentList(Rm_NsAssignment *nsAssignmentList);
-
 /**********************************************************************
- ***************Policy DTB Parsing Defines and Functions***************
+ ********************* Policy Parsing Definitions *********************
  **********************************************************************/
 
-/** 
-* @brief Depth of the RM instance nodes in the policy DTB
-*/
-#define RM_POLICY_DTB_INSTANCE_DEPTH 1
-
 typedef enum {
     /** Policy DTB unknown property type */
     Rm_policyPropType_UNKNOWN = 0,     
@@ -136,21 +127,48 @@ typedef enum {
     /** Policy DTB allocation alignment property type */
     Rm_policyPropType_ALLOCATION_ALIGNMENT,
     /** Policy DTB valid RM instances property type */
-    Rm_policyPropType_VALID_INSTANCES,
+    Rm_policyPropType_VALID_INSTANCES
 } Rm_PolicyPropType;
 
 typedef struct Rm_PolicyAssignment_s {
-    uint32_t resourceBase;
-    uint32_t resourceLength;
-    char *permissionsList;
+    uint32_t                      resourceBase;
+    uint32_t                      resourceLength;
+    char                         *permissionsList;
     struct Rm_PolicyAssignment_s *nextAssignment;
 } Rm_PolicyAssignment;
 
 typedef struct Rm_PolicyValidInst_s {
-    char                         instName[RM_INSTANCE_NAME_MAX_CHARS];
+    char                         instName[RM_NAME_MAX_CHARS];
     struct Rm_PolicyValidInst_s *nextValidInst;
 } Rm_PolicyValidInst;
 
+/**********************************************************************
+ ******************** Linux DTB Parsing Definitions *******************
+ **********************************************************************/
+
+typedef struct Rm_LinuxValueRange_s {
+    uint32_t                     value;
+    struct Rm_LinuxValueRange_s *nextValue;
+} Rm_LinuxValueRange;
+
+/**********************************************************************
+ *************** Global Resource List Parsing Functions ***************
+ **********************************************************************/
+
+Rm_ResourcePropType rmDtbUtilResGetPropertyType(const char *propertyName);
+Rm_ResourceRange *rmDtbUtilResExtractRange(const void *dtbDataPtr, int32_t dtbDataLen);
+void rmDtbUtilResFreeRange(Rm_ResourceRange *rangeList);
+Rm_LinuxAlias *rmDtbUtilResExtractLinuxAlias(const void *dtbDataPtr, int32_t dtbDataLen,
+                                             int32_t *result);
+void rmDtbUtilResFreeLinuxAlias(Rm_LinuxAlias *aliasList);
+Rm_NsAssignment *rmDtbUtilResExtractNsAssignment(const void *dtbDataPtr, int32_t dtbDataLen, 
+                                                 int32_t *result);
+void rmDtbUtilResFreeNsAssignmentList(Rm_NsAssignment *nsAssignmentList);
+
+/**********************************************************************
+ ********************** Policy Parsing Functions***********************
+ **********************************************************************/
+
 Rm_PolicyPropType rmDtbUtilPolicyGetPropertyType(const char *propertyName);
 Rm_PolicyAssignment *rmDtbUtilPolicyExtractAssignments(const void *dtbDataPtr, int32_t dtbDataLen);
 void rmDtbUtilPolicyFreeAssignments(Rm_PolicyAssignment *assignmentList);
@@ -163,14 +181,9 @@ Rm_PolicyValidInst *rmDtbUtilPolicyExtractValidInstances(const void *dtbDataPtr,
 void rmDtbUtilPolicyFreeValidInstances (Rm_PolicyValidInst *validInstList);
 
 /**********************************************************************
- ****************Linux DTB Parsing Defines and Functions***************
+ ********************* Linux DTB Parsing Functions ********************
  **********************************************************************/
 
-typedef struct Rm_LinuxValueRange_s {
-    uint32_t                     value;
-    struct Rm_LinuxValueRange_s *nextValue;
-} Rm_LinuxValueRange;
-
 Rm_LinuxValueRange *rmDtbUtilLinuxExtractValues(const void *dtbDataPtr, int32_t dtbDataLen);
 void rmDtbUtilLinuxFreeValues(Rm_LinuxValueRange *valueList);
 
index e62bf7d9b9ee48bed60fa8e394187a0496f806f2..9e7832b537731c8aaab77157be33aec5c4b25c74 100644 (file)
@@ -4,7 +4,7 @@
  *  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 
@@ -54,19 +54,12 @@ extern "C" {
 #include <ti/drv/rm/include/rm_nameserverloc.h>
 #include <ti/drv/rm/include/rm_treeloc.h>
 
-/** 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 transaction queue */
-typedef void *Rm_TransactionQueue;
-
 /**
  * @brief RM protocol packet resource information
  */
 typedef struct {
     /** Resource name of resource affected by command */
-    char     name[RM_RESOURCE_NAME_MAX_CHARS];
+    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;
@@ -76,7 +69,7 @@ typedef struct {
     int32_t  alignment;
     /** If applicable, the NameServer name assigned to the specified
      *  resource.  Used for commands centering on RM NameServer actions */
-    char     nameServerName[RM_RESOURCE_NAME_MAX_CHARS];
+    char     nameServerName[RM_NAME_MAX_CHARS];
 } Rm_ResourceInfo;
 
 /**
@@ -86,7 +79,7 @@ typedef struct {
  *        instance's transaction queue.  The transactions track all service
  *        requests within the RM infrastructure.
  */
-typedef struct {
+typedef struct Rm_Transaction_s {
     /** Transaction service type */
     Rm_ServiceType type;
     /** Local ID of the transaction. */
@@ -99,18 +92,18 @@ typedef struct {
     uint32_t remoteOriginatingId;
     /** Name of the RM instance the RM packet, that spawned the transaction,
      *  originated from */
-    char pktSrcInstName[RM_INSTANCE_NAME_MAX_CHARS];
+    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;
     /** Name of the RM instance the service originated from */
-    char serviceSrcInstName[RM_INSTANCE_NAME_MAX_CHARS];    
+    char serviceSrcInstName[RM_NAME_MAX_CHARS];    
     /** Resource information */
     Rm_ResourceInfo resourceInfo;
     /** Link to the next transaction in the queue */
-    void *nextTransaction;    
+    struct Rm_Transaction_s *nextTransaction;    
 } Rm_Transaction;
 
 typedef struct {
@@ -130,22 +123,21 @@ typedef enum {
 
 typedef struct {
     Rm_PolicyValidInstNode *serviceSrcInstNode;
-    Rm_AllocatorOp   operation;
-    uint32_t         allocType;
-    Rm_ResourceInfo *resourceInfo;
+    Rm_AllocatorOp          operation;
+    uint32_t                allocType;
+    Rm_ResourceInfo        *resourceInfo;
 } Rm_AllocatorOpInfo;
 
 typedef struct Rm_Allocator_s {
-    char resourceName[RM_RESOURCE_NAME_MAX_CHARS];
+    char                   resourceName[RM_NAME_MAX_CHARS];
     /** Pointer to the first resource entry in the allocator */
-    void *allocatorRootEntry;
+    void                  *allocatorRootEntry;
     /** Pointer to next resource allocator */
     struct Rm_Allocator_s *nextAllocator;
 } Rm_Allocator;
 
-
 typedef struct {
-    char                    instName[RM_INSTANCE_NAME_MAX_CHARS];
+    char                    instName[RM_NAME_MAX_CHARS];
     void                   *startupDtb;
     Rm_PolicyValidInstTree *validInstTree;
     uint32_t                requestCount;
@@ -153,22 +145,18 @@ typedef struct {
 } Rm_PreMainInst;
 
 typedef struct {
-    char                    instName[RM_INSTANCE_NAME_MAX_CHARS];
+    char                    instName[RM_NAME_MAX_CHARS];
     Rm_InstType             instType;
+    Rm_ServiceHandle       *serviceHandle;
     bool                    registeredWithDelegateOrServer;
     void                   *policy;
     void                   *staticPolicy;
     Rm_PolicyValidInstTree *validInstances;    
     Rm_Allocator           *allocators;
     Rm_NameServerTree      *nameServer;
-    /* RM instance transport parameters */
     void                   *transports;
-    /* 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_Transaction         *transactionQueue;
     Rm_TransportCallouts    transport;
 } Rm_Inst;
 
index 583ec99c8c7c3ff0731bc49e9ed30e0aa17f70ea..5d94b0b75129939eebedde1e6ca189c907ce6df7 100644 (file)
@@ -4,7 +4,7 @@
  *  Prototypes and data structures for the Resource Manager NameServer.
  *
  *  ============================================================================
- *      (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 
@@ -44,9 +44,6 @@
 extern "C" {
 #endif
 
-/* RM external includes */
-#include <ti/drv/rm/rm_services.h>
-
 /* RM internal includes */
 #include <ti/drv/rm/include/rm_treeloc.h>
 
index fca977689d0cee3d85cccf79325925b7eafbf1ce..8caf61bc1bfc9fb468da2c715f5f612948c7045c 100644 (file)
@@ -4,7 +4,7 @@
  *  Prototypes and data structures for the Resource Manager Policies.
  *
  *  ============================================================================
- *      (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 
@@ -44,6 +44,9 @@
 extern "C" {
 #endif
 
+/* RM external includes */
+#include <ti/drv/rm/rm.h>
+
 /* RM internal includes */
 #include <ti/drv/rm/include/rm_treeloc.h>
 
@@ -91,7 +94,7 @@ typedef uint16_t Rm_PolicyPermBits;
     ((permBits >> permTypeShift) & 0x1)
 
 typedef struct Rm_Permission_s {
-    char                    instName[RM_INSTANCE_NAME_MAX_CHARS];
+    char                    instName[RM_NAME_MAX_CHARS];
     Rm_PolicyPermBits       permissionBits;
     struct Rm_Permission_s *nextPermission;
 } Rm_PolicyPermission;
@@ -119,11 +122,11 @@ Rm_PolicyValidInstNode *rmPolicyGetValidInstNode(Rm_PolicyValidInstTree *validIn
 Rm_PolicyValidInstNode *rmPolicyGetLinuxInstNode(Rm_PolicyValidInstTree *validInstTree);
 bool     rmPolicyCheckPrivilege(Rm_PolicyCheckCfg *privilegeCfg, int32_t *result);
 uint32_t rmPolicyGetResourceBase(void *policyDtb, Rm_PolicyValidInstNode *validInstNode, 
-                                  int32_t resourceOffset, uint32_t allocType, 
-                                  int32_t *result);
+                                 int32_t resourceOffset, uint32_t allocType, 
+                                 int32_t *result);
 uint32_t rmPolicyGetResourceAlignment(void *policyDtb, int32_t resourceOffset);
 int32_t  rmPolicyGetResourceOffset(void *policyDtb, char *resourceName);
-int32_t  rmPolicyValidatePolicyResourceNames(void *allocatorList, void *policyDtb);
+int32_t  rmPolicyValidatePolicyResourceNames(void *policyDtb, void *allocatorList);
 int32_t  rmPolicyValidatePolicy(void *policyDtb, Rm_PolicyValidInstTree *validInstTree);
 Rm_PolicyValidInstTree *rmPolicyCreateValidInstTree(void *policyDtb, int32_t *result);
 void     rmPolicyFreeValidInstTree(Rm_PolicyValidInstTree *validInstTree);
index 8195ebd6be16194c2caad99203c10aafe253b706..e8003a5521daa18450c4fa60c2d121af6d6419b6 100644 (file)
@@ -4,7 +4,7 @@
  *  Private data structures of Resource Manager services layer.
  *
  *  ============================================================================
- *      (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 
index bf5c3e16a51305ae309a778283eba338cba93371..a9456a6b4db742526f218520e61b40ae24b8a748 100644 (file)
@@ -1,10 +1,10 @@
 /*
- *  file  rmtransportloc.h
+ *  file  rm_transportloc.h
  *
  *  Private data structures of Resource Manager transport layer.
  *
  *  ============================================================================
- *      (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 
@@ -37,8 +37,8 @@
  *  \par
 */
 
-#ifndef RMTRANSPORTLOC_H_
-#define RMTRANSPORTLOC_H_
+#ifndef RM_TRANSPORTLOC_H_
+#define RM_TRANSPORTLOC_H_
 
 #ifdef __cplusplus
 extern "C" {
@@ -61,7 +61,7 @@ typedef struct Rm_Transport_s {
     /** The remote RM instance type */
     Rm_InstType remoteInstType;
     /** The remote RM instance name */
-    char remoteInstName[RM_INSTANCE_NAME_MAX_CHARS];
+    char remoteInstName[RM_NAME_MAX_CHARS];
     /** Link to the next route node in the route map list */
     struct Rm_Transport_s *nextTransport;
 } Rm_Transport;
@@ -91,18 +91,18 @@ typedef enum {
  */
 typedef struct {
     /** The transaction ID associated with the request packet */
-    uint32_t requestId;  
+    uint32_t              requestId;  
     /** The resource request type */
     Rm_ResourceReqPktType resourceReqType;
     /** RM instance name from which the request packet originated.  Used by 
      *  receiving instance to route the response */
-    char pktSrcInstName[RM_INSTANCE_NAME_MAX_CHARS];    
+    char                  pktSrcInstName[RM_NAME_MAX_CHARS];    
     /** Name of RM instance that is issuing the service request. The instance 
      *  name will be used to validate the request against the RM policy defined
      *  for the instance. */
-    char serviceSrcInstName[RM_INSTANCE_NAME_MAX_CHARS];      
+    char                  serviceSrcInstName[RM_NAME_MAX_CHARS];      
     /** Resource request information */
-    Rm_ResourceInfo resourceInfo;
+    Rm_ResourceInfo       resourceInfo;
 } Rm_ResourceRequestPkt;
 
 /** 
@@ -114,10 +114,10 @@ typedef struct {
     /** responseID will equal the requestId received in the resource request
      *  packet.  This ID should be associated with a transaction stored in 
      *  the RM instance that sent the resource request packet */
-    uint32_t responseId;
+    uint32_t        responseId;
     /** State of the request.  Resource request, denied, or error.  The
      *  return values are externally visible so they're tracked in rmservice.h */
-    int32_t requestState;
+    int32_t         requestState;
     /* Resource response information */
     Rm_ResourceInfo resourceInfo;
 } Rm_ResourceResponsePkt;
@@ -138,15 +138,15 @@ typedef enum {
  */
 typedef struct {
     /** The transaction ID associated with the request packet */
-    uint32_t requestId;  
+    uint32_t        requestId;  
     /** The resource request type */
     Rm_NsReqPktType nsRequestType;
     /** RM instance name from which the request packet originated.  Used by 
      *  receiving instance to route the response */
-    char pktSrcInstName[RM_INSTANCE_NAME_MAX_CHARS];
+    char            pktSrcInstName[RM_NAME_MAX_CHARS];
     /** RM instance name making the service request.  Policies may restrict who
      *  can and cannot map and unmap resources via the RM NameServer */
-    char serviceSrcInstName[RM_INSTANCE_NAME_MAX_CHARS];
+    char            serviceSrcInstName[RM_NAME_MAX_CHARS];
     /** Resource request information */
     Rm_ResourceInfo resourceInfo;
 } Rm_NsRequestPkt;
@@ -162,82 +162,9 @@ typedef struct {
     uint32_t responseId;
     /** State of the request.  Resource request, denied, or error.  The
      *  return values are externally visible so they're tracked in rmservice.h */
-    int32_t requestState;
+    int32_t  requestState;
 } Rm_NsResponsePkt;
 
-/** 
- * @brief Policy Request Packet - Packet used by a RM instance to request an
- *        update to its policy data (supported on Client Delegates and Servers only)
- */
-typedef struct {
-    /** The transaction ID associated with the request packet */
-    uint32_t requestId;  
-    /** Name of RM instance that is issuing the policy request. The instance 
-     *  name will be used to validate the request against the RM policy defined
-     *  for the instance in the global policy.
-     *  WARNING: Only Client Delegates and Servers can request policy updates */
-    char instName[RM_INSTANCE_NAME_MAX_CHARS];      
-} Rm_PolicyRequestPkt;
-
-/** 
- * @brief Policy Change Packet - Provides policy changes to RM instances that
- *        support policy storage (Client Delegates and Servers)
- */
-typedef struct {
-    /** responseID will equal the requestId received in the resource request
-     *  packet.  This ID should be associated with a transaction stored in 
-     *  the RM instance that sent the resource request packet */
-    uint32_t responseId;
-    /** Byte array containing new policy data for receiving RM instance */
-    char policyData[RM_MAX_POLICY_SIZE_BYTES];
-} Rm_PolicyChangePkt;
-
-/** 
- * @brief Resource Pool Modification Request Packet Types
- */
-typedef enum {
-    /** Resource pool allocation request */
-    Rm_resPoolModType_ALLOCATE = 0,
-    /** Resource pool free request */
-    Rm_resPoolModType_FREE = 1
-} Rm_ResourcePoolModReqType;
-
-/** 
- * @brief Resource Pool Modification Request Packet - Packet sent to RM Server from
- *        RM Client Delegates in order to request resource pool modifications on
- *        the Client Delegate.  The Client Delegate can request more resource's for
- *        its local resource pool or it can free resources from its resource pool back
- *        to the Server. */
-typedef struct {
-    /** The transaction ID associated with the request packet */
-    uint32_t requestId;  
-    /** The resource pool modification request type */
-    Rm_ResourcePoolModReqType resourcePoolModReqType;
-    /** Name of RM Client Delegate instance that is issuing the resource pool 
-     *  modification request. The instance name will be used to validate the 
-     *  request against the RM policy defined for the instance. */
-    char instName[RM_INSTANCE_NAME_MAX_CHARS];      
-    /** Resource pool resource request information */
-    Rm_ResourceInfo resourceInfo;
-} Rm_ResourcePoolModRequestPkt;
-
-/** 
- * @brief Resource Pool Modification Response Packet - Packet sent to RM Client
- *        Delegates from RM Servers in response to resource pool modification requests.
- *        The packet will contain resource response information based on the request
- */
-typedef struct {
-    /** responseID will equal the requestId received in the resource pool mod request
-     *  packet.  This ID should be associated with a transaction stored in 
-     *  the RM instance that sent the resource request packet */
-    uint32_t responseId;
-    /** Result of the resource pool mod request.  Resource request, denied, or error.  The
-     *  return values are externally visible so they're tracked in rmservice.h */
-    int32_t requestResult;
-    /* Resource pool resource response information */
-    Rm_ResourceInfo resourceInfo;
-} Rm_ResourcePoolModResponsePkt;
-
 Rm_Transport *rmTransportFindRemoteName(Rm_Transport *transports, char *remoteName);
 Rm_Transport *rmTransportFindRemoteInstType(Rm_Transport *transports, Rm_InstType remoteInstType);
 Rm_Packet *rmTransportCreateResourceReqPkt(Rm_Inst *rmInst, Rm_Transport *dstTransportNode,
@@ -253,5 +180,5 @@ Rm_Packet *rmTransportCreateNsResponsePkt(Rm_Inst *rmInst, Rm_Transport *dstTran
 }
 #endif
 
-#endif /* RMTRANSPORTLOC_H_ */
+#endif /* RM_TRANSPORTLOC_H_ */
 
index a32ed169b9b890298d939c0334c3f4f6a00cf699..24e882373b8b2fb9da330b3e978f1f06ab8684fb 100644 (file)
 extern "C" {
 #endif
 
+/* Standard includes */
+#include <stdint.h>
+#include <stdbool.h>
+
 /* RM external includes */
 #include <ti/drv/rm/rm.h>
-#include <ti/drv/rm/rm_services.h>
 
 /* AVL BBST includes */
 #include <ti/drv/rm/include/tree.h>
@@ -64,8 +67,8 @@ typedef struct {
 
 typedef struct _Rm_NameServerNode {
     RB_ENTRY(_Rm_NameServerNode) linkage;
-    char                         objName[RM_RESOURCE_NAME_MAX_CHARS];
-    char                         resourceName[RM_RESOURCE_NAME_MAX_CHARS];
+    char                         objName[RM_NAME_MAX_CHARS];
+    char                         resourceName[RM_NAME_MAX_CHARS];
     uint32_t                     resourceBase;
     uint32_t                     resourceLength;
 } Rm_NameServerNode;
@@ -74,7 +77,7 @@ typedef RB_HEAD(_Rm_NameServerTree, _Rm_NameServerNode) Rm_NameServerTree;
 
 typedef struct _Rm_PolicyValidInstNode {
     RB_ENTRY(_Rm_PolicyValidInstNode) linkage;
-    char                              name[RM_INSTANCE_NAME_MAX_CHARS];
+    char                              name[RM_NAME_MAX_CHARS];
     uint32_t                          allocRefCount;
     bool                              deletePending;
 } Rm_PolicyValidInstNode;
@@ -116,9 +119,9 @@ int resourceNodeCompare(Rm_ResourceNode *node1, Rm_ResourceNode *node2);
  ******************** Tree Prototype Generation ***********************
  **********************************************************************/
  
-RB_PROTOTYPE(_Rm_NameServerTree, _Rm_NameServerNode, linkage, nameServerNodeCompare);
-RB_PROTOTYPE(_Rm_PolicyValidInstTree, _Rm_PolicyValidInstNode, linkage, policyValidInstNodeCompare);
-RB_PROTOTYPE(_Rm_AllocatorResourceTree, _Rm_ResourceNode, linkage, resourceNodeCompare);
+RB_PROTOTYPE(_Rm_NameServerTree, _Rm_NameServerNode, linkage, nameServerNodeCompare)
+RB_PROTOTYPE(_Rm_PolicyValidInstTree, _Rm_PolicyValidInstNode, linkage, policyValidInstNodeCompare)
+RB_PROTOTYPE(_Rm_AllocatorResourceTree, _Rm_ResourceNode, linkage, resourceNodeCompare)
 
 #ifdef __cplusplus
 }
index 9fd9ff73e32c51fc07bd2df550066f6a229cf19e..a05e6807f08c0779ff3227a1109cb76f19efefb1 100644 (file)
@@ -15,7 +15,7 @@
  *  Example for a valid command:\r
  *      xdc XDCARGS="SETUP" release   \r
  *\r
- * Copyright (C) 2012, Texas Instruments, Inc.\r
+ * Copyright (C) 2012-2013, Texas Instruments, Inc.\r
  *****************************************************************************/\r
 \r
 /* List of all subdirectories that combine to make the RM Package. */\r
@@ -90,7 +90,6 @@ Pkg.otherFiles[Pkg.otherFiles.length++] = "Settings.xdc.xdt";
 Pkg.otherFiles[Pkg.otherFiles.length++] = "rm.h";\r
 Pkg.otherFiles[Pkg.otherFiles.length++] = "rm_services.h";\r
 Pkg.otherFiles[Pkg.otherFiles.length++] = "rm_transport.h";\r
-Pkg.otherFiles[Pkg.otherFiles.length++] = "rm_types.h";\r
 Pkg.otherFiles[Pkg.otherFiles.length++] = "rm_osal.h";\r
 Pkg.otherFiles[Pkg.otherFiles.length++] = "rmver.h";\r
 Pkg.otherFiles[Pkg.otherFiles.length++] = "rmver.h.xdt";\r
index 5bee1a47d96b99b265f688272f8e1a1776d6f298..da62e2bf8056626aa82d55852186d07dadc0c170 100644 (file)
@@ -6,7 +6,7 @@
  * DESCRIPTION: \r
  *  This file contains the package specification for the RM library\r
  *\r
- * Copyright (C) 2012, Texas Instruments, Inc.\r
+ * Copyright (C) 2012-2013, Texas Instruments, Inc.\r
  *****************************************************************************/\r
 \r
 package ti.drv.rm[2, 0, 0, 0] {\r
diff --git a/rm.h b/rm.h
index d10d6ead552adcbfa2f938eff8903421945d5cab..a414acb3dcac7d10bb964082e3b4f277c2522597 100644 (file)
--- a/rm.h
+++ b/rm.h
@@ -6,7 +6,7 @@
  *
  *  \par
  *  ============================================================================
- *  @n   (C) Copyright 2012, Texas Instruments, Inc.
+ *  @n   (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 
@@ -46,6 +46,9 @@
 extern "C" {
 #endif
 
+/* Standard includes */
+#include <stdint.h>
+
 /* RM version */
 #include <ti/drv/rm/rmver.h>
 
@@ -54,87 +57,23 @@ extern "C" {
  *   @section intro  Introduction
  *
  *   The Resource Manager low level driver (RM LLD) is designed to provide initialization and permissions checking
- *   for LLD resources.  A system integrator can specify DSP permissions for LLD resources within the system.
- *   The resource permissions are stored in the RM LLD and used to validate resource requests from supported LLDs.
- *   Currently, the RM LLD supports permissions for the following LLDs
- *      - QMSS
- *      - CPPI
- *      - PA
- *    For information on the specific resources supported with each LLD please see @ref RM_LLD_RESOURCE_TABLE.
- *
- *    The system integrator must specify the supported LLD resource permissions for all DSPs prior to compile time.
- *    An array of @ref Rm_Resource objects must be created.  Each @ref Rm_Resource entry in the array specifies
- *    a resource type, start and end range for the resource, and the initialization and usage permissions for the
- *    resource for each DSP.  For an example resource table definitions please see the @ref rmResourceTable array
- *    defined in the resource_table\ directory.  This resource table assigns full initialization and usage permissions
- *    to all DSPs for all supported resources.  Please note that the resouce table must start with the
- *    @ref RM_RESOURCE_MAGIC_NUMBER entry and end with the @ref RM_RESOURCE_FINAL_ENTRY.  These
- *    first and last entries are used the RM LLD to validate and parse the resource table.
- *
- *    The RM LLD must be initialized and started prior to all supported LLD initialization and start routines.  The
- *    @ref Rm_init function should be invoked, and passed a pointer to the integrator defined resource table, on the
- *    master DSP core in the system.  All other DSP cores should invoke the @ref Rm_start API.  The @ref Rm_init 
- *    function first initializes the internal permission tables to deny all DSPs access to all resources.  Next the 
- *    @ref Rm_init function parses the resource table provided and copies all specified permissions into the internal
- *    tables.  When the permission transfer completes the @ref Rm_init function writes a global synchronization
- *    object which the @ref Rm_start functions are spinning on.  The slave cores that have invoked @ref Rm_start
- *    will stop spinning once the global synchronization has been written.  At this time @ref Rm_start will invalidate 
- *    all internal permission tables so that no further cache invalidate operations need to be performed when 
- *    checking resource permissions in the data path. The upfront cache invalidate operation is possible because 
- *    the RM LLD does not allow dynamic resource permission modifications. The permissions defined by the system
- *    integrator and loaded during RM initialization are static throughout the system up-time.
- *
- *    The RM LLD must be registered with a supported LLD in order for the supported LLD to perform resource 
- *    permission checks.  If the RM LLD is not registered with a supported LLD the LLD will operate as if the RM LLD
- *    is not there.  This maintains full backwards compatability with existing applications not using the RM LLD.  In order
- *    to register the RM LLD with supported LLDs the following steps should be taken
- *      - Get a @ref Rm_Handle via the @ref Rm_getHandle API on each DSP that uses the RM LLD.
- *      - Register the RM LLD with the supported LLDs by passing the @ref Rm_Handle to the 
- *          LLD's <<LLD name>>_startCfg API.  Again, this should be performed on all DSP cores using the RM LLD.
- *          Note: The master core for the QMSS LLD should have the @ref Rm_Handle registered via the Qmss_init API.
- *    After registering the RM LLD with supported LLDs all supported LLD resources covered by the RM LLD will invoke
- *    permission check callouts to the RM.  A permission denied or approved response will be given back to the
- *    invoking LLD based on the permissions stored in the RM LLD for the resource.
- *
- *    All internal RM LLD permission tables are placed into a single memory section called ".rm".  This memory section
- *    MUST be placed in shared memory (MSMC or DDR).  The permission tables are shared between all DSPs utilizing
- *    the RM LLD.
- *
- *    In summary, the initialization flow if the RM LLD is to be utilized should look like the following:
- *    
- *    Master DSP Core:
- *      - Call @ref Rm_init passing in the system integrator defined resource table
- *      - Call @ref Rm_getHandle
- *      - Call supported LLD _init or _create functions (for QMSS pass the @ref Rm_Handle inside the 
- *          Qmss_GlobalConfigParams structure)
- *      - Call supported LLD _startCfg functions passing the @ref Rm_Handle as an argument
- *
- *    Slave DSP Cores:
- *      - Call @ref Rm_start
- *      - Call @ref Rm_getHandle
- *      - Call supported LLD _start functions (if supported)
- *      - Call supported LLD _startCfg functions passing the @ref Rm_Handle as an argument
  *  
  */
  
-/* Define RM_LLD_API as a master group in Doxygen format and add all RM LLD API 
+/* Define RM_API as a master group in Doxygen format and add all RM API 
    definitions to this group. */
-/** @defgroup RM_LLD_API RM LLD Module API
+/** @defgroup RM_API Resource Manager API
  *  @{
  */
 /** @} */
 
 /**
 @defgroup RM_TRANSPORT_API  RM Transport-Layer API
-@ingroup RM_LLD_API
+@ingroup RM_API
 */
 /**
 @defgroup RM_SERVICES_API  RM Registered Component Services API
-@ingroup RM_LLD_API
-*/
-/**
-@defgroup RM_POLICY_API  RM Policy modification API
-@ingroup RM_LLD_API
+@ingroup RM_API
 */
 
 /* TODO: CANT CONFLICT WITH OTHER ERROR CODES INCLUDING LIBFDT */
@@ -155,11 +94,152 @@ extern "C" {
 #define RM_INIT_ERROR_POLICY_SYNTAX_ERROR_INSTANCE_NAME_IN_ASSIGNMENT_TOO_LONG -269
 #define RM_INIT_ERROR_NS_ASSIGNMENT_NAME_TOO_LONG -270
 #define RM_INIT_ERROR_GRL_INVALID_LINUX_ALIAS_FORMAT -271
+#define RM_INIT_ERROR_SERVICE_HANDLE_MEMORY_ALLOC_FAILED -272
+#define RM_INIT_ERROR_SERVICE_HANDLE_ALREADY_ALLOCATED -273
+#define RM_INIT_ERROR_SERVICE_HANDLE_ALREADY_CLOSED_FOR_INSTANCE -274
+
+/** RM Service Request State Codes and Errors */
+/** RM Service Request State Code Base */
+#define RM_SERVICE_STATE_BASE (0)
+/** RM internal state okay - This value is for internal use by RM.  It should never be
+ *  seen as a return value during normal operation */
+#define RM_SERVICE_STATE_OKAY (RM_SERVICE_STATE_BASE)
+/** RM service is being processed.  Typically this means the service is
+ *  being sent to a higher level RM agent for processing */
+#define RM_SERVICE_PROCESSING (RM_SERVICE_STATE_BASE+1)
+/** RM service was approved.  The resource data in the response is valid if
+ *  the service has been approved. */
+#define RM_SERVICE_APPROVED_AND_COMPLETED (RM_SERVICE_STATE_BASE+2)
+/** Beginning of resource denied reasons */
+#define RM_SERVICE_DENIED_BEGIN (RM_SERVICE_STATE_BASE+3)
+/** RM could not find an allocator for the resource specified with the provided name */
+#define RM_SERVICE_DENIED_RESOURCE_DOES_NOT_EXIST (RM_SERVICE_DENIED_BEGIN)
+/** A resource value within the specifed base+range could not be found within the resource's
+ *  allocator.  No action was taken on the resources. */
+#define RM_SERVICE_DENIED_RESOURCE_VALUE_RANGE_DOES_NOT_EXIST (RM_SERVICE_DENIED_BEGIN+1)
+/** A resource value within the specifed base+range was not allocated to the RM instance
+ *  that is the source of the request.  No action was taken on the resources. */
+#define RM_SERVICE_DENIED_RESOURCE_NOT_ALLOCATED_TO_INSTANCE_REQUESTING_THE_SERVICE (RM_SERVICE_DENIED_BEGIN+2)
+/** A resource value within the specifed base+range is already free */
+#define RM_SERVICE_DENIED_RESOURCE_ALREADY_FREE (RM_SERVICE_DENIED_BEGIN+3)
+/** A resource value within the specifed base+range is already allocated to another
+ *  RM instance. */
+#define RM_SERVICE_DENIED_RESOURCE_ALREADY_ALLOCATED (RM_SERVICE_DENIED_BEGIN+4)
+/** The resource range specified for freeing included free and allocated resoruces. */
+#define RM_SERVICE_DENIED_INVALID_RESOURCE_RANGE (RM_SERVICE_DENIED_BEGIN+5)
+/** No free resource ranges could be found that satisfy the resource base, length, and
+ *  alignment requirements */
+#define RM_SERVICE_DENIED_RESOURCE_ALLOCATION_REQUIREMENTS_COULD_NOT_BE_SATISFIED (RM_SERVICE_DENIED_BEGIN+6)
+/** The RM instance requesting the service is not defined in the policy */
+#define RM_SERVICE_DENIED_RM_INST_NOT_DEFINED_IN_POLICY (RM_SERVICE_DENIED_BEGIN+7)
+/** The resource in the service request is not defined in the policy */
+#define RM_SERVICE_DENIED_RESOURCE_NOT_DEFINED_IN_POLICY (RM_SERVICE_DENIED_BEGIN+8)
+/** The resource has multiple assigned range definitions */
+#define RM_SERVICE_DENIED_ASSIGNED_RANGE_SPECIFICATION_ERROR (RM_SERVICE_DENIED_BEGIN+9)
+/** The resource has multiple allocation size definitions */
+#define RM_SERVICE_DENIED_ALLOCATION_SIZE_SPECIFICATION_ERROR (RM_SERVICE_DENIED_BEGIN+10)
+/** The resource has multiple assigned name definitions */
+#define RM_SERVICE_DENIED_ASSIGNED_NAME_SPECIFICATION_ERROR (RM_SERVICE_DENIED_BEGIN+11)
+/** The resource has multiple allocation alignment definitions */
+#define RM_SERVICE_DENIED_ALLOCATION_ALIGNMENT_SPECIFICATION_ERROR (RM_SERVICE_DENIED_BEGIN+12)
+/** The resource node in the policy has an unknown property type */
+#define RM_SERVICE_DENIED_UNKNOWN_POLICY_PROPERTY (RM_SERVICE_DENIED_BEGIN+13)
+/** The policy does not approve of the resources requested by the RM instance in the service
+ *  request */
+#define RM_SERVICE_DENIED_POLICY_DENIAL (RM_SERVICE_DENIED_BEGIN+14)
+/** Attempt to add object to NameServer denied: The object name already exists in the NameServer */
+#define RM_SERVICE_DENIED_NAMESERVER_ERROR_NAME_ALREADY_EXISTS (RM_SERVICE_DENIED_BEGIN+15)
+/** No valid ranges were specified for the resource within the RM instance's node within the policy.
+ *  By default all resource requests for this resource are denied */
+#define RM_SERVICE_DENIED_POLICY_DENIAL_NO_RANGES_SPECIFIED (RM_SERVICE_DENIED_BEGIN+16)
+/** The instance name of the service requesting instance is not in the policy valid instance list */
+#define RM_SERVICE_DENIED_ORIGINATING_INSTANCE_NAME_NOT_VALID (RM_SERVICE_DENIED_BEGIN+17)
+/** The policy does not specify any assignment ranges for the resource in the service request */
+#define RM_SERVICE_DENIED_NO_RANGE_ASSIGNMENTS_FOR_POLICY (RM_SERVICE_DENIED_BEGIN+18)
+/** The resource couldn't be allocated because the requesting instance was not given the init/use
+ *  permissions in the policy */
+#define RM_SERVICE_DENIED_INIT_USE_PERMISSION_DENIED (RM_SERVICE_DENIED_BEGIN+19)
+/** The resource couldn't be allocated because the requesting instance has exclusive privileges in the
+ *  policy but the resource was already allocated */
+#define RM_SERVICE_DENIED_REQUESTER_HAS_EXCLUSIVE_PRIV_BUT_RESOURCE_ALLOCATED (RM_SERVICE_DENIED_BEGIN+20)
+/** The resource couldn't be allocated because it was already allocated to an instance with exclusive
+ *  privileges for the resource */
+#define RM_SERVICE_DENIED_RESOURCE_ALLOCATED_TO_INSTANCE_WITH_EXCLUSIVE_PRIV (RM_SERVICE_DENIED_BEGIN+21)
+/** Pre main request was not an allocate use or allocate init request */
+#define RM_SERVICE_DENIED_INVALID_PREMAIN_REQUEST (RM_SERVICE_DENIED_BEGIN+22)
+/** Startup policy denied pre-main allocation request */
+#define RM_SERVICE_DENIED_POLICY_DENIED_PREMAIN_ALLOCATION (RM_SERVICE_DENIED_BEGIN+23)
+/** End of resource denied reasons */
+#define RM_SERVICE_DENIED_END (RM_SERVICE_DENIED_BEGIN+23)
+
+/** RM Service Request Error Code Base */
+#define RM_SERVICE_ERROR_BASE (-64)
+/** RM service request type not recognized */
+#define RM_SERVICE_ERROR_INVALID_SERVICE_TYPE (RM_SERVICE_ERROR_BASE)
+/** RM Service request was not provided a component callback
+ *  function.  Service requests may result in blocking operations.  A callback
+ *  function must always be provided with a service request since
+ *  blocked or non-blocked operations cannot be promised.  */
+#define RM_SERVICE_ERROR_CALLBACK_NOT_PROVIDED (RM_SERVICE_ERROR_BASE-1)
+/** RM service request needs to be forwarded to another RM agent but no transports
+ *  have been registered */
+#define RM_SERVICE_ERROR_NO_TRANSPORT_REGISTERED (RM_SERVICE_ERROR_BASE-2)
+/** RM service request needs to be forwarded but no client delegate or server has 
+ *  been registered with the RM instance */
+#define RM_SERVICE_ERROR_NOT_REGISTERED_WITH_DEL_OR_SERVER (RM_SERVICE_ERROR_BASE-3)
+/** RM service request needs to be forwarded but the transport packet alloc API
+ *  has not been provided */
+#define RM_SERVICE_ERROR_TRANSPORT_PKT_ALLOC_API_NULL (RM_SERVICE_ERROR_BASE-4)
+/** A failure occurred within a registered transport's packet alloc API */
+#define RM_SERVICE_ERROR_TRANSPORT_ALLOC_PKT_ERROR (RM_SERVICE_ERROR_BASE-5)
+/** RM service request needs to be forwarded but the buffer allocated by transport
+ *  is not large enough to fit the RM transport packet */
+#define RM_SERVICE_ERROR_TRANSPORT_PKT_BUF_TOO_SMALL (RM_SERVICE_ERROR_BASE-6)
+/** RM service request needs to be forwarded but the transport returned an error
+ *  when trying to send the RM packet to the higher level agent */
+#define RM_SERVICE_ERROR_TRANPSPORT_SEND_ERROR (RM_SERVICE_ERROR_BASE-7)
+/** RM service response from higher level agent did not match any requests made
+ *  by the provided RM instance */
+#define RM_SERVICE_ERROR_TRANSACTION_DOES_NOT_EXIST_FOR_THIS_RM_INSTANCE (RM_SERVICE_ERROR_BASE-8)
+/** RM failed to allocate memory for new service transaction */
+#define RM_SERVICE_ERROR_TRANSACTION_FAILED_TO_ALLOCATE (RM_SERVICE_ERROR_BASE-9)
+/** RM could not find the service transaction in the RM instance's transaction queue */
+#define RM_SERVICE_ERROR_SERVICE_TRANSACTION_DOES_NOT_EXIST (RM_SERVICE_ERROR_BASE-10)
+/** A failure occurred within a registered transport's packet free API */
+#define RM_SERVICE_ERROR_TRANSPORT_FREE_PKT_ERROR (RM_SERVICE_ERROR_BASE-11)
+/** Invalid NameServer object modification on non-Server instance */
+#define RM_SERVICE_ERROR_NAMESERVER_OBJECT_MOD_ON_INVALID_INSTANCE (RM_SERVICE_ERROR_BASE-12)
+/** Request failed because both a NameServer name and a resource range were specified */
+#define RM_SERVICE_ERROR_NAMESERVER_NAME_AND_RESOURCE_RANGE_BOTH_DEFINED (RM_SERVICE_ERROR_BASE-13)
+/** Error occurred when trying to add an object to the NameServer */
+#define RM_SERVICE_ERROR_NAMESERVER_OBJECT_ADD_FAILED (RM_SERVICE_ERROR_BASE-14)
+/** Could not find the object specified in the service request in the NameServer */
+#define RM_SERVICE_ERROR_NAMESERVER_ERROR_NAME_DOES_NOT_EXIST (RM_SERVICE_ERROR_BASE-15)
+
+/** RM Transport Result Return Codes */
+/** RM Transport Success Code Base */
+#define RM_TRANSPORT_OK_BASE (0)
+/** RM transport action was successful. */
+#define RM_TRANSPORT_SUCCESSFUL (RM_TRANSPORT_OK_BASE)
+
+/** RM Transport Error Code Base */
+#define RM_TRANSPORT_ERROR_BASE (-64)
+/** RM transport handle has not been registered with the RM instance */
+#define RM_TRANSPORT_ERROR_HANDLE_HAS_NOT_BEEN_REGISTERED (RM_TRANSPORT_ERROR_BASE-1)
+/** RM packets are available but an error was encountered during reception */
+#define RM_TRANSPORT_ERROR_PACKET_RECEPTION_ERROR (RM_TRANSPORT_ERROR_BASE-3)
+/** RM received a packet with an unknown RM packet type */
+#define RM_TRANSPORT_ERROR_INVALID_PACKET_TYPE (RM_TRANSPORT_ERROR_BASE-4)
+/** RM resource request transaction could not be found matching the response received */
+#define RM_TRANSPORT_ERROR_MATCHING_RESOURCE_REQUEST_NOT_FOUND (RM_TRANSPORT_ERROR_BASE-5)
+/** RM NameServer request transaction could not be found matching the response received */
+#define RM_TRANSPORT_ERROR_MATCHING_NAME_SERVER_REQUEST_NOT_FOUND (RM_TRANSPORT_ERROR_BASE-6)
 
 /** 
- * @brief Maximum number of characters in a RM instance name
+ * @brief Maximum number of characters allowed for RM instance, resource, and
+ *        NameServer names.
  */
-#define RM_INSTANCE_NAME_MAX_CHARS (32)
+#define RM_NAME_MAX_CHARS (32)
 
 /** 
  * @brief RM Handle provided to application.  The RM Handle is used by the
index 9e92e7e79734354290815f8a5cf32453ae233ed0..12ed993d769e693d2acfb5ee5454425c7957cdbf 100644 (file)
--- a/rm_osal.h
+++ b/rm_osal.h
@@ -78,7 +78,6 @@
  * memcpy/memset prototypes here.  This #include prevents warnings in 
  * other code that unintentionally worked because of these prototypes
  */
-#include <string.h>
 #include <xdc/runtime/System.h>
 
 
index bc23dcb5d4b74327ba5c88ed1bb5c8b4d236b890..188ca45cdd783c27f46cc25a691d991c7c5e0a6a 100644 (file)
@@ -1,5 +1,5 @@
 /**
- *   @file  rmservices.h
+ *   @file  rm_services.h
  *
  *   @brief   
  *      This is the RM include file for services provided to components that 
@@ -7,7 +7,7 @@
  *
  *  \par
  *  ============================================================================
- *  @n   (C) Copyright 2012, Texas Instruments, Inc.
+ *  @n   (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 
@@ -40,8 +40,8 @@
  *  \par
 */
 
-#ifndef RMSERVICES_H_
-#define RMSERVICES_H_
+#ifndef RM_SERVICES_H_
+#define RM_SERVICES_H_
 
 #ifdef __cplusplus
 extern "C" {
@@ -51,133 +51,10 @@ extern "C" {
 #include <ti/drv/rm/rm.h>
 
 /**
-@addtogroup RMSERVICES_API
+@addtogroup RM_SERVICES_API
 @{
 */
 
-/** RM Service Request State Codes and Errors */
-/** RM Service Request State Code Base */
-#define RM_SERVICE_STATE_BASE (0)
-/** RM internal state okay - This value is for internal use by RM.  It should never be
- *  seen as a return value during normal operation */
-#define RM_SERVICE_STATE_OKAY (RM_SERVICE_STATE_BASE)
-/** RM service is being processed.  Typically this means the service is
- *  being sent to a higher level RM agent for processing */
-#define RM_SERVICE_PROCESSING (RM_SERVICE_STATE_BASE+1)
-/** RM service was approved.  The resource data in the response is valid if
- *  the service has been approved. */
-#define RM_SERVICE_APPROVED_AND_COMPLETED (RM_SERVICE_STATE_BASE+2)
-/** Beginning of resource denied reasons */
-#define RM_SERVICE_DENIED_BEGIN (RM_SERVICE_STATE_BASE+3)
-/** RM could not find an allocator for the resource specified with the provided name */
-#define RM_SERVICE_DENIED_RESOURCE_DOES_NOT_EXIST (RM_SERVICE_DENIED_BEGIN)
-/** A resource value within the specifed base+range could not be found within the resource's
- *  allocator.  No action was taken on the resources. */
-#define RM_SERVICE_DENIED_RESOURCE_VALUE_RANGE_DOES_NOT_EXIST (RM_SERVICE_DENIED_BEGIN+1)
-/** A resource value within the specifed base+range was not allocated to the RM instance
- *  that is the source of the request.  No action was taken on the resources. */
-#define RM_SERVICE_DENIED_RESOURCE_NOT_ALLOCATED_TO_INSTANCE_REQUESTING_THE_SERVICE (RM_SERVICE_DENIED_BEGIN+2)
-/** A resource value within the specifed base+range is already free */
-#define RM_SERVICE_DENIED_RESOURCE_ALREADY_FREE (RM_SERVICE_DENIED_BEGIN+3)
-/** A resource value within the specifed base+range is already allocated to another
- *  RM instance. */
-#define RM_SERVICE_DENIED_RESOURCE_ALREADY_ALLOCATED (RM_SERVICE_DENIED_BEGIN+4)
-/** The resource range specified for freeing included free and allocated resoruces. */
-#define RM_SERVICE_DENIED_INVALID_RESOURCE_RANGE (RM_SERVICE_DENIED_BEGIN+5)
-/** No free resource ranges could be found that satisfy the resource base, length, and
- *  alignment requirements */
-#define RM_SERVICE_DENIED_RESOURCE_ALLOCATION_REQUIREMENTS_COULD_NOT_BE_SATISFIED (RM_SERVICE_DENIED_BEGIN+6)
-/** The RM instance requesting the service is not defined in the policy */
-#define RM_SERVICE_DENIED_RM_INST_NOT_DEFINED_IN_POLICY (RM_SERVICE_DENIED_BEGIN+7)
-/** The resource in the service request is not defined in the policy */
-#define RM_SERVICE_DENIED_RESOURCE_NOT_DEFINED_IN_POLICY (RM_SERVICE_DENIED_BEGIN+8)
-/** The resource has multiple assigned range definitions */
-#define RM_SERVICE_DENIED_ASSIGNED_RANGE_SPECIFICATION_ERROR (RM_SERVICE_DENIED_BEGIN+9)
-/** The resource has multiple allocation size definitions */
-#define RM_SERVICE_DENIED_ALLOCATION_SIZE_SPECIFICATION_ERROR (RM_SERVICE_DENIED_BEGIN+10)
-/** The resource has multiple assigned name definitions */
-#define RM_SERVICE_DENIED_ASSIGNED_NAME_SPECIFICATION_ERROR (RM_SERVICE_DENIED_BEGIN+11)
-/** The resource has multiple allocation alignment definitions */
-#define RM_SERVICE_DENIED_ALLOCATION_ALIGNMENT_SPECIFICATION_ERROR (RM_SERVICE_DENIED_BEGIN+12)
-/** The resource node in the policy has an unknown property type */
-#define RM_SERVICE_DENIED_UNKNOWN_POLICY_PROPERTY (RM_SERVICE_DENIED_BEGIN+13)
-/** The policy does not approve of the resources requested by the RM instance in the service
- *  request */
-#define RM_SERVICE_DENIED_POLICY_DENIAL (RM_SERVICE_DENIED_BEGIN+14)
-/** Attempt to add object to NameServer denied: The object name already exists in the NameServer */
-#define RM_SERVICE_DENIED_NAMESERVER_ERROR_NAME_ALREADY_EXISTS (RM_SERVICE_DENIED_BEGIN+15)
-/** No valid ranges were specified for the resource within the RM instance's node within the policy.
- *  By default all resource requests for this resource are denied */
-#define RM_SERVICE_DENIED_POLICY_DENIAL_NO_RANGES_SPECIFIED (RM_SERVICE_DENIED_BEGIN+16)
-/** The instance name of the service requesting instance is not in the policy valid instance list */
-#define RM_SERVICE_DENIED_ORIGINATING_INSTANCE_NAME_NOT_VALID (RM_SERVICE_DENIED_BEGIN+17)
-/** The policy does not specify any assignment ranges for the resource in the service request */
-#define RM_SERVICE_DENIED_NO_RANGE_ASSIGNMENTS_FOR_POLICY (RM_SERVICE_DENIED_BEGIN+18)
-/** The resource couldn't be allocated because the requesting instance was not given the init/use
- *  permissions in the policy */
-#define RM_SERVICE_DENIED_INIT_USE_PERMISSION_DENIED (RM_SERVICE_DENIED_BEGIN+19)
-/** The resource couldn't be allocated because the requesting instance has exclusive privileges in the
- *  policy but the resource was already allocated */
-#define RM_SERVICE_DENIED_REQUESTER_HAS_EXCLUSIVE_PRIV_BUT_RESOURCE_ALLOCATED (RM_SERVICE_DENIED_BEGIN+20)
-/** The resource couldn't be allocated because it was already allocated to an instance with exclusive
- *  privileges for the resource */
-#define RM_SERVICE_DENIED_RESOURCE_ALLOCATED_TO_INSTANCE_WITH_EXCLUSIVE_PRIV (RM_SERVICE_DENIED_BEGIN+21)
-/** Pre main request was not an allocate use or allocate init request */
-#define RM_SERVICE_DENIED_INVALID_PREMAIN_REQUEST (RM_SERVICE_DENIED_BEGIN+22)
-/** Startup policy denied pre-main allocation request */
-#define RM_SERVICE_DENIED_POLICY_DENIED_PREMAIN_ALLOCATION (RM_SERVICE_DENIED_BEGIN+23)
-/** End of resource denied reasons */
-#define RM_SERVICE_DENIED_END (RM_SERVICE_DENIED_BEGIN+23)
-
-/** RM Service Request Error Code Base */
-#define RM_SERVICE_ERROR_BASE (-64)
-/** RM service request type not recognized */
-#define RM_SERVICE_ERROR_INVALID_SERVICE_TYPE (RM_SERVICE_ERROR_BASE)
-/** RM Service request was not provided a component callback
- *  function.  Service requests may result in blocking operations.  A callback
- *  function must always be provided with a service request since
- *  blocked or non-blocked operations cannot be promised.  */
-#define RM_SERVICE_ERROR_CALLBACK_NOT_PROVIDED (RM_SERVICE_ERROR_BASE-1)
-/** RM service request needs to be forwarded to another RM agent but no transports
- *  have been registered */
-#define RM_SERVICE_ERROR_NO_TRANSPORT_REGISTERED (RM_SERVICE_ERROR_BASE-2)
-/** RM service request needs to be forwarded but no client delegate or server has 
- *  been registered with the RM instance */
-#define RM_SERVICE_ERROR_NOT_REGISTERED_WITH_DEL_OR_SERVER (RM_SERVICE_ERROR_BASE-3)
-/** RM service request needs to be forwarded but the transport packet alloc API
- *  has not been provided */
-#define RM_SERVICE_ERROR_TRANSPORT_PKT_ALLOC_API_NULL (RM_SERVICE_ERROR_BASE-4)
-/** A failure occurred within a registered transport's packet alloc API */
-#define RM_SERVICE_ERROR_TRANSPORT_ALLOC_PKT_ERROR (RM_SERVICE_ERROR_BASE-5)
-/** RM service request needs to be forwarded but the buffer allocated by transport
- *  is not large enough to fit the RM transport packet */
-#define RM_SERVICE_ERROR_TRANSPORT_PKT_BUF_TOO_SMALL (RM_SERVICE_ERROR_BASE-6)
-/** RM service request needs to be forwarded but the transport returned an error
- *  when trying to send the RM packet to the higher level agent */
-#define RM_SERVICE_ERROR_TRANPSPORT_SEND_ERROR (RM_SERVICE_ERROR_BASE-7)
-/** RM service response from higher level agent did not match any requests made
- *  by the provided RM instance */
-#define RM_SERVICE_ERROR_TRANSACTION_DOES_NOT_EXIST_FOR_THIS_RM_INSTANCE (RM_SERVICE_ERROR_BASE-8)
-/** RM failed to allocate memory for new service transaction */
-#define RM_SERVICE_ERROR_TRANSACTION_FAILED_TO_ALLOCATE (RM_SERVICE_ERROR_BASE-9)
-/** RM could not find the service transaction in the RM instance's transaction queue */
-#define RM_SERVICE_ERROR_SERVICE_TRANSACTION_DOES_NOT_EXIST (RM_SERVICE_ERROR_BASE-10)
-/** A failure occurred within a registered transport's packet free API */
-#define RM_SERVICE_ERROR_TRANSPORT_FREE_PKT_ERROR (RM_SERVICE_ERROR_BASE-11)
-/** Invalid NameServer object modification on non-Server instance */
-#define RM_SERVICE_ERROR_NAMESERVER_OBJECT_MOD_ON_INVALID_INSTANCE (RM_SERVICE_ERROR_BASE-12)
-/** Request failed because both a NameServer name and a resource range were specified */
-#define RM_SERVICE_ERROR_NAMESERVER_NAME_AND_RESOURCE_RANGE_BOTH_DEFINED (RM_SERVICE_ERROR_BASE-13)
-/** Error occurred when trying to add an object to the NameServer */
-#define RM_SERVICE_ERROR_NAMESERVER_OBJECT_ADD_FAILED (RM_SERVICE_ERROR_BASE-14)
-/** Could not find the object specified in the service request in the NameServer */
-#define RM_SERVICE_ERROR_NAMESERVER_ERROR_NAME_DOES_NOT_EXIST (RM_SERVICE_ERROR_BASE-15)
-
-/**
- * @brief Maximum number of characters in the resource names
- */
-#define RM_RESOURCE_NAME_MAX_CHARS (36)
-
 /** 
  * @brief RM service types
  */
@@ -213,7 +90,7 @@ typedef struct {
      *  be returned if the service request is satisfied immediately */
     uint32_t serviceId;
     /** The name of the resource affected by the service request */
-    char resourceName[RM_RESOURCE_NAME_MAX_CHARS];
+    char resourceName[RM_NAME_MAX_CHARS];
     /** The base value of the returned resource.  In the case of a block resource allocation 
      *  response this field will contain the base value of the block. */
     int32_t resourceBase;
@@ -268,7 +145,7 @@ typedef struct {
 } Rm_ServiceReqInfo;
 
 /** 
- * @brief RM Service Port provided to software components and applications that 
+ * @brief RM Service Handle provided to software components and applications that 
  *        request RM services for the resources they wish to use
  */
 typedef struct {
@@ -294,7 +171,7 @@ typedef struct {
      */
     void (*Rm_serviceHandler)(void *rmHandle, Rm_ServiceReqInfo *serviceRequest,
                               Rm_ServiceRespInfo *serviceResponse);
-} Rm_ServicePort;
+} Rm_ServiceHandle;
 
 /** 
  * @brief RM pre-main allocation request information provided by the pre-main 
@@ -334,8 +211,8 @@ void Rm_servicePreMainRequest(Rm_PreMainReqCfg *reqCfg, Rm_ServiceRespInfo *preM
 /**
  *  @b Description
  *  @n  
- *      This function returns a RM service port to the application to 
- *      provide to software components (LLDs, BIOS, etc) that want to use RM
+ *      This function returns a RM service handle to the application to 
+ *      provide services to software components (LLDs, BIOS, etc) that want to use RM
  *      for resource management.
  *
  *  @param[in]  rmHandle
@@ -343,12 +220,22 @@ void Rm_servicePreMainRequest(Rm_PreMainReqCfg *reqCfg, Rm_ServiceRespInfo *preM
  *      instance.
  *
  *  @retval
- *      Success - RM Service Port.  Used by an application or component to
+ *      Success - RM Service Handle.  Used by an application or component to
  *                request a service from RM.
  *  @retval
  *      Failure - NULL
  */
-Rm_ServicePort *Rm_serviceGetPort(Rm_Handle rmHandle);
+Rm_ServiceHandle *Rm_serviceOpenHandle(Rm_Handle rmHandle, int32_t *result);
+
+/**
+ *  @b Description
+ *  @n  
+ *      This function closes a RM instance's service handle
+ *
+ *  @param[in]  rmServiceHandle
+ *      RM instance service handle to be closed.
+ */
+int32_t Rm_serviceCloseHandle(Rm_ServiceHandle *rmServiceHandle);
 
 /** 
 @} 
@@ -358,5 +245,5 @@ Rm_ServicePort *Rm_serviceGetPort(Rm_Handle rmHandle);
 }
 #endif
 
-#endif /* RMSERVICES_H_ */
+#endif /* RM_SERVICES_H_ */
 
index 6a961838b82e4b4ebf470a0dd06930c0a2aaf907..4fa569dfe982afee666296df83ebc2a25547c751 100644 (file)
@@ -1,5 +1,5 @@
 /**
- *   @file  rmtransport.h
+ *   @file  rm_transport.h
  *
  *   @brief   
  *      This is the RM include file for the generic transport interface used by RM to exchange
@@ -7,7 +7,7 @@
  *
  *  \par
  *  ============================================================================
- *  @n   (C) Copyright 2012, Texas Instruments, Inc.
+ *  @n   (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 RMTRANSPORT_H_
-#define RMTRANSPORT_H_
+#ifndef RM_TRANSPORT_H_
+#define RM_TRANSPORT_H_
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+/* Standard includes */
+#include <stdbool.h>
+
 /* RM includes */
 #include <ti/drv/rm/rm.h>
 
 /**
-@addtogroup RMTRANSPORT_API
+@addtogroup RM_TRANSPORT_API
 @{
 */
 
-/** RM Transport Result Return Codes */
-/** RM Transport Success Code Base */
-#define RM_TRANSPORT_OK_BASE (0)
-/** RM transport action was successful. */
-#define RM_TRANSPORT_SUCCESSFUL (RM_TRANSPORT_OK_BASE)
-
-/** RM Transport Error Code Base */
-#define RM_TRANSPORT_ERROR_BASE (-64)
-/** RM transport handle has not been registered with the RM instance */
-#define RM_TRANSPORT_ERROR_HANDLE_HAS_NOT_BEEN_REGISTERED (RM_TRANSPORT_ERROR_BASE-1)
-/** RM packets are available but an error was encountered during reception */
-#define RM_TRANSPORT_ERROR_PACKET_RECEPTION_ERROR (RM_TRANSPORT_ERROR_BASE-3)
-/** RM received a packet with an unknown RM packet type */
-#define RM_TRANSPORT_ERROR_INVALID_PACKET_TYPE (RM_TRANSPORT_ERROR_BASE-4)
-/** RM resource request transaction could not be found matching the response received */
-#define RM_TRANSPORT_ERROR_MATCHING_RESOURCE_REQUEST_NOT_FOUND (RM_TRANSPORT_ERROR_BASE-5)
-/** RM NameServer request transaction could not be found matching the response received */
-#define RM_TRANSPORT_ERROR_MATCHING_NAME_SERVER_REQUEST_NOT_FOUND (RM_TRANSPORT_ERROR_BASE-6)
-
-/** 
- * @brief Result of RM transport layer operations
- */
-typedef int32_t   Rm_TransportResult;
-
 /** Maximum size of the RM transport packet */
-#define RM_TRANSPORT_PACKET_MAX_SIZE_BYTES (256)  // Placeholder: This will 
-                                                 // change during development
+#define RM_TRANSPORT_PACKET_MAX_SIZE_BYTES (256)
 
 /** 
  * @brief RM transport handle
@@ -95,19 +73,11 @@ typedef enum {
     /** Allocate/Free request packet */
     Rm_pktType_RESOURCE_REQUEST = 0,
     /** Allocate/Free response packet */ 
-    Rm_pktType_RESOURCE_RESPONSE = 1,
+    Rm_pktType_RESOURCE_RESPONSE,
     /** RM NameServer mapping request */
-    Rm_pktType_NAMESERVER_REQUEST = 2,
+    Rm_pktType_NAMESERVER_REQUEST,
     /** RM NameServer mapping response */
-    Rm_pktType_NAMESERVER_RESPONSE = 3,    
-    /** Policy request packet */
-    Rm_pktType_POLICY_REQUEST = 4,
-    /** Policy response packet */
-    Rm_pktType_POLICY_CHANGE = 5,
-    /** Resource pool modification request */
-    Rm_pktType_RESOURCE_POOL_MODIFICATION_REQUEST = 6,
-    /** Resource pool modification response */
-    Rm_pktType_RESOURCE_POOL_MODIFICATION_RESPONSE = 7
+    Rm_pktType_NAMESERVER_RESPONSE
 } Rm_pktType;
 
 /** 
@@ -115,11 +85,11 @@ typedef enum {
  */
 typedef struct {
     /** Packet length in bytes.  Written by application when allocated */
-    uint32_t pktLenBytes;
+    uint32_t   pktLenBytes;
     /** Type of RM packet contained in the byte data array */
     Rm_pktType pktType;
     /** Byte array containing RM packet data */
-    char data[RM_TRANSPORT_PACKET_MAX_SIZE_BYTES];
+    char       data[RM_TRANSPORT_PACKET_MAX_SIZE_BYTES];
 } Rm_Packet;
 
 typedef struct {
@@ -281,7 +251,7 @@ typedef struct {
  *      Failure - NULL
  */
 Rm_TransportHandle Rm_transportRegister (Rm_TransportCfg *transportCfg, int32_t *result);
-Rm_TransportResult Rm_transportUnregister (Rm_Handle rmHandle, Rm_TransportHandle transportHandle);
+int32_t Rm_transportUnregister (Rm_Handle rmHandle, Rm_TransportHandle transportHandle);
 int32_t Rm_receivePktIsr(Rm_TransportHandle transportHandle, Rm_Packet *pkt);
 int32_t Rm_receivePktPolling(Rm_TransportHandle transportHandle);
 
@@ -294,4 +264,4 @@ int32_t Rm_receivePktPolling(Rm_TransportHandle transportHandle);
 }
 #endif
 
-#endif /* RMTRANSPORT_H_ */
+#endif /* RM_TRANSPORT_H_ */
diff --git a/rm_types.h b/rm_types.h
deleted file mode 100644 (file)
index d4ed58d..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- *   @file  rmtypes.h
- *
- *   @brief   
- *      This is a wrapper header file which includes the standard types
- *      used by the RM.
- *
- *  \par
- *  NOTE:
- *      (C) Copyright 2012 Texas Instruments, Inc.
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
- *  are met:
- *
- *    Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer.
- *
- *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
- *    distribution.
- *
- *    Neither the name of Texas Instruments Incorporated nor the names of
- *    its contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
- *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
- *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  \par
-*/
-#ifndef __RMTYPES_H__
-#define __RMTYPES_H__
-
-/* c99 include */
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdbool.h>
-#include <ctype.h>
-
-#endif /* __RMTYPES_H__ */
-
-
-
index 5ec0c98f09564d514cfcb1b63956f4010e5eb1e3..0e70fe889f3ecc4fb37351e17cd5e31219086e8c 100644 (file)
@@ -46,7 +46,7 @@ extern "C" {
  *   @brief  Resource Manager Version Definitions\r
  *\r
  *  ============================================================\r
- *  Copyright (c) Texas Instruments Incorporated 2009-2012\r
+ *  Copyright (c) Texas Instruments Incorporated 2012-2013\r
  * \r
  *  Redistribution and use in source and binary forms, with or without \r
  *  modification, are permitted provided that the following conditions \r
index 06b8e61fa17af1549d1bfae09298dfc86b50f1e4..2612c0fdefc561044c293275230434c8eba28613 100644 (file)
@@ -6,7 +6,7 @@
 @REM * DESCRIPTION: \r
 @REM *  Configures and sets up the Build Environment\r
 @REM *\r
-@REM * Copyright (C) 2012, Texas Instruments, Inc.\r
+@REM * Copyright (C) 2012-2013, Texas Instruments, Inc.\r
 @REM *****************************************************************************\r
 \r
 @echo ---------------------------------------\r
index f81b0c169990a8c081f5478634bdef5d22770f54..69271f5c9516f52e6dd17b92e6b55b4b82037e31 100644 (file)
@@ -6,7 +6,7 @@
  * DESCRIPTION: 
  *  This file contains the module specification for the RM source directory.
  *
- * Copyright (C) 2012, Texas Instruments, Inc.
+ * Copyright (C) 2012-2013, Texas Instruments, Inc.
  *****************************************************************************/
 
 /* Load the library utility. */
index eedda3c0def0fd592df0ad3fb61d7c22fd41a67f..ee73b1f425727bdea6a5082fb13638b3092fa0a8 100644 (file)
--- a/src/rm.c
+++ b/src/rm.c
@@ -6,7 +6,7 @@
  *\r
  *  \par\r
  *  ============================================================================\r
- *  @n   (C) Copyright 2012, Texas Instruments, Inc.\r
+ *  @n   (C) Copyright 2012-2013, Texas Instruments, Inc.\r
  * \r
  *  Redistribution and use in source and binary forms, with or without \r
  *  modification, are permitted provided that the following conditions \r
  *  \par\r
 */\r
 \r
-/* RM Types */\r
-#include <ti/drv/rm/rm_types.h>\r
+/* Standard includes */\r
+#include <stdint.h>\r
+#include <string.h>\r
+#include <stdbool.h>\r
 \r
 /* RM external includes */\r
 #include <ti/drv/rm/rm.h>\r
@@ -68,7 +70,7 @@
 /**********************************************************************\r
  ************************** Globals ***********************************\r
  **********************************************************************/\r
-extern char rmDtbStartingNode[];\r
+extern const char rmDtbStartingNode[];\r
 \r
 /** @brief Global Variable which describes the RM Version Information */\r
 const char  rmVersionStr[] = RM_VERSION_STR ":" __DATE__  ":" __TIME__;\r
@@ -79,7 +81,7 @@ const char  rmVersionStr[] = RM_VERSION_STR ":" __DATE__  ":" __TIME__;
 \r
 Rm_Transaction *rmTransactionQueueAdd(Rm_Inst *rmInst)\r
 {\r
-    Rm_Transaction *transactionQueue = (Rm_Transaction *)rmInst->transactionQueue;\r
+    Rm_Transaction *transactionQueue = rmInst->transactionQueue;\r
     Rm_Transaction *newTransaction   = NULL;\r
 \r
     newTransaction = Rm_osalMalloc(sizeof(Rm_Transaction));\r
@@ -103,7 +105,7 @@ Rm_Transaction *rmTransactionQueueAdd(Rm_Inst *rmInst)
 \r
 Rm_Transaction *rmTransactionQueueFind(Rm_Inst *rmInst, uint32_t transactionId)\r
 {\r
-    Rm_Transaction *transaction = (Rm_Transaction *)rmInst->transactionQueue;\r
+    Rm_Transaction *transaction = rmInst->transactionQueue;\r
 \r
     if (transaction != NULL) {\r
         while (transaction != NULL) {\r
@@ -118,7 +120,7 @@ Rm_Transaction *rmTransactionQueueFind(Rm_Inst *rmInst, uint32_t transactionId)
 \r
 int32_t rmTransactionQueueDelete(Rm_Inst *rmInst, uint32_t transactionId)\r
 {\r
-    Rm_Transaction *transaction     = (Rm_Transaction *) rmInst->transactionQueue;\r
+    Rm_Transaction *transaction     = rmInst->transactionQueue;\r
     Rm_Transaction *prevTransaction = NULL;\r
     int32_t         retVal          = RM_SERVICE_STATE_OKAY;\r
 \r
@@ -173,14 +175,14 @@ uint32_t rmTransactionGetSequenceNum(Rm_Inst *rmInst)
 \r
 Rm_Allocator *rmAllocatorAdd(Rm_Inst *rmInst, const char *resourceName)\r
 {\r
-    Rm_Allocator *allocators   = (Rm_Allocator *)rmInst->allocators;\r
+    Rm_Allocator *allocators   = rmInst->allocators;\r
     Rm_Allocator *newAllocator = NULL;\r
 \r
     newAllocator = Rm_osalMalloc(sizeof(Rm_Allocator));\r
 \r
     if (newAllocator) {\r
         memset((void *)newAllocator, 0, sizeof(Rm_Allocator));\r
-        strncpy(newAllocator->resourceName, resourceName, RM_RESOURCE_NAME_MAX_CHARS);\r
+        strncpy(newAllocator->resourceName, resourceName, RM_NAME_MAX_CHARS);\r
         newAllocator->allocatorRootEntry = NULL;\r
         newAllocator->nextAllocator = NULL;  \r
 \r
@@ -212,7 +214,7 @@ Rm_Allocator *rmAllocatorFind(Rm_Allocator *allocatorList, char *resourceName)
 \r
 int32_t rmAllocatorDelete(Rm_Inst *rmInst, char *resourceName)\r
 {\r
-    Rm_Allocator *allocator = (Rm_Allocator *) rmInst->allocators;\r
+    Rm_Allocator *allocator = rmInst->allocators;\r
     Rm_Allocator *prevAllocator = NULL;\r
     int32_t       retVal = RM_SERVICE_STATE_OKAY;\r
 \r
@@ -562,7 +564,6 @@ int32_t rmTreeAllocate(Rm_Inst *rmInst, Rm_Allocator *allocator, int32_t resourc
                 allocPassesPolicy = TRUE;\r
             }\r
             else {\r
-                allocPassesPolicy = FALSE;\r
                 policyCheckCfg.policyDtb = rmInst->policy;\r
                 policyCheckCfg.resourceOffset = resourcePolicy;    \r
                 policyCheckCfg.type = policyCheckType;\r
@@ -749,7 +750,7 @@ int32_t rmTreeAllocate(Rm_Inst *rmInst, Rm_Allocator *allocator, int32_t resourc
     return(retVal);        \r
 }\r
 \r
-int32_t rmTreeFree(Rm_Inst *rmInst, Rm_Allocator *allocator, int32_t resourcePolicy, Rm_AllocatorOpInfo *opInfo)\r
+int32_t rmTreeFree(Rm_Allocator *allocator, Rm_AllocatorOpInfo *opInfo)\r
 {\r
     Rm_ResourceNode  findNode;\r
     Rm_ResourceNode *matchingNode = NULL;\r
@@ -958,7 +959,7 @@ int32_t rmAllocatorOperation(Rm_Inst *rmInst, Rm_AllocatorOpInfo *opInfo)
             retVal = rmTreeAllocate(rmInst, allocator, resourceOffsetInPolicy, opInfo);\r
         }\r
         else if (opInfo->operation == Rm_allocatorOp_FREE) {\r
-            retVal = rmTreeFree(rmInst, allocator, resourceOffsetInPolicy, opInfo);\r
+            retVal = rmTreeFree(allocator, opInfo);\r
         }         \r
     }\r
     else {\r
@@ -997,7 +998,7 @@ void rmAllocationHandler (Rm_Inst *rmInst, Rm_Transaction *transaction, void *va
                 nameServerObjCfg.nameServerTree = rmInst->nameServer;\r
                 nameServerObjCfg.nodeCfg.objName = transaction->resourceInfo.nameServerName;\r
                 if ((retVal = rmNameServerFindObject(&nameServerObjCfg)) == RM_SERVICE_PROCESSING) {\r
-                    strncpy(transaction->resourceInfo.name, nameServerObjCfg.nodeCfg.resourceName, RM_RESOURCE_NAME_MAX_CHARS);\r
+                    strncpy(transaction->resourceInfo.name, nameServerObjCfg.nodeCfg.resourceName, RM_NAME_MAX_CHARS);\r
                     transaction->resourceInfo.base = nameServerObjCfg.nodeCfg.resourceBase;\r
                     transaction->resourceInfo.length = nameServerObjCfg.nodeCfg.resourceLength;\r
                 }                \r
@@ -1053,7 +1054,7 @@ void rmFreeHandler (Rm_Inst *rmInst, Rm_Transaction *transaction, void *validIns
                 nameServerObjCfg.nameServerTree = rmInst->nameServer;\r
                 nameServerObjCfg.nodeCfg.objName = transaction->resourceInfo.nameServerName;\r
                 if ((retVal = rmNameServerFindObject(&nameServerObjCfg)) == RM_SERVICE_PROCESSING) {\r
-                    strncpy(transaction->resourceInfo.name, nameServerObjCfg.nodeCfg.resourceName, RM_RESOURCE_NAME_MAX_CHARS);\r
+                    strncpy(transaction->resourceInfo.name, nameServerObjCfg.nodeCfg.resourceName, RM_NAME_MAX_CHARS);\r
                     transaction->resourceInfo.base = nameServerObjCfg.nodeCfg.resourceBase;\r
                     transaction->resourceInfo.length = nameServerObjCfg.nodeCfg.resourceLength;\r
                 }                \r
@@ -1097,7 +1098,7 @@ void rmServiceResponder (Rm_Inst *rmInst, Rm_Transaction *transaction)
          (transaction->type == Rm_service_RESOURCE_ALLOCATE_USE) ||\r
          (transaction->type == Rm_service_RESOURCE_GET_BY_NAME)))\r
     {\r
-        strncpy(serviceResponse.resourceName, transaction->resourceInfo.name, RM_RESOURCE_NAME_MAX_CHARS);\r
+        strncpy(serviceResponse.resourceName, transaction->resourceInfo.name, RM_NAME_MAX_CHARS);\r
         serviceResponse.resourceBase = transaction->resourceInfo.base;\r
         serviceResponse.resourceLength = transaction->resourceInfo.length;\r
     }\r
@@ -1282,7 +1283,7 @@ void rmTransactionProcessor (Rm_Inst *rmInst, Rm_Transaction *transaction)
                     else if (transaction->type == Rm_service_RESOURCE_GET_BY_NAME) {\r
                         if ((transaction->state = rmNameServerFindObject(&nameServerObjCfg)) ==\r
                             RM_SERVICE_PROCESSING) {\r
-                            strncpy(transaction->resourceInfo.name, nameServerObjCfg.nodeCfg.resourceName, RM_RESOURCE_NAME_MAX_CHARS);\r
+                            strncpy(transaction->resourceInfo.name, nameServerObjCfg.nodeCfg.resourceName, RM_NAME_MAX_CHARS);\r
                             transaction->resourceInfo.base = nameServerObjCfg.nodeCfg.resourceBase;\r
                             transaction->resourceInfo.length = nameServerObjCfg.nodeCfg.resourceLength;\r
                             transaction->state = RM_SERVICE_APPROVED_AND_COMPLETED;\r
@@ -1363,7 +1364,7 @@ int32_t rmFindAndReserveLinuxResource(Rm_Inst *rmInst, const char *resourceName,
     memset((void *) &opInfo, 0, sizeof(Rm_AllocatorOpInfo));\r
     memset((void *) &resourceInfo, 0, sizeof(Rm_ResourceInfo));\r
 \r
-    strncpy(resourceInfo.name, resourceName, RM_RESOURCE_NAME_MAX_CHARS);\r
+    strncpy(resourceInfo.name, resourceName, RM_NAME_MAX_CHARS);\r
     opInfo.serviceSrcInstNode = rmPolicyGetLinuxInstNode(rmInst->validInstances);\r
     opInfo.operation = Rm_allocatorOp_ALLOCATE;\r
     opInfo.resourceInfo = &resourceInfo;    \r
@@ -1693,7 +1694,7 @@ Rm_PreMainHandle Rm_preMainInit(Rm_PreMainInitCfg *preMainInitCfg, int32_t *resu
 {\r
     Rm_PreMainInst *preMainInst;\r
 \r
-    if ((strlen(preMainInitCfg->instName) + 1) > RM_INSTANCE_NAME_MAX_CHARS) {\r
+    if ((strlen(preMainInitCfg->instName) + 1) > RM_NAME_MAX_CHARS) {\r
         *result = RM_INIT_ERROR_INSTANCE_NAME_TOO_BIG;\r
         return (NULL);\r
     }\r
@@ -1717,7 +1718,7 @@ Rm_PreMainHandle Rm_preMainInit(Rm_PreMainInitCfg *preMainInitCfg, int32_t *resu
         preMainInst = NULL;\r
     }\r
     else {\r
-        strncpy(preMainInst->instName, preMainInitCfg->instName, RM_INSTANCE_NAME_MAX_CHARS);\r
+        strncpy(preMainInst->instName, preMainInitCfg->instName, RM_NAME_MAX_CHARS);\r
         preMainInst->requestCount = 0;\r
         preMainInst->preMainReqList = NULL;\r
     }\r
@@ -1760,7 +1761,7 @@ Rm_Handle Rm_init(Rm_InitCfg *initCfg, int32_t *result)
 \r
     *result = RM_INIT_OK;\r
     \r
-    if ((strlen(initCfg->instName) + 1) > RM_INSTANCE_NAME_MAX_CHARS) {\r
+    if ((strlen(initCfg->instName) + 1) > RM_NAME_MAX_CHARS) {\r
         *result = RM_INIT_ERROR_INSTANCE_NAME_TOO_BIG;\r
         return (NULL);\r
     }\r
@@ -1768,8 +1769,9 @@ Rm_Handle Rm_init(Rm_InitCfg *initCfg, int32_t *result)
     /* Create and initialize instance */\r
     rmInst = Rm_osalMalloc (sizeof(Rm_Inst));\r
     memset ((void *) rmInst, 0, sizeof(Rm_Inst));\r
-    strncpy (rmInst->instName, initCfg->instName, RM_INSTANCE_NAME_MAX_CHARS);\r
+    strncpy (rmInst->instName, initCfg->instName, RM_NAME_MAX_CHARS);\r
     rmInst->instType = initCfg->instType;\r
+    rmInst->serviceHandle = NULL;\r
     rmInst->registeredWithDelegateOrServer = false;\r
     rmInst->transports = NULL;\r
     rmInst->allocators = NULL;\r
index 37f658fa9de9f3a09d3ae7d7f8874596ef2c5144..9bd024ce0507422853e8ee7c32650e017064c753 100644 (file)
@@ -7,7 +7,7 @@
  *
  *  \par
  *  ============================================================================
- *  @n   (C) Copyright 2012, Texas Instruments, Inc.
+ *  @n   (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
 */
 
-/* RM Types */
-#include <ti/drv/rm/rm_types.h>
-
 /* RM external API includes */
 #include <ti/drv/rm/rm.h>
-#include <ti/drv/rm/rm_services.h>
 
 /* RM internal API includes */
 #include <ti/drv/rm/include/rm_dtb_utilloc.h>
@@ -61,7 +57,7 @@
  ********************Common DTB Parsing Functions**********************
  **********************************************************************/
 
-char rmDtbStartingNode[] = "\0";
+const char rmDtbStartingNode[] = "\0";
 
 /* Construct and return a list of ranges as specified in either the Resource
  * DTB or a Policy DTB */
@@ -311,7 +307,7 @@ Rm_NsAssignment *rmDtbUtilResExtractNsAssignment(const void *dtbDataPtr, int32_t
         newAssignment = (Rm_NsAssignment *) Rm_osalMalloc(sizeof(Rm_NsAssignment));
         
         nameLenBytes = strlen((char *) &dtbNsAssignmentData[i]) + 1;
-        if (nameLenBytes > RM_RESOURCE_NAME_MAX_CHARS) {
+        if (nameLenBytes > RM_NAME_MAX_CHARS) {
             Rm_osalFree((void *)newAssignment, sizeof(Rm_NsAssignment));
             while (startAssignment) {
                 newAssignment = startAssignment->nextNsAssignment;
@@ -321,7 +317,7 @@ Rm_NsAssignment *rmDtbUtilResExtractNsAssignment(const void *dtbDataPtr, int32_t
             *result = RM_INIT_ERROR_NS_ASSIGNMENT_NAME_TOO_LONG;
             return(NULL);
         }        
-        strncpy(newAssignment->nsName, ((char *) &dtbNsAssignmentData[i]), RM_RESOURCE_NAME_MAX_CHARS);
+        strncpy(newAssignment->nsName, ((char *) &dtbNsAssignmentData[i]), RM_NAME_MAX_CHARS);
         
         /* Extract 32-bit base value and flip endian */
         i += nameLenBytes;
@@ -498,7 +494,7 @@ Rm_PolicyValidInst *rmDtbUtilPolicyExtractValidInstances(const void *dtbDataPtr,
         newInst = (Rm_PolicyValidInst *) Rm_osalMalloc(sizeof(Rm_PolicyValidInst));
 
         instLenBytes = strlen((char *) &dtbValidInstData[i]) + 1;
-        if (instLenBytes > RM_INSTANCE_NAME_MAX_CHARS) {
+        if (instLenBytes > RM_NAME_MAX_CHARS) {
             Rm_osalFree((void *)newInst, sizeof(Rm_PolicyValidInst));
             while (startInst) {
                 newInst = startInst->nextValidInst;
index ce3ab592e41d8396680db15f045d22fc5357109f..c4a9e1a7270fa6085c56832ec3ba3da55d73d723 100644 (file)
@@ -6,7 +6,7 @@
  *
  *  \par
  *  ============================================================================
- *  @n   (C) Copyright 2012, Texas Instruments, Inc.
+ *  @n   (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
 */
 
-/* RM Types */
-#include <ti/drv/rm/rm_types.h>
+/* Standard includes */
+#include <string.h>
 
 /* RM external API includes */
-#include <ti/drv/rm/rm_services.h>
+#include <ti/drv/rm/rm.h>
 
 /* RM internal API includes */
 #include <ti/drv/rm/include/rm_nameserverloc.h>
@@ -85,7 +85,7 @@ int32_t rmNameServerFindObject(Rm_NameServerObjCfg *objCfg)
     int32_t            retVal = RM_SERVICE_ERROR_NAMESERVER_ERROR_NAME_DOES_NOT_EXIST;
 
     memset((void *)&findNode, 0, sizeof(Rm_NameServerNode));
-    strncpy(findNode.objName, objCfg->nodeCfg.objName, RM_RESOURCE_NAME_MAX_CHARS);
+    strncpy(findNode.objName, objCfg->nodeCfg.objName, RM_NAME_MAX_CHARS);
     
     if (matchingNode = RB_FIND(_Rm_NameServerTree, objCfg->nameServerTree, &findNode)) {
         /* Found in NameServer */
@@ -105,7 +105,7 @@ int32_t rmNameServerDeleteObject(Rm_NameServerObjCfg *objCfg)
     int32_t            retVal = RM_SERVICE_ERROR_NAMESERVER_ERROR_NAME_DOES_NOT_EXIST;    
 
     memset((void *)&findNode, 0, sizeof(Rm_NameServerNode));
-    strncpy(findNode.objName, objCfg->nodeCfg.objName, RM_RESOURCE_NAME_MAX_CHARS);
+    strncpy(findNode.objName, objCfg->nodeCfg.objName, RM_NAME_MAX_CHARS);
     
     if (matchingNode = RB_FIND(_Rm_NameServerTree, objCfg->nameServerTree, &findNode)) {
         /* Remove from NameServer */
index c9d97c8639d7c862db43668603e7c2544f7280c1..b49582b6d748debd1e7355ffb7e605c74b127418 100644 (file)
@@ -1,12 +1,12 @@
 /**
- *   @file  rmpolicy.c
+ *   @file  rm_policy.c
  *
  *   @brief   
  *      Resource Manager Policy source.
  *
  *  \par
  *  ============================================================================
- *  @n   (C) Copyright 2012, Texas Instruments, Inc.
+ *  @n   (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
 */
 
-/* RM Types */
-#include <ti/drv/rm/rm_types.h>
+/* Standard includes */
+#include <ctype.h>
 
 /* RM external API includes */
 #include <ti/drv/rm/rm.h>
-#include <ti/drv/rm/rm_services.h>
 
 /* RM internal API includes */
 #include <ti/drv/rm/include/rm_loc.h>
@@ -64,7 +63,7 @@
  *********************** Policy Globals *******************************
  **********************************************************************/
 
-char Rm_policyAllInstances[] = "*";
+const char Rm_policyAllInstances[] = "*";
 
 /**********************************************************************
  ******************** Local Policy Functions **************************
@@ -90,16 +89,16 @@ Rm_PolicyPermission *policyParseSubPermission(char *permStrStart, char *permStrE
     Rm_PolicyPermission *newPerm = NULL;
     Rm_PolicyPermission *prevPerm = NULL;
     Rm_PolicyPermission *nextPerm = NULL;
-    char *permStrPtr = NULL;
-    char *subgroupStart = NULL;
-    char *subgroupEnd = NULL;
-    uint32_t permStrLen = (uint32_t)(permStrEnd - permStrStart + 1);
-    char instNameTemp[RM_INSTANCE_NAME_MAX_CHARS];
-    uint32_t instNameIndex;
-    bool foundInstName;
-    bool instNameComplete;
-    bool assignmentLeft;
-    bool assignmentRight;
+    char                *permStrPtr = NULL;
+    char                *subgroupStart = NULL;
+    char                *subgroupEnd = NULL;
+    uint32_t             permStrLen = (uint32_t)(permStrEnd - permStrStart + 1);
+    char                 instNameTemp[RM_NAME_MAX_CHARS];
+    uint32_t             instNameIndex;
+    bool                 foundInstName;
+    bool                 instNameComplete;
+    bool                 assignmentLeft;
+    bool                 assignmentRight;
 
     /* Create a local copy of the sub-permission string */
     permStrPtr = Rm_osalMalloc(permStrLen);
@@ -116,8 +115,7 @@ Rm_PolicyPermission *policyParseSubPermission(char *permStrStart, char *permStrE
 
     if ((!subgroupStart) || (!subgroupEnd) || (subgroupStart > subgroupEnd) ||
         ((subgroupStart != strrchr(permStrStart, RM_POLICY_PERM_SUBGROUP_START)) &&
-         (subgroupEnd != strrchr(permStrStart, RM_POLICY_PERM_SUBGROUP_END))))
-    {
+         (subgroupEnd != strrchr(permStrStart, RM_POLICY_PERM_SUBGROUP_END)))) {
         /* Free the memory associated with the temp string and return an error if:
          * a) Could not find the instance group start
          * b) Could not find the instance group end
@@ -159,7 +157,7 @@ Rm_PolicyPermission *policyParseSubPermission(char *permStrStart, char *permStrE
             newPerm = (Rm_PolicyPermission *) Rm_osalMalloc(sizeof(Rm_PolicyPermission));
             memset((void *)newPerm, 0, sizeof(Rm_PolicyPermission));
 
-            strncpy(newPerm->instName, instNameTemp, RM_INSTANCE_NAME_MAX_CHARS);
+            strncpy(newPerm->instName, instNameTemp, RM_NAME_MAX_CHARS);
             newPerm->nextPermission = NULL;
 
             if (prevPerm == NULL) {
@@ -175,7 +173,7 @@ Rm_PolicyPermission *policyParseSubPermission(char *permStrStart, char *permStrE
             instNameIndex = 0;
             foundInstName = FALSE;
         }
-        else if (instNameIndex == RM_INSTANCE_NAME_MAX_CHARS) {
+        else if (instNameIndex == RM_NAME_MAX_CHARS) {
             /* Instance name is longer than max length */
             while (startPerm) {
                 nextPerm = startPerm->nextPermission;
@@ -400,10 +398,10 @@ Rm_PolicyPermission *policyGetAssignmentPermissions(Rm_PolicyAssignment *assignm
     Rm_PolicyPermission *startPerm = NULL;
     Rm_PolicyPermission *newPerm = NULL;
     Rm_PolicyPermission *prevPerm = NULL;
-    char *permStrStart = assignment->permissionsList;
-    char *permStrEnd;
-    uint32_t permStrLen = strlen(assignment->permissionsList) + 1;
-    uint32_t i = 0;
+    char                *permStrStart = assignment->permissionsList;
+    char                *permStrEnd;
+    uint32_t             permStrLen = strlen(assignment->permissionsList) + 1;
+    uint32_t             i = 0;
     
     while(i < permStrLen) {
         /* Find the first sub-permission specification and parse it.  A sub-permission
@@ -450,7 +448,7 @@ int32_t policyValidateAssignmentPermissions(Rm_PolicyValidInstTree *root,
 {
     Rm_PolicyAssignment *assignment = assignmentList;
     Rm_PolicyPermission *permissionList;
-    int32_t result;
+    int32_t              result;
 
     while (assignment) {
         /* Make sure assignment's permissions parse okay */
@@ -480,7 +478,7 @@ Rm_PolicyValidInstNode *rmPolicyGetValidInstNode(Rm_PolicyValidInstTree *validIn
     Rm_PolicyValidInstNode  findNode;
 
     memset((void *)&findNode, 0, sizeof(Rm_PolicyValidInstNode));
-    strncpy(findNode.name, instName, RM_RESOURCE_NAME_MAX_CHARS);
+    strncpy(findNode.name, instName, RM_NAME_MAX_CHARS);
     
     return (RB_FIND(_Rm_PolicyValidInstTree, validInstTree, &findNode));
 }
@@ -696,9 +694,9 @@ int32_t rmPolicyGetResourceOffset(void *policyDtb, char *resourceName)
 int32_t rmPolicyValidatePolicyResourceNames(void *policyDtb, void *allocatorList)
 {
     Rm_Allocator *allocator = (Rm_Allocator *)allocatorList;
-    int32_t              nodeOffset;
-    int32_t              depth;
-    const char          *nodeName;
+    int32_t       nodeOffset;
+    int32_t       depth;
+    const char   *nodeName;
 
     depth = RM_DTB_UTIL_STARTING_DEPTH;
     nodeOffset = RM_DTB_UTIL_STARTING_NODE_OFFSET;       
index 3033b9186b651bec02549a595404ea780fa894eb..441f94720c6d04e6d180ff333702e2750c34b7b8 100644 (file)
@@ -6,7 +6,7 @@
  *
  *  \par
  *  ============================================================================
- *  @n   (C) Copyright 2012, Texas Instruments, Inc.
+ *  @n   (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 
@@ -39,8 +39,8 @@
  *  \par
 */
 
-/* RM Types */
-#include <ti/drv/rm/rm_types.h>
+/* Standard includes */
+#include <string.h>
 
 /* RM external API includes */
 #include <ti/drv/rm/rm_services.h>
@@ -76,17 +76,17 @@ void Rm_serviceHandler (void *rmHandle, Rm_ServiceReqInfo *serviceRequest,
     transaction = rmTransactionQueueAdd(rmInst);
     if (transaction) {
         transaction->type = serviceRequest->type;
-        strncpy(transaction->serviceSrcInstName, rmInst->instName, RM_INSTANCE_NAME_MAX_CHARS);
+        strncpy(transaction->serviceSrcInstName, rmInst->instName, RM_NAME_MAX_CHARS);
         transaction->callback.serviceCallback = serviceRequest->callback.serviceCallback;
         transaction->state = RM_SERVICE_PROCESSING;
         if (serviceRequest->resourceName) {
-            strncpy(transaction->resourceInfo.name, serviceRequest->resourceName, RM_RESOURCE_NAME_MAX_CHARS);
+            strncpy(transaction->resourceInfo.name, serviceRequest->resourceName, RM_NAME_MAX_CHARS);
         }
         transaction->resourceInfo.base = serviceRequest->resourceBase;
         transaction->resourceInfo.length = serviceRequest->resourceLength;
         transaction->resourceInfo.alignment = serviceRequest->resourceAlignment;
         if (serviceRequest->resourceNsName) {
-            strncpy(transaction->resourceInfo.nameServerName, serviceRequest->resourceNsName, RM_RESOURCE_NAME_MAX_CHARS);
+            strncpy(transaction->resourceInfo.nameServerName, serviceRequest->resourceNsName, RM_NAME_MAX_CHARS);
         }
 
         rmTransactionProcessor (rmInst, transaction);
@@ -101,7 +101,7 @@ void Rm_serviceHandler (void *rmHandle, Rm_ServiceReqInfo *serviceRequest,
             if ((transaction->type == Rm_service_RESOURCE_ALLOCATE_INIT) ||
                 (transaction->type == Rm_service_RESOURCE_ALLOCATE_USE) ||
                 (transaction->type == Rm_service_RESOURCE_GET_BY_NAME)) {
-                strncpy(serviceResponse->resourceName, transaction->resourceInfo.name, RM_RESOURCE_NAME_MAX_CHARS);
+                strncpy(serviceResponse->resourceName, transaction->resourceInfo.name, RM_NAME_MAX_CHARS);
                 serviceResponse->resourceBase = transaction->resourceInfo.base;
                 serviceResponse->resourceLength = transaction->resourceInfo.length;
             }
@@ -174,30 +174,48 @@ void Rm_servicePreMainRequest(Rm_PreMainReqCfg *reqCfg, Rm_ServiceRespInfo *preM
         /* Fill out response */
         preMainResp->resourceBase = reqCfg->request->resourceBase;
         preMainResp->resourceLength = reqCfg->request->resourceLength;
-        strncpy(preMainResp->resourceName, reqCfg->request->resourceName, RM_RESOURCE_NAME_MAX_CHARS);
+        strncpy(preMainResp->resourceName, reqCfg->request->resourceName, RM_NAME_MAX_CHARS);
         preMainResp->serviceId = ++preMainInst->requestCount;
     }
 }
 
-Rm_ServicePort *Rm_serviceGetPort(Rm_Handle rmHandle)
+Rm_ServiceHandle *Rm_serviceOpenHandle(Rm_Handle rmHandle, int32_t *result)
 {
-    Rm_ServicePort *newServicePort = NULL;
-    
-    /* Create a new service handle for the specified RM instance */
-    
-    /* Get memory for a new service port from local memory */
-    newServicePort = Rm_osalMalloc (sizeof(Rm_ServicePort));
+    Rm_Inst          *rmInst = (Rm_Inst *)rmHandle;
+    Rm_ServiceHandle *newServiceHandle = NULL;
 
-    /* Return NULL immediately if malloc returned NULL */
-    if (newServicePort == NULL)
-    {
-        return (newServicePort);
+    *result = RM_INIT_OK;
+
+    if (rmInst->serviceHandle == NULL) {
+        newServiceHandle = Rm_osalMalloc (sizeof(Rm_ServiceHandle));
+        if (newServiceHandle) {
+            newServiceHandle->rmHandle = rmHandle;
+            newServiceHandle->Rm_serviceHandler = Rm_serviceHandler;
+            rmInst->serviceHandle = newServiceHandle;
+        }
+        else {
+            *result = RM_INIT_ERROR_SERVICE_HANDLE_MEMORY_ALLOC_FAILED;
+        }
     }
+    else {
+        *result = RM_INIT_ERROR_SERVICE_HANDLE_ALREADY_ALLOCATED;
+    }
+    return (newServiceHandle);
+}
 
-    newServicePort->rmHandle = rmHandle;
-    newServicePort->Rm_serviceHandler = Rm_serviceHandler;
+int32_t Rm_serviceCloseHandle(Rm_ServiceHandle *rmServiceHandle)
+{
+    Rm_Inst *rmInst = (Rm_Inst *)rmServiceHandle->rmHandle;
+    int32_t  retVal = RM_INIT_OK;
 
-    return (newServicePort);
+    if (rmInst->serviceHandle) {
+        Rm_osalFree((void *)rmServiceHandle, sizeof(Rm_ServiceHandle));
+        rmInst->serviceHandle = NULL;
+    }
+    else {
+        retVal = RM_INIT_ERROR_SERVICE_HANDLE_ALREADY_CLOSED_FOR_INSTANCE;
+    }
+    return(retVal);
 }
 
 /**
index 5e255ead4f286bc0b92b9a830e665394f92fbb61..8f0fa5529a00f1c4021ec1a7dd1f89c6abe9d7dc 100644 (file)
@@ -6,7 +6,7 @@
  *\r
  *  \par\r
  *  ============================================================================\r
- *  @n   (C) Copyright 2012, Texas Instruments, Inc.\r
+ *  @n   (C) Copyright 2012-2013, Texas Instruments, Inc.\r
  * \r
  *  Redistribution and use in source and binary forms, with or without \r
  *  modification, are permitted provided that the following conditions \r
@@ -39,8 +39,8 @@
  *  \par\r
 */\r
 \r
-/* RM Types */\r
-#include <ti/drv/rm/rm_types.h>\r
+/* Standard includes */\r
+#include <string.h>\r
 \r
 /* RM external includes */\r
 #include <ti/drv/rm/rm.h>\r
@@ -68,7 +68,7 @@ Rm_Transport *transportAdd(Rm_TransportCfg *transportCfg)
     if (newTransport) {\r
         newTransport->rmHandle = transportCfg->rmHandle;\r
         newTransport->remoteInstType = transportCfg->remoteInstType;\r
-        strncpy(&(newTransport->remoteInstName)[0], transportCfg->remoteInstName, RM_INSTANCE_NAME_MAX_CHARS);\r
+        strncpy(&(newTransport->remoteInstName)[0], transportCfg->remoteInstName, RM_NAME_MAX_CHARS);\r
         newTransport->nextTransport = NULL;\r
 \r
         if (transports) {\r
@@ -96,7 +96,7 @@ Rm_Transport *transportFindTransportHandle(Rm_Transport *transports,
     return (transports);\r
 }\r
 \r
-Rm_TransportResult transportDelete(Rm_Handle rmHandle, Rm_TransportHandle transportHandle)\r
+int32_t transportDelete(Rm_Handle rmHandle, Rm_TransportHandle transportHandle)\r
 {\r
     Rm_Inst      *rmInst = (Rm_Inst *)rmHandle;\r
     Rm_Transport *transport = (Rm_Transport *) rmInst->transports;\r
@@ -179,8 +179,8 @@ Rm_Packet *rmTransportCreateResourceReqPkt(Rm_Inst *rmInst, Rm_Transport *dstTra
     else if (transaction->type == Rm_service_RESOURCE_GET_BY_NAME) {\r
         resourceReqPkt->resourceReqType = Rm_resReqPktType_GET_NAMED;\r
     }\r
-    strncpy(resourceReqPkt->pktSrcInstName, rmInst->instName, RM_INSTANCE_NAME_MAX_CHARS);\r
-    strncpy(resourceReqPkt->serviceSrcInstName, transaction->serviceSrcInstName, RM_INSTANCE_NAME_MAX_CHARS);\r
+    strncpy(resourceReqPkt->pktSrcInstName, rmInst->instName, RM_NAME_MAX_CHARS);\r
+    strncpy(resourceReqPkt->serviceSrcInstName, transaction->serviceSrcInstName, RM_NAME_MAX_CHARS);\r
     memcpy ((void *)&(resourceReqPkt->resourceInfo), (void *)&(transaction->resourceInfo),\r
             sizeof(Rm_ResourceInfo));\r
     return (rmPkt);\r
@@ -239,8 +239,8 @@ Rm_Packet *rmTransportCreateNsRequestPkt(Rm_Inst *rmInst, Rm_Transport *dstTrans
     else if (transaction->type == Rm_service_RESOURCE_UNMAP_NAME) {\r
         nsReqPkt->nsRequestType = Rm_nsReqPktType_UNMAP_RESOURCE;\r
     }\r
-    strncpy(nsReqPkt->pktSrcInstName, rmInst->instName, RM_INSTANCE_NAME_MAX_CHARS);\r
-    strncpy(nsReqPkt->serviceSrcInstName, transaction->serviceSrcInstName, RM_INSTANCE_NAME_MAX_CHARS);\r
+    strncpy(nsReqPkt->pktSrcInstName, rmInst->instName, RM_NAME_MAX_CHARS);\r
+    strncpy(nsReqPkt->serviceSrcInstName, transaction->serviceSrcInstName, RM_NAME_MAX_CHARS);\r
     memcpy ((void *)&(nsReqPkt->resourceInfo), (void *)&(transaction->resourceInfo),\r
             sizeof(Rm_ResourceInfo));\r
 \r
@@ -329,12 +329,12 @@ Rm_TransportHandle Rm_transportRegister (Rm_TransportCfg *transportCfg, int32_t
     return ((Rm_TransportHandle) transport);\r
 }\r
 \r
-Rm_TransportResult Rm_transportUnregister (Rm_Handle rmHandle, Rm_TransportHandle transportHandle)\r
+int32_t Rm_transportUnregister (Rm_Handle rmHandle, Rm_TransportHandle transportHandle)\r
 {\r
-    Rm_Inst            *rmInst = (Rm_Inst *) rmHandle;\r
-    Rm_Transport       *transport = transportFindTransportHandle((Rm_Transport *)rmInst->transports, \r
+    Rm_Inst      *rmInst = (Rm_Inst *) rmHandle;\r
+    Rm_Transport *transport = transportFindTransportHandle((Rm_Transport *)rmInst->transports, \r
                                                                  transportHandle);\r
-    Rm_TransportResult  retVal = RM_TRANSPORT_SUCCESSFUL;  \r
+   int32_t        retVal = RM_TRANSPORT_SUCCESSFUL;  \r
 \r
     if (transport == NULL) {\r
         retVal = RM_TRANSPORT_ERROR_HANDLE_HAS_NOT_BEEN_REGISTERED;\r
@@ -381,8 +381,8 @@ int32_t Rm_receivePktIsr(Rm_TransportHandle transportHandle, Rm_Packet *pkt)
             else if (resourceReqPkt->resourceReqType == Rm_resReqPktType_GET_NAMED) {\r
                 transaction->type = Rm_service_RESOURCE_GET_BY_NAME;\r
             }            \r
-            strncpy(transaction->pktSrcInstName, resourceReqPkt->pktSrcInstName, RM_INSTANCE_NAME_MAX_CHARS);\r
-            strncpy(transaction->serviceSrcInstName, resourceReqPkt->serviceSrcInstName, RM_INSTANCE_NAME_MAX_CHARS);\r
+            strncpy(transaction->pktSrcInstName, resourceReqPkt->pktSrcInstName, RM_NAME_MAX_CHARS);\r
+            strncpy(transaction->serviceSrcInstName, resourceReqPkt->serviceSrcInstName, RM_NAME_MAX_CHARS);\r
             transaction->state = RM_SERVICE_PROCESSING;\r
             memcpy ((void *)&(transaction->resourceInfo), (void *)&(resourceReqPkt->resourceInfo),\r
                     sizeof(Rm_ResourceInfo));\r
@@ -425,8 +425,8 @@ int32_t Rm_receivePktIsr(Rm_TransportHandle transportHandle, Rm_Packet *pkt)
                 transaction->type = Rm_service_RESOURCE_UNMAP_NAME;\r
             }\r
 \r
-            strncpy(transaction->pktSrcInstName, nsRequestPkt->pktSrcInstName, RM_INSTANCE_NAME_MAX_CHARS);\r
-            strncpy(transaction->serviceSrcInstName, nsRequestPkt->serviceSrcInstName, RM_INSTANCE_NAME_MAX_CHARS);\r
+            strncpy(transaction->pktSrcInstName, nsRequestPkt->pktSrcInstName, RM_NAME_MAX_CHARS);\r
+            strncpy(transaction->serviceSrcInstName, nsRequestPkt->serviceSrcInstName, RM_NAME_MAX_CHARS);\r
             transaction->state = RM_SERVICE_PROCESSING;\r
             memcpy ((void *)&(transaction->resourceInfo), (void *)&(nsRequestPkt->resourceInfo),\r
                     sizeof(Rm_ResourceInfo));\r
@@ -447,39 +447,6 @@ int32_t Rm_receivePktIsr(Rm_TransportHandle transportHandle, Rm_Packet *pkt)
             }\r
             break;\r
         }\r
-        case Rm_pktType_POLICY_REQUEST:\r
-        {\r
-            Rm_PolicyRequestPkt *policyRequestPkt = (Rm_PolicyRequestPkt *)pkt->data;\r
-\r
-            /* TODO: FILL IN POLICY API INFORMATION */\r
-            break;  \r
-        }\r
-        case Rm_pktType_POLICY_CHANGE:\r
-        {\r
-            Rm_PolicyChangePkt *policyChangePkt = (Rm_PolicyChangePkt *)pkt->data;\r
-\r
-            /* TODO: FILL IN POLICY API INFORMATION */\r
-            break;\r
-        }\r
-        case Rm_pktType_RESOURCE_POOL_MODIFICATION_REQUEST:\r
-        {\r
-            Rm_ResourcePoolModRequestPkt *resPoolModReqPkt = (Rm_ResourcePoolModRequestPkt *)pkt->data;\r
-\r
-            /* TODO: FILL IN RESOURCE POOL MODIFICATION API */\r
-            /* Rm_resourcePoolModRequestHandler(...); Server only - needs to allocate resources to\r
-             * the Client Delegate based on the policy and return those resources to the Client Delegate */\r
-            break;\r
-        }\r
-        case Rm_pktType_RESOURCE_POOL_MODIFICATION_RESPONSE:\r
-        {\r
-            Rm_ResourcePoolModResponsePkt *resPoolModRespPkt = (Rm_ResourcePoolModResponsePkt *)pkt->data;\r
-\r
-            /* TODO: FILL IN RESOURCE POOL MODIFICAITON API */\r
-            /* Rm_resourcePoolModResponseHandler(...);  Handler needs to populate allocator with\r
-             * new resources provided in the response and then handle any request transactions waiting on\r
-             * the resource pool modification */\r
-            break;\r
-        }\r
         default:\r
             rmInst->transport.rmFreePkt(transportHandle, pkt);\r
             return (RM_TRANSPORT_ERROR_INVALID_PACKET_TYPE);\r
index cab252ed029973219926fee63dbe6de1063ad2ef..cb9519c640cac67e98be7fffa943bda57d1e5c69 100644 (file)
  *  \par
 */
 
-/* RM Types */
-#include <ti/drv/rm/rm_types.h>
+/* Standard includes */
+#include <string.h>
+
+/* RM external API includes */
+#include <ti/drv/rm/rm.h>
 
 /* RM internal API includes */
 #include <ti/drv/rm/include/rm_treeloc.h>
@@ -58,8 +61,8 @@ Rm_NameServerNode *nameServerNodeNew(Rm_NameServerNodeCfg *nodeCfg)
 
     newNode = Rm_osalMalloc(sizeof(Rm_NameServerNode));
     if (newNode) {
-        strncpy(newNode->objName, nodeCfg->objName, RM_RESOURCE_NAME_MAX_CHARS);
-        strncpy(newNode->resourceName, nodeCfg->resourceName, RM_RESOURCE_NAME_MAX_CHARS); 
+        strncpy(newNode->objName, nodeCfg->objName, RM_NAME_MAX_CHARS);
+        strncpy(newNode->resourceName, nodeCfg->resourceName, RM_NAME_MAX_CHARS); 
         newNode->resourceBase = nodeCfg->resourceBase;
         newNode->resourceLength = nodeCfg->resourceLength;
     }
@@ -95,7 +98,7 @@ Rm_PolicyValidInstNode *policyValidInstNodeNew(char *instName)
 
     newNode = Rm_osalMalloc(sizeof(Rm_PolicyValidInstNode));
     
-    strncpy(newNode->name, instName, RM_INSTANCE_NAME_MAX_CHARS);
+    strncpy(newNode->name, instName, RM_NAME_MAX_CHARS);
     newNode->allocRefCount = 0;
     newNode->deletePending = FALSE;
     
@@ -165,5 +168,5 @@ int resourceNodeCompare(Rm_ResourceNode *node1, Rm_ResourceNode *node2)
 }
 
 /* Generate the red-black tree manipulation functions */
-RB_GENERATE(_Rm_AllocatorResourceTree, _Rm_ResourceNode, linkage, resourceNodeCompare);
+RB_GENERATE(_Rm_AllocatorResourceTree, _Rm_ResourceNode, linkage, resourceNodeCompare)
 
index 7a4b78e06dadc295d5baa39defd8b1d35ceed048..a780898aa17506f8ac2c7a7eb83ca0081ce17329 100644 (file)
@@ -6,7 +6,7 @@
  * DESCRIPTION: 
  *  This file contains the module specification for RM test files.
  *
- * Copyright (C) 2012, Texas Instruments, Inc.
+ * Copyright (C) 2012-2013, Texas Instruments, Inc.
  *****************************************************************************/
 
 /* Load the library utility. */
index e8c1856fd349a3cfe705ccd3f4636b292a74d332..258eb47c029408a2bc36570d6496cba518bf3bef 100644 (file)
@@ -6,7 +6,7 @@
  *
  *  \par
  *  ============================================================================
- *  @n   (C) Copyright 2012, Texas Instruments, Inc.
+ *  @n   (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
index 1f765151f0bfc6c4f5b74a2e0c95ad844841ae6f..a255a001ad69b983323d5d1bf33f6368b187f6f3 100644 (file)
@@ -8,7 +8,7 @@
  *
  *  \par
  *  NOTE:
- *      (C) Copyright 2009 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 
index 746dd8d72e1ff3cb751b09980fbae09a82bbb4d4..a72f39722f22f5b4fb7f42975f6ce30170fe7cbc 100644 (file)
@@ -81,9 +81,9 @@ HeapBufMP_Handle rmPktHeapHandle = NULL;
 #define MSGQ_HEAP_ID      0
 
 /* ======== RM Instance Names ======== */
-Char rmServerName[RM_INSTANCE_NAME_MAX_CHARS] = "RM_Server";
-Char rmClientDelegateName[RM_INSTANCE_NAME_MAX_CHARS] = "RM_Client_Delegate";
-Char rmClientName[RM_INSTANCE_NAME_MAX_CHARS] = "RM_Client";
+Char rmServerName[RM_NAME_MAX_CHARS] = "RM_Server";
+Char rmClientDelegateName[RM_NAME_MAX_CHARS] = "RM_Client_Delegate";
+Char rmClientName[RM_NAME_MAX_CHARS] = "RM_Client";
 
 /* ======== RM IPC MessageQ Names ======== */
 Char serverCdQueueName[30] = "RM_Server_CD_Queue";
@@ -97,9 +97,9 @@ Rm_Handle rmClientDelegateHandle = NULL;
 Rm_Handle rmClientHandle = NULL;
 
 /* ======== RM Instance Service Ports ======== */
-Rm_ServicePort *rmServerServicePort = NULL;
-Rm_ServicePort *rmClientDelegateServicePort = NULL;
-Rm_ServicePort *rmClientServicePort = NULL;
+Rm_ServiceHandle *rmServerServiceHandle = NULL;
+Rm_ServiceHandle *rmClientDelegateServiceHandle = NULL;
+Rm_ServiceHandle *rmClientServiceHandle = NULL;
 
 /* ======== RM Transport Packet Definition ======== */
 typedef struct {
@@ -481,7 +481,8 @@ void testReceiveTsk(UArg arg0, UArg arg1)
 void testRmTsk(UArg arg0, UArg arg1)
 {
     Rm_ServiceReqInfo requestInfo;
-    Task_Params taskParams;    
+    Task_Params taskParams;
+    int32_t result;
        
     /* Delete the RM startup task */
     System_printf("Core %d: Deleting RM startup task...\n", MultiProc_self());
@@ -496,12 +497,12 @@ void testRmTsk(UArg arg0, UArg arg1)
      * RM instances */
     if (MultiProc_self() == 0)
     {
-        rmServerServicePort = Rm_serviceGetPort(rmServerHandle);
+        rmServerServiceHandle = Rm_serviceOpenHandle(rmServerHandle, &result);
     }
     else if (MultiProc_self() == 1)
     {
-        rmClientDelegateServicePort = Rm_serviceGetPort(rmClientDelegateHandle);
-        rmClientServicePort = Rm_serviceGetPort(rmClientHandle);
+        rmClientDelegateServiceHandle = Rm_serviceOpenHandle(rmClientDelegateHandle, &result);
+        rmClientServiceHandle = Rm_serviceOpenHandle(rmClientHandle, &result);
     }
 
     memset((void *)&requestInfo, 0, sizeof(Rm_ServiceReqInfo));
@@ -512,13 +513,11 @@ void testRmTsk(UArg arg0, UArg arg1)
     /* Use the service ports to test the service requests */
     if (MultiProc_self() == 0)
     {
-        char resourceName[RM_RESOURCE_NAME_MAX_CHARS] = "gp-queue";
-        char resourceNsName[RM_RESOURCE_NAME_MAX_CHARS] = "My_Favorite_Queue";
-
-        char aifName[RM_RESOURCE_NAME_MAX_CHARS] = "aif-rx-ch";
-        char memRegionName[RM_RESOURCE_NAME_MAX_CHARS] = "memory-regions";
-
+        char resourceName[RM_NAME_MAX_CHARS] = "gp-queue";
+        char resourceNsName[RM_NAME_MAX_CHARS] = "My_Favorite_Queue";
 
+        char aifName[RM_NAME_MAX_CHARS] = "aif-rx-ch";
+        char memRegionName[RM_NAME_MAX_CHARS] = "memory-regions";
 
         /* Issue the service request create a new NameServer object via the service port */                
         requestInfo.type = Rm_service_RESOURCE_ALLOCATE_USE;
@@ -529,7 +528,7 @@ void testRmTsk(UArg arg0, UArg arg1)
         requestInfo.callback.serviceCallback = testServiceCallback;
         
         System_printf("Core %d: %s Allocating resource...\n", MultiProc_self(), rmServerName);
-        rmServerServicePort->Rm_serviceHandler(rmServerServicePort->rmHandle, &requestInfo, &responseInfo);
+        rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
         if (blockForResponse(&responseInfo))
         {
             System_printf("Core %d: %s allocated resource: %s base: %d length: %d\n", MultiProc_self(),
@@ -548,7 +547,7 @@ void testRmTsk(UArg arg0, UArg arg1)
         requestInfo.callback.serviceCallback = testServiceCallback;
         
         System_printf("Core %d: %s Allocating resource...\n", MultiProc_self(), rmServerName);
-        rmServerServicePort->Rm_serviceHandler(rmServerServicePort->rmHandle, &requestInfo, &responseInfo);
+        rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
         if (blockForResponse(&responseInfo))
         {
             System_printf("Core %d: %s allocated resource: %s base: %d length: %d\n", MultiProc_self(),
@@ -567,7 +566,7 @@ void testRmTsk(UArg arg0, UArg arg1)
         requestInfo.callback.serviceCallback = testServiceCallback;
         
         System_printf("Core %d: %s Allocating resource...\n", MultiProc_self(), rmServerName);
-        rmServerServicePort->Rm_serviceHandler(rmServerServicePort->rmHandle, &requestInfo, &responseInfo);
+        rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
         if (blockForResponse(&responseInfo))
         {
             System_printf("Core %d: %s allocated resource: %s base: %d length: %d\n", MultiProc_self(),
@@ -589,7 +588,7 @@ void testRmTsk(UArg arg0, UArg arg1)
         requestInfo.callback.serviceCallback = testServiceCallback;
         
         System_printf("Core %d: %s creating NameServer object...\n", MultiProc_self(), rmServerName);
-        rmServerServicePort->Rm_serviceHandler(rmServerServicePort->rmHandle, &requestInfo, &responseInfo);
+        rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
         if (blockForResponse(&responseInfo))
         {
             System_printf("Core %d: %s created NameServer object: %s base: %d length: %d\n", MultiProc_self(),
@@ -618,7 +617,7 @@ void testRmTsk(UArg arg0, UArg arg1)
         requestInfo.callback.serviceCallback = testServiceCallback;
         
         System_printf("Core %d: %s Trying to reserve memory region taken by Linux...\n", MultiProc_self(), rmServerName);
-        rmServerServicePort->Rm_serviceHandler(rmServerServicePort->rmHandle, &requestInfo, &responseInfo);
+        rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
         if (blockForResponse(&responseInfo))
         {
             System_printf("Core %d: %s allocated resource (SHOULD NOT HAPPEN): %s base: %d length: %d\n", MultiProc_self(),
@@ -637,7 +636,7 @@ void testRmTsk(UArg arg0, UArg arg1)
         requestInfo.callback.serviceCallback = testServiceCallback;
         
         System_printf("Core %d: %s Allocating resource...\n", MultiProc_self(), rmServerName);
-        rmServerServicePort->Rm_serviceHandler(rmServerServicePort->rmHandle, &requestInfo, &responseInfo);
+        rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
         if (blockForResponse(&responseInfo))
         {
             System_printf("Core %d: %s allocated resource: %s base: %d length: %d\n", MultiProc_self(),
@@ -654,7 +653,7 @@ void testRmTsk(UArg arg0, UArg arg1)
         requestInfo.callback.serviceCallback = testServiceCallback;
         
         System_printf("Core %d: %s Allocating resource...\n", MultiProc_self(), rmServerName);
-        rmServerServicePort->Rm_serviceHandler(rmServerServicePort->rmHandle, &requestInfo, &responseInfo);
+        rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
         if (blockForResponse(&responseInfo))
         {
             System_printf("Core %d: %s allocated resource: %s base: %d length: %d\n", MultiProc_self(),
@@ -678,7 +677,7 @@ void testRmTsk(UArg arg0, UArg arg1)
         requestInfo.callback.serviceCallback = testServiceCallback;
         
         System_printf("Core %d: %s freeing resource...\n", MultiProc_self(), rmServerName);
-        rmServerServicePort->Rm_serviceHandler(rmServerServicePort->rmHandle, &requestInfo, &responseInfo);
+        rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
         if (blockForResponse(&responseInfo))
         {
             System_printf("Core %d: %s freed resource: %s base: %d length: %d\n", MultiProc_self(),
@@ -698,7 +697,7 @@ void testRmTsk(UArg arg0, UArg arg1)
         requestInfo.callback.serviceCallback = testServiceCallback;
         
         System_printf("Core %d: %s freeing resource...\n", MultiProc_self(), rmServerName);
-        rmServerServicePort->Rm_serviceHandler(rmServerServicePort->rmHandle, &requestInfo, &responseInfo);
+        rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
         if (blockForResponse(&responseInfo))
         {
             System_printf("Core %d: %s freed resource: %s base: %d length: %d\n", MultiProc_self(),
@@ -718,7 +717,7 @@ void testRmTsk(UArg arg0, UArg arg1)
         requestInfo.callback.serviceCallback = testServiceCallback;
         
         System_printf("Core %d: %s freeing resource...\n", MultiProc_self(), rmServerName);
-        rmServerServicePort->Rm_serviceHandler(rmServerServicePort->rmHandle, &requestInfo, &responseInfo);
+        rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
         if (blockForResponse(&responseInfo))
         {
             System_printf("Core %d: %s freed resource: %s base: %d length: %d\n", MultiProc_self(),
@@ -738,7 +737,7 @@ void testRmTsk(UArg arg0, UArg arg1)
         requestInfo.callback.serviceCallback = testServiceCallback;
         
         System_printf("Core %d: %s freeing resource...\n", MultiProc_self(), rmServerName);
-        rmServerServicePort->Rm_serviceHandler(rmServerServicePort->rmHandle, &requestInfo, &responseInfo);
+        rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
         if (blockForResponse(&responseInfo))
         {
             System_printf("Core %d: %s allocate resource: %s base: %d length: %d\n", MultiProc_self(),
@@ -755,7 +754,7 @@ void testRmTsk(UArg arg0, UArg arg1)
         requestInfo.callback.serviceCallback = testServiceCallback;
         
         System_printf("Core %d: %s freeing resource...\n", MultiProc_self(), rmServerName);
-        rmServerServicePort->Rm_serviceHandler(rmServerServicePort->rmHandle, &requestInfo, &responseInfo);
+        rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
         if (blockForResponse(&responseInfo))
         {
             System_printf("Core %d: %s allocate resource: %s base: %d length: %d\n", MultiProc_self(),
@@ -775,10 +774,10 @@ void testRmTsk(UArg arg0, UArg arg1)
     }
     else if (MultiProc_self() == 1)
     {    
-        char resourceNsName[RM_RESOURCE_NAME_MAX_CHARS] = "My_Favorite_Queue";
+        char resourceNsName[RM_NAME_MAX_CHARS] = "My_Favorite_Queue";
 
-        char aifName[RM_RESOURCE_NAME_MAX_CHARS] = "aif-rx-ch";    
-        char accumChName[RM_RESOURCE_NAME_MAX_CHARS] = "accumulator-ch";
+        char aifName[RM_NAME_MAX_CHARS] = "aif-rx-ch";    
+        char accumChName[RM_NAME_MAX_CHARS] = "accumulator-ch";
 
         /* Issue the service request for the resources tied to the name via the service port */                
         requestInfo.type = Rm_service_RESOURCE_GET_BY_NAME;
@@ -787,7 +786,7 @@ void testRmTsk(UArg arg0, UArg arg1)
         
         System_printf("Core %d: %s getting resources tied to NameServer object...\n", MultiProc_self(), 
                                                                                       rmClientDelegateName);
-        rmClientDelegateServicePort->Rm_serviceHandler(rmClientDelegateServicePort->rmHandle, &requestInfo, &responseInfo);
+        rmClientDelegateServiceHandle->Rm_serviceHandler(rmClientDelegateServiceHandle->rmHandle, &requestInfo, &responseInfo);
         if (blockForResponse(&responseInfo))
         {
             System_printf("Core %d: %s got Name: %s base: %d length: %d\n", MultiProc_self(),
@@ -806,7 +805,7 @@ void testRmTsk(UArg arg0, UArg arg1)
         requestInfo.callback.serviceCallback = testServiceCallback;
         
         System_printf("Core %d: %s allocating resources...\n", MultiProc_self(), rmClientName);
-        rmClientServicePort->Rm_serviceHandler(rmClientServicePort->rmHandle, &requestInfo, &responseInfo);
+        rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
         if (blockForResponse(&responseInfo))
         {
             System_printf("Core %d: %s allocated resources: %s base: %d length: %d\n", MultiProc_self(),
@@ -829,7 +828,7 @@ void testRmTsk(UArg arg0, UArg arg1)
         requestInfo.callback.serviceCallback = testServiceCallback;
         
         System_printf("Core %d: %s freeing resource via name...\n", MultiProc_self(), rmClientName);
-        rmClientServicePort->Rm_serviceHandler(rmClientServicePort->rmHandle, &requestInfo, &responseInfo);
+        rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
         if (blockForResponse(&responseInfo))
         {
             System_printf("Core %d: %s freed resource with name: %s\n", MultiProc_self(),
@@ -846,7 +845,7 @@ void testRmTsk(UArg arg0, UArg arg1)
         System_printf("Core %d: %s Deleting NameServer object: %s...\n", MultiProc_self(), 
                                                                          rmClientName,
                                                                          resourceNsName);
-        rmClientServicePort->Rm_serviceHandler(rmClientServicePort->rmHandle, &requestInfo, &responseInfo);
+        rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
         if (blockForResponse(&responseInfo))
         {
             System_printf("Core %d: %s deleted NameServer object: %s\n", MultiProc_self(),
@@ -869,7 +868,7 @@ void testRmTsk(UArg arg0, UArg arg1)
         requestInfo.callback.serviceCallback = testServiceCallback;
         
         System_printf("Core %d: %s Allocating resource...\n", MultiProc_self(), rmClientName);
-        rmClientServicePort->Rm_serviceHandler(rmClientServicePort->rmHandle, &requestInfo, &responseInfo);
+        rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
         if (blockForResponse(&responseInfo))
         {
             System_printf("Core %d: %s allocated resource: %s base: %d length: %d\n", MultiProc_self(),
@@ -887,7 +886,7 @@ void testRmTsk(UArg arg0, UArg arg1)
         requestInfo.callback.serviceCallback = testServiceCallback;
         
         System_printf("Core %d: %s Allocating resource...\n", MultiProc_self(), rmClientDelegateName);
-        rmClientDelegateServicePort->Rm_serviceHandler(rmClientDelegateServicePort->rmHandle, &requestInfo, &responseInfo);
+        rmClientDelegateServiceHandle->Rm_serviceHandler(rmClientDelegateServiceHandle->rmHandle, &requestInfo, &responseInfo);
         if (blockForResponse(&responseInfo))
         {
             System_printf("Core %d: %s allocated resource: %s base: %d length: %d\n", MultiProc_self(),
@@ -912,7 +911,7 @@ void testRmTsk(UArg arg0, UArg arg1)
         requestInfo.callback.serviceCallback = testServiceCallback;
         
         System_printf("Core %d: %s Allocating resource...\n", MultiProc_self(), rmClientDelegateName);
-        rmClientDelegateServicePort->Rm_serviceHandler(rmClientDelegateServicePort->rmHandle, &requestInfo, &responseInfo);
+        rmClientDelegateServiceHandle->Rm_serviceHandler(rmClientDelegateServiceHandle->rmHandle, &requestInfo, &responseInfo);
         if (blockForResponse(&responseInfo))
         {
             System_printf("Core %d: %s allocated resource: %s base: %d length: %d\n", MultiProc_self(),
@@ -931,7 +930,7 @@ void testRmTsk(UArg arg0, UArg arg1)
         requestInfo.callback.serviceCallback = testServiceCallback;
         
         System_printf("Core %d: %s Allocating resource...\n", MultiProc_self(), rmClientName);
-        rmClientServicePort->Rm_serviceHandler(rmClientServicePort->rmHandle, &requestInfo, &responseInfo);
+        rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
         if (blockForResponse(&responseInfo))
         {
             System_printf("Core %d: %s allocated resource: %s base: %d length: %d\n", MultiProc_self(),
@@ -950,7 +949,7 @@ void testRmTsk(UArg arg0, UArg arg1)
         requestInfo.callback.serviceCallback = testServiceCallback;
         
         System_printf("Core %d: %s Allocating resource...\n", MultiProc_self(), rmClientName);
-        rmClientServicePort->Rm_serviceHandler(rmClientServicePort->rmHandle, &requestInfo, &responseInfo);
+        rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
         if (blockForResponse(&responseInfo))
         {
             System_printf("Core %d: %s allocated resource: %s base: %d length: %d\n", MultiProc_self(),
index 7dab9cc419091bd095808a390b2a8019fddc23a3..cc7c4a32e3937487fecfc0c0aaeaa7898e936119 100644 (file)
@@ -1,5 +1,5 @@
 /* 
- * Copyright (c) 2012, Texas Instruments Incorporated
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without