diff options
author | Yuji Mano <yuji.mano@am.sony.com> | 2009-02-05 18:31:00 -0800 |
---|---|---|
committer | Yuji Mano <yuji.mano@am.sony.com> | 2009-02-11 11:03:24 -0800 |
commit | 89b797929373d0cf832a257fe25832f082eb8ee6 (patch) | |
tree | 01d00556f139012d75b39d904d8f30d3c9ca5443 | |
parent | 8076f490cd85ec2c7a17d05018e8c180fb5d1122 (diff) | |
download | mars-src-89b797929373d0cf832a257fe25832f082eb8ee6.tar.gz |
base: EA cell add uint8 api
Add uint8 functions for mars_ea_get/put for API completeness.
Signed-off-by: Yuji Mano <yuji.mano@am.sony.com>
Acked-by: Kazunori Asayama <asayama@sm.sony.co.jp>
-rw-r--r-- | base/include/host/mars/base.h | 20 | ||||
-rw-r--r-- | base/src/host/lib/ea_cell.c | 12 |
2 files changed, 32 insertions, 0 deletions
diff --git a/base/include/host/mars/base.h b/base/include/host/mars/base.h index d0b1f87..648b985 100644 --- 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, size_t size); /** * \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 *ptr, size_t size); /** * \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 diff --git a/base/src/host/lib/ea_cell.c b/base/src/host/lib/ea_cell.c index 11c8c6f..e61aca2 100644 --- 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, size_t size) 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 *mem, size_t size) 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) { |