summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Dooley <dooleyc@google.com>2020-03-27 14:32:35 -0700
committerCraig Dooley <dooleyc@google.com>2020-03-27 14:36:08 -0700
commit93e21478fe619593af9338246489568f9f8af6fc (patch)
tree7344d0094399d1a134a15c37a1cd9e2f1007a471
parent66251399097ac3a7d861fe3e676135ec1b595446 (diff)
downloadaoc-ipc-93e21478fe619593af9338246489568f9f8af6fc.tar.gz
Add a new service header flag for 'push' rings
Change-Id: Idd912ca5e45ce153d05be7d92e30fbea9a313ab8
-rw-r--r--aoc_ipc_core.c10
-rw-r--r--aoc_ipc_core.h9
-rw-r--r--aoc_ipc_core_internal.h3
3 files changed, 21 insertions, 1 deletions
diff --git a/aoc_ipc_core.c b/aoc_ipc_core.c
index 4de02dc..2d3165c 100644
--- a/aoc_ipc_core.c
+++ b/aoc_ipc_core.c
@@ -618,3 +618,13 @@ size_t aoc_service_ring_read_offset(aoc_service *service, aoc_direction dir)
return s->regions[dir].rx % s->regions[dir].size;
}
+
+bool aoc_ring_is_push(aoc_service *service) {
+ struct aoc_ipc_service_header *s =
+ (struct aoc_ipc_service_header *)service;
+
+ if (!service || !aoc_service_is_ring(service))
+ return false;
+
+ return (s->flags & AOC_SERVICE_FLAG_RING_PUSH) != 0;
+}
diff --git a/aoc_ipc_core.h b/aoc_ipc_core.h
index 9c80a7f..fffb910 100644
--- a/aoc_ipc_core.h
+++ b/aoc_ipc_core.h
@@ -191,6 +191,15 @@ size_t aoc_ring_bytes_written(aoc_service *service, aoc_direction dir);
*/
bool aoc_ring_did_overflow(aoc_service *service, aoc_direction dir);
+/**
+ * Tells if notifications should be sent after writing data into the ring
+ *
+ * \param[in] service pointer to a service
+ *
+ * \return true if the receiver expects a notification after writes
+ */
+bool aoc_ring_is_push(aoc_service *service);
+
#ifdef __cplusplus
}
#endif
diff --git a/aoc_ipc_core_internal.h b/aoc_ipc_core_internal.h
index 2f8732b..babf6e6 100644
--- a/aoc_ipc_core_internal.h
+++ b/aoc_ipc_core_internal.h
@@ -45,7 +45,8 @@ extern "C" {
#define AOC_VERSION_LENGTH 48
#define AOC_SERVICE_FLAG_SYSTEM_MASK 0xffff0000
-#define AOC_SERVICE_FLAG_RING 0x00010000
+#define AOC_SERVICE_FLAG_RING 0x00010000
+#define AOC_SERVICE_FLAG_RING_PUSH 0x00020000
#define AOC_MAGIC 0xA0C00A0C
struct aoc_control_block {