summaryrefslogtreecommitdiff
path: root/src/dataflow.h
diff options
context:
space:
mode:
authorAditya Naik2020-04-27 16:13:09 -0400
committerAditya Naik2020-05-14 11:03:33 -0400
commitf5109a42e901608515b57e5256f56a841a0a05c1 (patch)
treeb7bea963c1b6993695c50021af6db17c266fd4f8 /src/dataflow.h
parent42a683033594289ddc520dffec652967e366e785 (diff)
This CL adds structures for bookkeeping for dataflow based on the dataflow protocol. It also adds a master and slave-side implementation of a single root-to-tree path in the protocol, which involves SOR=1 (master denoting a slave send operation) and DOC=5 (slave denoting data send operation). CL includes dataflow status typedef, SOR code typedef, DOC/SOR encoding, transmitting and decoding, CTS/data encoding, transmitting and decoding.
Commit by: Aditya Naik Reviewed by: None Task list: 2cabf06b6a354e83aed9a1c7ff22bd14 49ca5b3a768a48778259d3a449890ccb d34854d85c7947f5b63bc897136c6c28 88a636ba03c24d3bac77ccc9ab9822db
Diffstat (limited to 'src/dataflow.h')
-rw-r--r--src/dataflow.h44
1 files changed, 42 insertions, 2 deletions
diff --git a/src/dataflow.h b/src/dataflow.h
index 15d15cd..700bbdc 100644
--- a/src/dataflow.h
+++ b/src/dataflow.h
@@ -1,5 +1,45 @@
+/*
+ *
+ * Dataflow Status Enumeration
+ *
+ * This typedef governs the dataflow state machine. Enums should be self explanatory
+ *
+ * TODO Handle other DF pathways for slave RX datapoint and slave RX command
+ *
+ * |------------+-----+----------------------------------------+---------------------+-------------------------|
+ * | Status | Int | Status Invariant | Action | Next Status |
+ * |------------+-----+----------------------------------------+---------------------+-------------------------|
+ * | DF_IDLE | 0 | Ready to send m2s_SOR | Send m2s_SOR | DF_RX_DOC or ??? |
+ * | DF_RX_DOC | 1 | Sent m2s_SOR; ready to receive s2m_DOC | Receive s2m_DOC | DF_CTS |
+ * | DF_CTS | 2 | Received m2s_SOR; ready to send DF_CTS | Send m2s_CTS | DF_RX_DATA or DF_RX_CMD |
+ * | DF_RX_DATA | 3 | Sent m2s_CTS; receive s2m_data | Receive s2m_data | DF_SUCCESS |
+ * | DF_RX_CMD | 4 | sent m2s_CTS receive s2m_command | Receive s2m_command | DF_SUCCESS |
+ * |------------+-----+----------------------------------------+---------------------+-------------------------|
+ *
+ *
+*/
+
typedef enum dataflow_status {
- DATA_SUCCESS = 0,
- DATA_FAIL = 1
+ DF_IDLE = 0,
+ DF_RX_DOC = 1,
+ DF_CTS = 2,
+ DF_RX_DATA = 3,
+ DF_RX_CMD = 4,
+ DF_SUCCESS = 5,
+ DF_FAIL = 6
} dataflow_status_t;
+
+typedef enum SOR_codes {
+ SLAVE_TX = 1,
+ SLAVE_RX_DATAPOINT = 2,
+ SLAVE_RX_COMMAND = 3
+} SOR_codes_t;
+
+typedef enum DOC_codes {
+ CMD_UNICAST = 1,
+ CMD_MULTICAST = 2,
+ CMD_BROADCAST = 3,
+ RESERVED = 4,
+ DATA = 5
+} DOC_codes_t;