summaryrefslogtreecommitdiff
path: root/src/master_posix.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/master_posix.c')
-rw-r--r--src/master_posix.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/master_posix.c b/src/master_posix.c
index 83eb741..c312757 100644
--- a/src/master_posix.c
+++ b/src/master_posix.c
@@ -28,6 +28,7 @@
#include "data.pb.h"
#include "stream.h"
#include "stream_stdio.h"
+#include "port.h"
/* FreeRTOS+POSIX. should go in the port folder */
/* #include "FreeRTOS_POSIX/pthread.h" */
@@ -45,7 +46,7 @@
#define SET_BIT_FROM_IDX(a, b) a[b>>5]|=(1<<(b%32))
#define COUNTOF(__BUFFER__) (sizeof(__BUFFER__) / sizeof(*(__BUFFER__)))
-#define BUS_DEVICE_LIMIT 16
+#define BUS_DEVICE_LIMIT 2
device_info_t *device_info[BUS_DEVICE_LIMIT] = {NULL};
subscription_info_t* subs_info[BUS_DEVICE_LIMIT];
@@ -101,6 +102,17 @@ void vStartPOSIXMaster(void *pvParams)
pthread_create(&routing_thread, NULL, routing_func, NULL);
+ /* This function will be defined for the port
+ * Each port will have a configuration file that includes details about the bus,
+ * either in a custom format or in a devicetree format (preferred)
+ *
+ */
+
+ p_stream_t *device_streams;
+ device_streams = malloc(sizeof(p_stream_t)*BUS_DEVICE_LIMIT);
+
+ initialize_devices(BUS_DEVICE_LIMIT, device_streams);
+
/* Add device-specific stream/thread declerations here, if needed */
/* ... */
@@ -147,6 +159,8 @@ static void *routing_func(void *pvArgs)
}
return NULL;
}
+
+/* This function should go into its own file, with a normalized state machine implementation */
hs_status_t handshake(uint32_t i2c_addr)
{