diff options
| author | Aditya Naik | 2020-08-07 14:59:45 -0400 |
|---|---|---|
| committer | Aditya Naik | 2020-08-07 14:59:45 -0400 |
| commit | 77d909de362508ee81868d424a4f15fbb24cb6c1 (patch) | |
| tree | 66ea0a91d719de76eccf9b9a49fed838d9eab79d | |
| parent | aef91bb9db4d09c8cc30400d69a6a11f5999d618 (diff) | |
A large comment with TODOs and a philosophical discourseabstraction
| -rw-r--r-- | src/master_posix.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/master_posix.c b/src/master_posix.c index c5ed3f5..74cb38a 100644 --- a/src/master_posix.c +++ b/src/master_posix.c @@ -137,6 +137,26 @@ static void *handshake_func(void * pvArgs) printf("Handshake thread started %s", LINE_BREAK); for (;;) { for (int dev_idx = 0; dev_idx < BUS_DEVICE_LIMIT-1; dev_idx++) { + /* With the new state machine structure, what is the correct condition + * for performing a handshake? + * + * Answer: Handshake attempts will occur based on user-configured processor devices. + * This ties in with the (new) grander philosophy at work here: a processor will have + * two types of configurations of devices, viz. ones that are present in the + * devicetree at boot time and others that will be hot-plugged during runtime. The + * user will configure certain peripherals (in a TBD manner) to enable + * hot-pluggability of peripherals on those devices. For example, a UART device could + * be configured hot-pluggable, which would result in handshake being attempted at the + * device every now and then. + + * This gets interesting when devices are configured as + * both hot-pluggable and with statically configured peripherals at the device. For + * example, an I2C device can have one or more peripherals configured on the bus in + * the devicetree, but can also be configured for hot-pluggability. It is obvious that + * not all devices can support dual configuration.. some mechanism will be needed to + * detect device configuration errors at compile time. + * + */ if (todo_hs_or_not_todo_hs(GET_ADDR_FROM_IDX(dev_idx))) { int hs_state = HS_STATE_0; void **args; @@ -148,6 +168,7 @@ static void *handshake_func(void * pvArgs) hs_state = hs_jumptable[hs_state](stream, args); if (hs_state == HS_STATE_SUCCESS) { + /* Attempt to decode the protobuf, and add devices */ s2m_MDR_response MDR_res_message = s2m_MDR_response_init_default; MDR_res_message.subscriptions.funcs.decode = decode_subscriptions_callback; MDR_res_message.subscriptions.arg = (void*)dev_idx; @@ -164,7 +185,8 @@ static void *handshake_func(void * pvArgs) hs_state = HS_REGISTERED; } } - + + /* TODO This is slightly redundant now, so fix this */ dev_sts[dev_idx] = get_state_from_hs_status(GET_ADDR_FROM_IDX(dev_idx), hs_state); } } |
