path: root/utils/hwstub/stub/target.h
diff options
authorMarcin Bukat <>2014-11-18 23:27:26 +0100
committerMarcin Bukat <>2014-11-18 23:30:44 +0100
commitcd04a5f1aadc8e2ec4e787f5ba4cc8c38a579314 (patch)
tree63e9f095451aeba0139152c8742d0af67413690a /utils/hwstub/stub/target.h
parent794169a18f644eea32de20b26646381137545e2d (diff)
hwstub/qeditor: add support for atomic read/writes
The current code assumed that READ/WRITE would produce atomic read/writes for 8/16/32-bit words, which in turned put assumption on the memcpy function. Since some memcpy implementation do not always guarantee such strong assumption, introduce two new operation READ/WRITE_ATOMIC which provide the necessary tools to do correct read and write to register in a single memory access. Change-Id: I37451bd5057bb0dcaf5a800d8aef8791c792a090
Diffstat (limited to 'utils/hwstub/stub/target.h')
1 files changed, 8 insertions, 0 deletions
diff --git a/utils/hwstub/stub/target.h b/utils/hwstub/stub/target.h
index cb17401a9c..5cd049d04f 100644
--- a/utils/hwstub/stub/target.h
+++ b/utils/hwstub/stub/target.h
@@ -33,6 +33,14 @@ void target_get_config_desc(void *buffer, int *size);
void target_udelay(int us);
/* Wait for a short time (ms <= 1000) */
void target_mdelay(int ms);
+/* Read a n-bit word atomically */
+uint8_t target_read8(const void *addr);
+uint16_t target_read16(const void *addr);
+uint32_t target_read32(const void *addr);
+/* Write a n-bit word atomically */
+void target_write8(void *addr, uint8_t val);
+void target_write16(void *addr, uint16_t val);
+void target_write32(void *addr, uint32_t val);
/* mandatory for all targets */
extern struct hwstub_target_desc_t target_descriptor;