]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/rm-lld.git/blobdiff - rm_services.h
Added pre-main capabilities, cleaned up services and NameServer modules
[keystone-rtos/rm-lld.git] / rm_services.h
index 15904bc60d13ba09832321fddb7bd031ebfd86c1..a4c4ce91077ab0cc9c6b9c3c4b3636dd10955bf3 100644 (file)
@@ -66,11 +66,68 @@ extern "C" {
 #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 (RM_SERVICE_STATE_BASE+2)
+#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_STATE_BASE+3)
+#define RM_SERVICE_DENIED_END (RM_SERVICE_DENIED_BEGIN+23)
 
 /** RM Service Request Error Code Base */
 #define RM_SERVICE_ERROR_BASE (-64)
@@ -100,7 +157,7 @@ extern "C" {
 #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_EXST_FOR_THIS_RM_INSTANCE (RM_SERVICE_ERROR_BASE-8)
+#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 */
@@ -109,55 +166,36 @@ extern "C" {
 #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 (24)
+#define RM_RESOURCE_NAME_MAX_CHARS (36)
 
 /** 
  * @brief RM service types
  */
 typedef enum {
-    /** First service type.  Used by RM for bounds checking.  Should
-     *  not be used by component. */
-    Rm_service_FIRST = 0,
-    /** RM resource allocate service */
-    Rm_service_RESOURCE_ALLOCATE = 0,
-    /** RM resource block allocate service */
-    Rm_service_RESOURCE_BLOCK_ALLOCATE = 1,
-    /** RM resource allocate by name service */
-    Rm_service_RESOURCE_ALLOCATE_BY_NAME = 2,    
+    /** RM resource allocate for initialization service */
+    Rm_service_RESOURCE_ALLOCATE_INIT = 0,
+    /** RM resource allocate for use service */
+    Rm_service_RESOURCE_ALLOCATE_USE,
     /** RM resource free service */
-    Rm_service_RESOURCE_FREE = 3,
-    /** RM resource block free service */
-    Rm_service_RESOURCE_BLOCK_FREE = 4,
-    /** RM resource free by name service */
-    Rm_service_RESOURCE_FREE_BY_NAME = 5,
+    Rm_service_RESOURCE_FREE,
     /** RM resource mapping to name service */
-    Rm_service_RESOURCE_MAP_TO_NAME = 6,
+    Rm_service_RESOURCE_MAP_TO_NAME,
+    /** RM resource get by name service */
+    Rm_service_RESOURCE_GET_BY_NAME,
     /** RM resource name unmapping service */
-    Rm_service_RESOURCE_UNMAP_NAME = 7,
-    /** Last service type.  Used by RM for bounds checking.  Should
-     *  not be used by component. */
-    Rm_service_LAST = 7
+    Rm_service_RESOURCE_UNMAP_NAME
 } Rm_ServiceType;
 
-/** 
- * @brief RM pre-main allocation request information provided by the pre-main 
- *        startup function requesting the resource */
-typedef struct {
-    /** Pointer to the requested pre-main allocation resource name.  The 
-     *  name provided by the component must match the resource names
-     *  provided in the global resource table and allocation policies */
-    char *resourceName;
-    /** The pre-main allocation request resource base value.  For example, 
-     *  queue number or semaphore number */
-    uint32_t resourceBase;
-    /** Range of resource starting at resourceBase */
-    uint32_t resourceRange;
-} Rm_PreMainAllocInfo;
-
 /** 
  * @brief RM service response information provided by RM back to the 
  *        requesting component
@@ -172,11 +210,13 @@ typedef struct {
      *  service responses received via the component callback function.  A service ID will not
      *  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];
     /** 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;
-    /** The range of resources starting from resourceBase allocated in block requests */
-    uint32_t resourceRange;
+    /** The number of resources starting from resourceBase allocated in block requests */
+    uint32_t resourceLength;
 } Rm_ServiceRespInfo;
 
 /** 
@@ -205,10 +245,10 @@ typedef struct {
 #define RM_RESOURCE_BASE_UNSPECIFIED (-1)  
     /** The resource base value. */
     int32_t resourceBase;
-    /** The range of the specified resource to be allocated starting from 
+    /** The number of the specified resource to be allocated starting from 
      *  resourceBase.  Will be greater than one only for block allocate
      *  and free service requests. */
-    uint32_t resourceRange;
+    uint32_t resourceLength;
 /** An allocate service can be requested with an unspecified resource alignment.
  *  WARNING: Only applicapable if resourceBase is unspecified
  *
@@ -254,6 +294,14 @@ typedef struct {
                       Rm_ServiceRespInfo *serviceResponse);
 } Rm_ServicePort;
 
+/** 
+ * @brief RM pre-main allocation request information provided by the pre-main 
+ *        startup function requesting the resource */
+typedef struct {
+    Rm_PreMainHandle   rmPreMainHandle;
+    Rm_ServiceReqInfo *request;
+} Rm_PreMainReqCfg;
+
 /**
  *  @b Description
  *  @n  
@@ -267,11 +315,11 @@ typedef struct {
  *            running a RM Server or Client Delegate that has a startup policy
  *            allowing the allocation of pre-main resources
  *
- *  @param[in]  preMainAllocInfo
+ *  @param[in]  preMainRequest
  *      Resource pre-main allocation structure that provides details of the 
  *      resource requested from RM for preallocation
  *
- *  @param[out] serviceResponse
+ *  @param[out] preMainResponse
  *      Contains the result information regarding the pre-main allocation request
  *
  *  @retval
@@ -279,8 +327,7 @@ typedef struct {
  *  @retval
  *      Failure - non-zero - Resource pre-main allocation request error.
  */
-void Rm_preMainAllocService (Rm_PreMainAllocInfo *preMainAllocInfo,
-                             Rm_ServiceRespInfo *serviceResponse);
+void Rm_servicePreMainRequest(Rm_PreMainReqCfg *reqCfg, Rm_ServiceRespInfo *preMainResp);
 
 /**
  *  @b Description
@@ -299,7 +346,7 @@ void Rm_preMainAllocService (Rm_PreMainAllocInfo *preMainAllocInfo,
  *  @retval
  *      Failure - NULL
  */
-Rm_ServicePort *Rm_getServicePort(Rm_Handle rmHandle);
+Rm_ServicePort *Rm_serviceGetPort(Rm_Handle rmHandle);
 
 /** 
 @}