diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..3f535cd --- /dev/null +++ b/meson.build @@ -0,0 +1,3 @@ +project('tuxclocker') + +subdir('src') diff --git a/src/include/tc_assignable.h b/src/include/tc_assignable.h new file mode 100644 index 0000000..1f70fbe --- /dev/null +++ b/src/include/tc_assignable.h @@ -0,0 +1,56 @@ +#pragma once + +#include +#include + +/* Defines the interface for modifying writable properties in controlled hardware. + It is a tree structure provided by a module. */ + +enum tc_assignable_value_category {TC_ASSIGNABLE_RANGE, TC_ASSIGNABLE_ENUM}; + +// Is the range double or integer +enum tc_assignable_range_data_type {TC_ASSIGNABLE_RANGE_INT, TC_ASSIGNABLE_RANGE_DOUBLE}; + +typedef struct tc_assignable_range_double_t{ + double min, max; +} tc_assignable_range_double_t; + +typedef struct tc_assignable_range_int_t{ + int64_t min, max; +} tc_assignable_range_int_t; + +typedef struct { + enum tc_assignable_range_data_type range_data_type; + union { + tc_assignable_range_double_t double_range; + tc_assignable_range_int_t int_range; + }; +} tc_assignable_range_t; + +typedef struct { + uint16_t property_count; + char **properties; +} tc_assignable_enum_t; + + + +typedef struct tc_assignable_node_t { + // Assignable name eg. fan speed + char *name; + // Unit for assignable + char *unit; + + bool assignable; + // Callback for assignment + int8_t (*assign_callback)(); + + // Possible values for tunables are either values from a range or enumerations + enum tc_assignable_value_category value_category; + union { + tc_assignable_enum_t enum_info; + tc_assignable_range_t range_info; + }; + + uint16_t children_count; + struct tc_assignable_node_t **children_nodes; +} tc_assignable_node_t; diff --git a/src/include/tc_module.h b/src/include/tc_module.h new file mode 100644 index 0000000..36ea689 --- /dev/null +++ b/src/include/tc_module.h @@ -0,0 +1,7 @@ +#pragma once + +#include + +typedef struct tc_module_t { + +} tc_module_t; diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..10e3011 --- /dev/null +++ b/src/meson.build @@ -0,0 +1 @@ +subdir('modules') diff --git a/src/modules/assignable/meson.build b/src/modules/assignable/meson.build new file mode 100644 index 0000000..1855fb8 --- /dev/null +++ b/src/modules/assignable/meson.build @@ -0,0 +1 @@ +shared_library('libnvidia', 'nvidia.c') diff --git a/src/modules/assignable/nvidia.c b/src/modules/assignable/nvidia.c new file mode 100644 index 0000000..4e29248 --- /dev/null +++ b/src/modules/assignable/nvidia.c @@ -0,0 +1,5 @@ +#include "/opt/cuda/include/nvml.h" + +#define MAX_GPUS 32 + +static nvmlDevice_t nvml_handles[MAX_GPUS]; diff --git a/src/modules/meson.build b/src/modules/meson.build new file mode 100644 index 0000000..29f5036 --- /dev/null +++ b/src/modules/meson.build @@ -0,0 +1 @@ +subdir('assignable')