summaryrefslogtreecommitdiff
path: root/src/dataflow.h
blob: 700bbdc1e988ebf22fa3986b6d7436190a42b01d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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 {
    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;