]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/rm-lld.git/blobdiff - rm_services.h
Fixes for multi-threaded client test
[keystone-rtos/rm-lld.git] / rm_services.h
index 1437be30e38fe3ff5de30dfab3c84a858862c5e2..ec9c21e79c30b13f8858540658623bd4b1086035 100644 (file)
@@ -65,6 +65,9 @@ typedef enum {
     Rm_service_RESOURCE_ALLOCATE_USE,
     /** RM resource free service */
     Rm_service_RESOURCE_FREE,
+    /** RM resource status service - returns the reference count for specified
+     *  resource. */
+    Rm_service_RESOURCE_STATUS,
     /** RM NameServer map resource to name service */
     Rm_service_RESOURCE_MAP_TO_NAME,
     /** RM NameServer get resource by name service */
@@ -80,22 +83,39 @@ typedef enum {
  *        request results back to the application components
  */
 typedef struct {
-    /** Service request state.  The state can be an approval, denial, or error.
-     *  The latter codes start at #RM_OK, #RM_SERVICE_DENIED_BASE, and 
-     *  #RM_ERROR_BASE, respectively. */
-    int32_t serviceState;
+    /** RM instance handle from which the service request that spawned this 
+     *  result originated.  Used by application to sort responses, received
+     *  via callback function, from RM instances located on the same core. */
+    Rm_Handle rmHandle;
+    /** Service request state.  State values can be found in rm.h starting
+     *  with #RM_SERVICE_PROCESSING, #RM_SERVICE_DENIED_BASE, and 
+     *  #RM_ERROR_LIBFDT_START */
+    int32_t   serviceState;
     /** The service ID is returned to the application in order to match service
      *  responses received at a later time via the provided callback function
      *  because RM required a blocking operation in order to satisfy the
-     *  resource request. */
-    uint32_t serviceId;
+     *  resource request. <br> <br> The service ID will never have a value of
+     *  zero. */
+    uint32_t  serviceId;
     /** Affected resource name */
-    char resourceName[RM_NAME_MAX_CHARS];
+    char      resourceName[RM_NAME_MAX_CHARS];
     /** The resource base value allocated, freed, or mapped to NameServer name. */
-    int32_t resourceBase;
+    int32_t   resourceBase;
     /** The resource length starting at base allocated, freed, or mapped to
      *  NameServer name. */
-    uint32_t resourceLength;
+    uint32_t  resourceLength;
+/** resourceNumOwners is not valid unless >= 0 */
+#define RM_RESOURCE_NUM_OWNERS_INVALID (-1)      
+    /** Current number of owners for the returned resource.  A value greater
+     *  than one means the resource is being shared.  This value is only valid
+     *  if the serviceState is RM_SERVICE_APPROVED or RM_SERVICE_APPROVED_STATIC. */
+    int32_t   resourceNumOwners;
+/** instAllocCount is not valid unless >= 0 */
+#define RM_INST_ALLOC_COUNT_INVALID (-1) 
+    /** Number of times the requesting instance has allocated the returned resource.
+     *  This value is only valid if the serviceState is RM_SERVICE_APPROVED or
+     *  RM_SERVICE_APPROVED_STATIC */
+    int32_t   instAllocCount;
 } Rm_ServiceRespInfo;
 
 /** 
@@ -113,44 +133,48 @@ typedef struct {
  */
 typedef struct {
     /** The type of service requested */
-    Rm_ServiceType type;
+    Rm_ServiceType      type;
     /** Pointer to an array containing the resource name affected by
      *  the request.  The resource name must match a resource node name
      *  defined in the GRL and global/static policy.  The request will be
      *  denied if the resource name does not match any resource node names
      *  in the policy */
-    char *resourceName;
+    const char         *resourceName;
 /** Informs RM to find the next available resource block of length
  *  resourceLength and alignment resourceAlignment for allocation.  This
  *  parameter is only valid for resource allocate service types. */
 #define RM_RESOURCE_BASE_UNSPECIFIED (-1)  
     /** The base value of the resource affected by the service request.
      *  #RM_RESOURCE_BASE_UNSPECIFIED can be substituted. */
-    int32_t resourceBase;
+    int32_t             resourceBase;
     /** The resource length, starting from #resourceBase affected by the
      *  service request. */
-    uint32_t resourceLength;
+    uint32_t            resourceLength;
 /** Informs RM to find the next available resource block with length
  *  resourceLength and the alignment specified in 
  *  a) The resource node in the policy if it has the "allocation-alignment"
  *     property defined.
  *  b) The default alignment of 1 if no alignment is specified in the policy
  *     for the resource.
- *  This value is only valid if resourceBase is set to 
- *  #RM_RESOURCE_BASE_UNSPECIFIED */
+ *  This value is only valid if resourceBase is set to #RM_RESOURCE_BASE_UNSPECIFIED */
 #define RM_RESOURCE_ALIGNMENT_UNSPECIFIED (-1)      
     /** Alignment of the resource affected by the service request.  Only valid
      *  if resourceBase is set to #RM_RESOURCE_BASE_UNSPECIFIED.
      *  #RM_RESOURCE_ALIGNMENT_UNSPECIFIED can be substituted. */
-    int32_t resourceAlignment;
+    int32_t             resourceAlignment;
     /** The NameServer name associated, or to be associated, with a resource. 
-     *  If the service type is #Rm_service_RESOURCE_GET_BY_NAME and the
-     *  #resourceBase and #resourceLength fields are not NULL a error will
-     *  occur. */
-    char *resourceNsName;
+     *  The NameServer name has precedence over #resourceBase and #resourceLength
+     *  for all resource modification service types as well as
+     *  #Rm_service_RESOURCE_GET_BY_NAME.  If the NameServer name and the base
+     *  and length are not NULL the resource information retrieved from the
+     *  NameServer entry for the name will replace the values present in
+     *  #resourceBase and #resourceLength */
+    const char         *resourceNsName;
     /** Callback function used by RM to provide responses back to application
-     *  components after a service request resulted in a blocking operation. */
-    Rm_ServiceCallback callback;
+     *  components after a service request resulted in a blocking operation.
+     *  If no callback function is provided the RM instance will block until
+     *  the service response is ready. */
+    Rm_ServiceCallback  callback;
 } Rm_ServiceReqInfo;
 
 /** 
@@ -158,7 +182,7 @@ typedef struct {
  *        services
  */
 typedef struct {
-    /** RM instance handle for which the service handle was allocated from. */
+    /** RM instance handle from which the service handle was allocated from. */
     void *rmHandle;
     /**
      *  @b Description
@@ -181,7 +205,7 @@ typedef struct {
      *  @param[out]  serviceResponse
      *      Pointer to a service response structure.
      */
-    void (*Rm_serviceHandler)(void *rmHandle, Rm_ServiceReqInfo *serviceRequest,
+    void (*Rm_serviceHandler)(void *rmHandle, const Rm_ServiceReqInfo *serviceRequest,
                               Rm_ServiceRespInfo *serviceResponse);
 } Rm_ServiceHandle;
 
@@ -204,8 +228,6 @@ typedef struct {
  *      Success - Rm_ServiceHandle and result = #RM_OK
  *  @retval
  *      Failure - NULL Rm_ServiceHandle and result = #RM_ERROR_SERVICE_HANDLE_MEM_ALLOC_FAILED
- *  @retval
- *      Failure - NULL Rm_ServiceHandle and result = #RM_ERROR_SERVICE_HANDLE_ALREADY_OPENED
  */
 Rm_ServiceHandle *Rm_serviceOpenHandle(Rm_Handle rmHandle, int32_t *result);