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

Yuji Mano yuji.mano at am.sony.com
Tue May 19 10:32:52 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>
---
 base/include/host/mars/context.h |   13 +++++++++++++
 base/src/host/lib/context.c      |   11 +++++++++++
 2 files changed, 24 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,14 @@ error:
 
 	return ret;
 }
+
+int mars_context_get_num_mpus(struct mars_context *mars)
+{
+	int ret;
+
+	/* check function params */
+	if (!mars)
+		return 0;
+
+	return mars->mpu_context_count;
+}




More information about the cbe-oss-dev mailing list