summaryrefslogtreecommitdiff
path: root/lwis_transaction.h
diff options
context:
space:
mode:
authorEdmond Chung <edmondchung@google.com>2019-07-22 14:59:36 -0700
committerEdmond Chung <edmondchung@google.com>2019-10-01 21:29:06 -0700
commitd87c487934d37f6b043b070e1789faf48416140d (patch)
treef0cfe827e204d01b9115d43eaab43b0ed4a113b0 /lwis_transaction.h
parent8930af537baf9ec9d89df17b651e686a1ea14ab9 (diff)
downloadlwis-d87c487934d37f6b043b070e1789faf48416140d.tar.gz
Transaction: Implement async i/o read/writes
Bug: 117126830 Change-Id: I37ed14fbbc6f119d37cb382f9b2c1f8f1281d4d5 Signed-off-by: Edmond Chung <edmondchung@google.com>
Diffstat (limited to 'lwis_transaction.h')
-rw-r--r--lwis_transaction.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/lwis_transaction.h b/lwis_transaction.h
new file mode 100644
index 0000000..3cf85ab
--- /dev/null
+++ b/lwis_transaction.h
@@ -0,0 +1,45 @@
+/*
+ * Google LWIS Transaction Processor
+ *
+ * Copyright (c) 2019 Google, LLC
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef LWIS_TRANSACTION_H_
+#define LWIS_TRANSACTION_H_
+
+#include "lwis_commands.h"
+#include "lwis_device.h"
+
+/* Transaction entry. Each entry belongs to two queues:
+ * 1) Event list: Transactions are sorted by event IDs. This is to search for
+ * the appropriate transactions to trigger.
+ * 2) Process queue: When it's time to process, the transaction will be put
+ * into a queue.
+ */
+struct lwis_transaction {
+ struct lwis_transaction_info info;
+ struct lwis_transaction_response_header *resp;
+ struct list_head event_list_node;
+ struct list_head process_queue_node;
+};
+
+struct lwis_transaction_event_list {
+ uint64_t event_id;
+ struct list_head list;
+ struct hlist_node node;
+};
+
+int lwis_transaction_init(struct lwis_client *client);
+int lwis_transaction_cleanup(struct lwis_client *client);
+
+int lwis_transaction_submit(struct lwis_client *client,
+ struct lwis_transaction *transaction);
+int lwis_transaction_event_trigger(struct lwis_client *client,
+ int64_t event_id, uint64_t event_counter,
+ struct list_head *pending_events);
+
+#endif /* LWIS_TRANSACTION_H_ */ \ No newline at end of file