initial commit

This commit is contained in:
jussi 2019-09-13 16:00:43 +03:00
parent 4411c29aeb
commit d8a013dcba
7 changed files with 74 additions and 0 deletions

3
meson.build Normal file
View File

@ -0,0 +1,3 @@
project('tuxclocker')
subdir('src')

View File

@ -0,0 +1,56 @@
#pragma once
#include <stdint.h>
#include <stdbool.h>
/* 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;

7
src/include/tc_module.h Normal file
View File

@ -0,0 +1,7 @@
#pragma once
#include <stdint.h>
typedef struct tc_module_t {
} tc_module_t;

1
src/meson.build Normal file
View File

@ -0,0 +1 @@
subdir('modules')

View File

@ -0,0 +1 @@
shared_library('libnvidia', 'nvidia.c')

View File

@ -0,0 +1,5 @@
#include "/opt/cuda/include/nvml.h"
#define MAX_GPUS 32
static nvmlDevice_t nvml_handles[MAX_GPUS];

1
src/modules/meson.build Normal file
View File

@ -0,0 +1 @@
subdir('assignable')