diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/algorithm/arithmos/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/algorithm/arithmos/info.txt new file mode 100644 index 00000000..bac99a77 --- /dev/null +++ b/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/algorithm/arithmos/info.txt @@ -0,0 +1 @@ +Entry for Electrostatic-Arithmos module. diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/algorithm/automata/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/algorithm/automata/info.txt new file mode 100644 index 00000000..c93ccf42 --- /dev/null +++ b/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/algorithm/automata/info.txt @@ -0,0 +1 @@ +Entry for Electrostatic-Automata module. diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/algorithm/di/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/algorithm/di/info.txt new file mode 100644 index 00000000..f22289ba --- /dev/null +++ b/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/algorithm/di/info.txt @@ -0,0 +1 @@ +Entry for Electrostatic-DI module. diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/algorithm/ecs/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/algorithm/ecs/info.txt new file mode 100644 index 00000000..a7ae814d --- /dev/null +++ b/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/algorithm/ecs/info.txt @@ -0,0 +1 @@ +Entry for Electrostatic-ES module. diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/comm/comm.h b/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/comm/comm.h index 75efb2bd..af5a02b5 100644 --- a/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/comm/comm.h +++ b/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/comm/comm.h @@ -17,12 +17,21 @@ extern "C" { #endif typedef struct { - char* name; + char *name; int descriptor; - char* protocol_name; - char* file_system; + char *protocol_name; + char *file_system; } device_metadata; +typedef struct { + void** (*on_open)(void**); + void** (*on_init)(void**); + void** (*on_deinit)(void**); + void** (*on_read)(void**); + void** (*on_write)(void**); + void** (*on_close)(void**); +} comm_callbacks; + typedef struct { device_metadata (*open)(void**); uint8_t (*init)(void**); @@ -31,23 +40,29 @@ typedef struct { uint64_t (*write)(void**); uint8_t (*close)(void**); device_metadata (*get_metadata)(void**); + comm_callbacks *callbacks; } comm_protocol; /** * Defines function tables for communication protocols. */ enum CommProtocol { - Serial = 0x00, - Parallel = 0x01, - Pci = 0x02, - Sockets = 0x03 + SERIAL_RS232 = 0x00, + IEEE_1284 = 0x01, + PCI = 0x02, + NET_SOCKETS = 0x03, + SERIAL_UART = 0x04, + SERIAL_SPI = 0x05, + SERIAL_TWI = 0x06, + SERIAL_CUSTOM_01 = 0x07, + SERIAL_CUSTOM_02 = 0x08 }; extern uint8_t init_protocol(comm_protocol*, const comm_protocol*); -extern uint8_t init_protocol_default(comm_protocol*, enum CommProtocol); +extern uint8_t init_protocol_default(comm_protocol*, enum CommProtocol, const comm_callbacks*); #ifdef __cplusplus } #endif -#endif //_ELECTROSTATIC_COMM_H_ \ No newline at end of file +#endif //_ELECTROSTATIC_COMM_H_ diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/electrofs/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/sys/electrofs/info.txt similarity index 100% rename from electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/electrofs/info.txt rename to electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/sys/electrofs/info.txt diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/electrohid/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/sys/electrohid/info.txt similarity index 100% rename from electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/electrohid/info.txt rename to electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/sys/electrohid/info.txt diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/electromemory/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/sys/electromemory/info.txt similarity index 100% rename from electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/electromemory/info.txt rename to electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/sys/electromemory/info.txt diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/electroparallel/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/sys/electroparallel/info.txt similarity index 100% rename from electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/electroparallel/info.txt rename to electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/sys/electroparallel/info.txt diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/electropci/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/sys/electropci/info.txt similarity index 100% rename from electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/electropci/info.txt rename to electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/sys/electropci/info.txt diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/electroserial/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/sys/electroserial/info.txt similarity index 100% rename from electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/electroserial/info.txt rename to electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/sys/electroserial/info.txt diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/electrosockets/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/sys/electrosockets/info.txt similarity index 100% rename from electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/electrosockets/info.txt rename to electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/sys/electrosockets/info.txt diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/electrousbfs/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/sys/electrousbfs/info.txt similarity index 100% rename from electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/electrousbfs/info.txt rename to electrostatic-sandbox-framework/electrostatic-core/src/include/electrostatic/sys/electrousbfs/info.txt diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/libs/algorithm/arithmos/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/libs/algorithm/arithmos/info.txt new file mode 100644 index 00000000..bac99a77 --- /dev/null +++ b/electrostatic-sandbox-framework/electrostatic-core/src/libs/algorithm/arithmos/info.txt @@ -0,0 +1 @@ +Entry for Electrostatic-Arithmos module. diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/libs/algorithm/automata/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/libs/algorithm/automata/info.txt new file mode 100644 index 00000000..c93ccf42 --- /dev/null +++ b/electrostatic-sandbox-framework/electrostatic-core/src/libs/algorithm/automata/info.txt @@ -0,0 +1 @@ +Entry for Electrostatic-Automata module. diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/libs/algorithm/di/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/libs/algorithm/di/info.txt new file mode 100644 index 00000000..f22289ba --- /dev/null +++ b/electrostatic-sandbox-framework/electrostatic-core/src/libs/algorithm/di/info.txt @@ -0,0 +1 @@ +Entry for Electrostatic-DI module. diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/libs/algorithm/ecs/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/libs/algorithm/ecs/info.txt new file mode 100644 index 00000000..a7ae814d --- /dev/null +++ b/electrostatic-sandbox-framework/electrostatic-core/src/libs/algorithm/ecs/info.txt @@ -0,0 +1 @@ +Entry for Electrostatic-ES module. diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/libs/comm/init_protocol.c b/electrostatic-sandbox-framework/electrostatic-core/src/libs/comm/init_protocol.c index f17cd3a2..b2ee9ea6 100644 --- a/electrostatic-sandbox-framework/electrostatic-core/src/libs/comm/init_protocol.c +++ b/electrostatic-sandbox-framework/electrostatic-core/src/libs/comm/init_protocol.c @@ -14,16 +14,16 @@ static device_metadata test_parallel(void** args) { return metadata; } -const static comm_protocol serial_table = { +static comm_protocol serial_table = { &test_serial }; -const static comm_protocol parallel_table = { +static comm_protocol parallel_table = { &test_parallel }; -extern uint8_t init_protocol(comm_protocol* comm, - const comm_protocol* from) { +extern uint8_t init_protocol(comm_protocol *comm, + const comm_protocol *from) { if (&from == NULL) { return -1; } @@ -33,13 +33,16 @@ extern uint8_t init_protocol(comm_protocol* comm, comm->read = from->read; comm->write = from->write; comm->close = from->close; + comm->callbacks = NULL; return 0; } -extern uint8_t init_protocol_default(comm_protocol* comm, enum CommProtocol protocol) { - if (protocol == Serial) { +extern uint8_t init_protocol_default(comm_protocol *comm, enum CommProtocol protocol, const comm_callbacks *callbacks) { + if (protocol == SERIAL_RS232) { + serial_table.callbacks = (comm_callbacks*) callbacks; return init_protocol(comm, &serial_table); - } else if (protocol == Parallel) { + } else if (protocol == IEEE_1284) { + parallel_table.callbacks = callbacks; return init_protocol(comm, ¶llel_table); } -} \ No newline at end of file +} diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/libs/electrofs/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/android/sys/electrofs/info.txt similarity index 100% rename from electrostatic-sandbox-framework/electrostatic-core/src/libs/electrofs/info.txt rename to electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/android/sys/electrofs/info.txt diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/libs/electrohid/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/android/sys/electrohid/info.txt similarity index 100% rename from electrostatic-sandbox-framework/electrostatic-core/src/libs/electrohid/info.txt rename to electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/android/sys/electrohid/info.txt diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/libs/electromemory/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/android/sys/electromemory/info.txt similarity index 100% rename from electrostatic-sandbox-framework/electrostatic-core/src/libs/electromemory/info.txt rename to electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/android/sys/electromemory/info.txt diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/libs/electroparallel/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/android/sys/electroparallel/info.txt similarity index 100% rename from electrostatic-sandbox-framework/electrostatic-core/src/libs/electroparallel/info.txt rename to electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/android/sys/electroparallel/info.txt diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/libs/electropci/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/android/sys/electropci/info.txt similarity index 100% rename from electrostatic-sandbox-framework/electrostatic-core/src/libs/electropci/info.txt rename to electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/android/sys/electropci/info.txt diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/libs/electroserial/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/android/sys/electroserial/info.txt similarity index 100% rename from electrostatic-sandbox-framework/electrostatic-core/src/libs/electroserial/info.txt rename to electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/android/sys/electroserial/info.txt diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/libs/electrosockets/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/android/sys/electrosockets/info.txt similarity index 100% rename from electrostatic-sandbox-framework/electrostatic-core/src/libs/electrosockets/info.txt rename to electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/android/sys/electrosockets/info.txt diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/libs/electrousbfs/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/android/sys/electrousbfs/info.txt similarity index 100% rename from electrostatic-sandbox-framework/electrostatic-core/src/libs/electrousbfs/info.txt rename to electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/android/sys/electrousbfs/info.txt diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/linux/sys/electrofs/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/linux/sys/electrofs/info.txt new file mode 100644 index 00000000..8f521dab --- /dev/null +++ b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/linux/sys/electrofs/info.txt @@ -0,0 +1 @@ + directory entry: diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/linux/sys/electrohid/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/linux/sys/electrohid/info.txt new file mode 100644 index 00000000..ab1f64ba --- /dev/null +++ b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/linux/sys/electrohid/info.txt @@ -0,0 +1 @@ + directory entry: diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/linux/sys/electromemory/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/linux/sys/electromemory/info.txt new file mode 100644 index 00000000..24f55b8c --- /dev/null +++ b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/linux/sys/electromemory/info.txt @@ -0,0 +1 @@ + directory entry: diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/linux/sys/electroparallel/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/linux/sys/electroparallel/info.txt new file mode 100644 index 00000000..1f87d316 --- /dev/null +++ b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/linux/sys/electroparallel/info.txt @@ -0,0 +1 @@ + directory entry: diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/linux/sys/electropci/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/linux/sys/electropci/info.txt new file mode 100644 index 00000000..d6d51275 --- /dev/null +++ b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/linux/sys/electropci/info.txt @@ -0,0 +1 @@ + directory entry: diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/linux/sys/electroserial/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/linux/sys/electroserial/info.txt new file mode 100644 index 00000000..d89472f1 --- /dev/null +++ b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/linux/sys/electroserial/info.txt @@ -0,0 +1 @@ + directory entry: diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/linux/sys/electrosockets/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/linux/sys/electrosockets/info.txt new file mode 100644 index 00000000..26154cf0 --- /dev/null +++ b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/linux/sys/electrosockets/info.txt @@ -0,0 +1 @@ + directory entry: diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/linux/sys/electrousbfs/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/linux/sys/electrousbfs/info.txt new file mode 100644 index 00000000..2c900211 --- /dev/null +++ b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/linux/sys/electrousbfs/info.txt @@ -0,0 +1 @@ + directory entry: diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/mcu/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/mcu/info.txt new file mode 100644 index 00000000..df8c89d7 --- /dev/null +++ b/electrostatic-sandbox-framework/electrostatic-core/src/libs/platform/mcu/info.txt @@ -0,0 +1 @@ +Entry for Microcontroller Units implementations. diff --git a/electrostatic-sandbox-framework/electrostatic-core/src/libs/util/info.txt b/electrostatic-sandbox-framework/electrostatic-core/src/libs/util/info.txt new file mode 100644 index 00000000..faf1a64d --- /dev/null +++ b/electrostatic-sandbox-framework/electrostatic-core/src/libs/util/info.txt @@ -0,0 +1 @@ +Entry for Utilities. diff --git a/electrostatic-sandbox-framework/electrostatic-examples/src/hello_comm.c b/electrostatic-sandbox-framework/electrostatic-examples/src/hello_comm.c index c4586d81..060607ec 100644 --- a/electrostatic-sandbox-framework/electrostatic-examples/src/hello_comm.c +++ b/electrostatic-sandbox-framework/electrostatic-examples/src/hello_comm.c @@ -5,8 +5,8 @@ comm_protocol serial; comm_protocol parallel; int main() { - init_protocol_default(&serial, Serial); - init_protocol_default(¶llel, Parallel); + init_protocol_default(&serial, SERIAL_RS232, NULL); + init_protocol_default(¶llel, IEEE_1284, NULL); parallel.open(0); serial.open(0); return 0; diff --git a/electrostatic-sandbox-framework/electrostatic4j/electrostatic4j-native/src/lib/jni/electrostatic4j_NativeLibrary.c b/electrostatic-sandbox-framework/electrostatic4j/electrostatic4j-native/src/lib/jni/electrostatic4j_NativeLibrary.c index 2425abe1..90d50f70 100644 --- a/electrostatic-sandbox-framework/electrostatic4j/electrostatic4j-native/src/lib/jni/electrostatic4j_NativeLibrary.c +++ b/electrostatic-sandbox-framework/electrostatic4j/electrostatic4j-native/src/lib/jni/electrostatic4j_NativeLibrary.c @@ -6,8 +6,8 @@ JNIEXPORT jint JNICALL Java_electrostatic4j_NativeLibrary_open (JNIEnv* env, jclass clazz, jstring data) { comm_protocol serial; comm_protocol parallel; - init_protocol_default(&serial, Serial); - init_protocol_default(¶llel, Parallel); + init_protocol_default(&serial, SERIAL_RS232, NULL); + init_protocol_default(¶llel, IEEE_1284, NULL); parallel.open(0); serial.open(0); return 0; diff --git a/electrostatic-sandbox-framework/helper-scripts/project-impl/compile-electrostatic.sh b/electrostatic-sandbox-framework/helper-scripts/project-impl/compile-electrostatic.sh index 84d9a6ee..8d13a996 100755 --- a/electrostatic-sandbox-framework/helper-scripts/project-impl/compile-electrostatic.sh +++ b/electrostatic-sandbox-framework/helper-scripts/project-impl/compile-electrostatic.sh @@ -11,9 +11,17 @@ TOOLCHAIN_HEADERS="${4}" SYSTEM_DIR="${5}" BUILD_DIR="${6}" +## +# define source modules +## +platform_module="$(pwd)/${source_dir}/dependencies/libs/platform/${SYSTEM_DIR}/" +comm_module="$(pwd)/${source_dir}/dependencies/libs/comm/" +algorithm_module="$(pwd)/${source_dir}/dependencies/libs/algorithm/" +util_module="$(pwd)/${source_dir}/dependencies/libs/util/" + # precompile scripts sources=$(find "$(pwd)/${source_dir}/src/" -name *.c -o -name *.cpp -o -name *.cxx | tr '\n' ';') -dependencies=$(find "$(pwd)/${source_dir}/dependencies/libs/" -name *.a -o -name *.so -o -name *.ar | tr '\n' ';') +dependencies=$(find "${platform_module}" "${comm_module}" "${algorithm_module}" "${util_module}" -name *.a -o -name *.so -o -name *.ar | tr '\n' ';') # compile scripts compile "${COMMISSION_LIB}" "${GCC_BIN}" "${GPP_BIN}" "${INPUT_COMPILER_OPTIONS}" \ @@ -44,4 +52,4 @@ cp -rv "$(pwd)/${source_dir}/src/include/" \ "$(pwd)/${e4j_dir}/dependencies/" cp -rv "$(pwd)/${source_dir}/src/include/" \ - "$(pwd)/${examples_dir}/dependencies/" \ No newline at end of file + "$(pwd)/${examples_dir}/dependencies/"