[Cbe-oss-dev] [patch 1/1 v2] MARS/base: add api to get num mpus

Yuji Mano yuji.mano at am.sony.com
Wed May 27 04:08:49 EST 2009


This adds a new API to the base library to return the number of MPUs
allocated for the specified MARS context.

Signed-off-by: Yuji Mano <yuji.mano at am.sony.com>
---
v2:
 - return uint32_t instead of int

 base/include/host/mars/context.h |   13 +++++++++++++
 base/src/host/lib/context.c      |    9 +++++++++
 2 files changed, 22 insertions(+)

--- a/base/include/host/mars/context.h
+++ b/base/include/host/mars/context.h
@@ -117,6 +117,19 @@ int mars_context_create(struct mars_cont
  */
 int mars_context_destroy(struct mars_context *mars);
 
+/**
+ * \ingroup group_mars_context
+ * \brief <b>[host]</b> Returns number of MPUs allocated for MARS context.
+ *
+ * This function returns the number of MPUs allocated for the MARS context.
+ *
+ * \param[in] mars		- pointer to MARS context
+ * \return
+ *	non-zero		- number of MPUs
+ *	0			- invalid MARS context
+ */
+uint32_t mars_context_get_num_mpus(struct mars_context *mars);
+
 #if defined(__cplusplus)
 }
 #endif
--- a/base/src/host/lib/context.c
+++ b/base/src/host/lib/context.c
@@ -380,3 +380,12 @@ error:
 
 	return ret;
 }
+
+uint32_t mars_context_get_num_mpus(struct mars_context *mars)
+{
+	/* check function params */
+	if (!mars)
+		return 0;
+
+	return mars->mpu_context_count;
+}




More information about the cbe-oss-dev mailing list