[Cbe-oss-dev] [PATCH 07/28]MARS/base: ea cell add uint8 api

Yuji Mano yuji.mano at am.sony.com
Fri Feb 6 13:31:00 EST 2009


Add uint8 functions for mars_ea_get/put for API completeness.

Signed-off-by: Yuji Mano <yuji.mano at am.sony.com>
---
 base/include/host/mars/base.h |   20 ++++++++++++++++++++
 base/src/host/lib/ea_cell.c   |   12 ++++++++++++
 2 files changed, 32 insertions(+)

--- a/base/include/host/mars/base.h
+++ b/base/include/host/mars/base.h
@@ -133,6 +133,17 @@ void mars_ea_get(uint64_t ea, void *ptr,
 
 /**
  * \ingroup group_mars_base
+ * \brief <b>[host]</b> Get 8-bit integer value from shared memory
+ *
+ * \param[in] ea		- 64-bit address of source
+ *
+ * \return
+ *	uint8_t			- 8-bit result, no guarantee that it is loaded atomically
+ */
+uint8_t mars_ea_get_uint8(uint64_t ea);
+
+/**
+ * \ingroup group_mars_base
  * \brief <b>[host]</b> Get 16-bit integer value from shared memory
  *
  * \param[in] ea		- 64-bit address of source
@@ -177,6 +188,15 @@ void mars_ea_put(uint64_t ea, const void
 
 /**
  * \ingroup group_mars_base
+ * \brief <b>[host]</b> Put 8-bit integer value to shared memory atomically
+ *
+ * \param[in] ea		- 64-bit address of destination
+ * \param[in] value		- 8-bit value to be stored in shared memory, no guarantee that it is stored atomically
+ */
+void mars_ea_put_uint8(uint64_t ea, uint8_t value);
+
+/**
+ * \ingroup group_mars_base
  * \brief <b>[host]</b> Put 16-bit integer value to shared memory atomically
  *
  * \param[in] ea		- 64-bit address of destination
--- a/base/src/host/lib/ea_cell.c
+++ b/base/src/host/lib/ea_cell.c
@@ -131,6 +131,12 @@ void mars_ea_get(uint64_t ea, void *mem,
 		memcpy(mem, src, size);
 }
 
+/* get uint8 value from EA */
+uint8_t mars_ea_get_uint8(uint64_t ea)
+{
+	return *(uint8_t *)mars_ea_to_ptr(ea);
+}
+
 /* get uint16 value from EA */
 uint16_t mars_ea_get_uint16(uint64_t ea)
 {
@@ -157,6 +163,12 @@ void mars_ea_put(uint64_t ea, const void
 		memcpy(dst, mem, size);
 }
 
+/* put uint8 value to EA */
+void mars_ea_put_uint8(uint64_t ea, uint8_t value)
+{
+	*(uint8_t *)mars_ea_to_ptr(ea) = value;
+}
+
 /* put uint16 value to EA */
 void mars_ea_put_uint16(uint64_t ea, uint16_t value)
 {







More information about the cbe-oss-dev mailing list