forked from nicehash/sgminer
-
Notifications
You must be signed in to change notification settings - Fork 144
/
config_parser.h
115 lines (99 loc) · 4.28 KB
/
config_parser.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#ifndef CONFIG_PARSER_H
#define CONFIG_PARSER_H
#include "config.h"
#include "miner.h"
#include "api.h"
#include "algorithm.h"
//profile structure
struct profile {
int profile_no;
char *name;
bool removed;
algorithm_t algorithm;
const char *devices;
char *intensity;
char *xintensity;
char *rawintensity;
const char *lookup_gap;
const char *gpu_engine;
const char *gpu_memclock;
const char *gpu_threads;
const char *gpu_fan;
const char *gpu_powertune;
const char *gpu_vddc;
const char *shaders;
const char *thread_concurrency;
const char *worksize;
};
/* globals needed outside */
extern char *cnfbuf;
extern int fileconf_load;
extern const char def_conf[];
extern char *default_config;
extern bool config_loaded;
extern int json_array_index;
extern struct profile default_profile;
extern struct profile **profiles;
extern int total_profiles;
/* profile helper functions */
extern struct profile *get_gpu_profile(int gpuid);
/* option parser functions */
extern char *set_default_algorithm(const char *arg);
extern char *set_default_nfactor(const char *arg);
extern char *set_default_devices(const char *arg);
extern char *set_default_kernelfile(const char *arg);
extern char *set_default_lookup_gap(const char *arg);
extern char *set_default_intensity(const char *arg);
extern char *set_default_xintensity(const char *arg);
extern char *set_default_rawintensity(const char *arg);
extern char *set_default_thread_concurrency(const char *arg);
extern char *set_default_gpu_threads(const char *arg);
extern char *set_default_gpu_engine(const char *arg);
extern char *set_default_gpu_memclock(const char *arg);
extern char *set_default_gpu_fan(const char *arg);
extern char *set_default_gpu_powertune(const char *arg);
extern char *set_default_gpu_vddc(const char *arg);
extern char *set_default_profile(char *arg);
extern char *set_default_shaders(const char *arg);
extern char *set_default_worksize(const char *arg);
extern char *set_profile_name(const char *arg);
extern char *set_profile_algorithm(const char *arg);
extern char *set_profile_devices(const char *arg);
extern char *set_profile_kernelfile(const char *arg);
extern char *set_profile_lookup_gap(const char *arg);
extern char *set_profile_intensity(const char *arg);
extern char *set_profile_xintensity(const char *arg);
extern char *set_profile_rawintensity(const char *arg);
extern char *set_profile_thread_concurrency(const char *arg);
extern char *set_profile_gpu_threads(const char *arg);
extern char *set_profile_gpu_engine(const char *arg);
extern char *set_profile_gpu_memclock(const char *arg);
extern char *set_profile_gpu_fan(const char *arg);
extern char *set_profile_gpu_powertune(const char *arg);
extern char *set_profile_gpu_vddc(const char *arg);
extern char *set_profile_nfactor(const char *arg);
extern char *set_profile_shaders(const char *arg);
extern char *set_profile_worksize(const char *arg);
/* config parser functions */
extern char *parse_config(json_t *val, const char *key, const char *parentkey, bool fileconf, int parent_iteration);
extern char *load_config(const char *arg, const char *parentkey, void __maybe_unused *unused);
extern char *set_default_config(const char *arg);
extern void load_default_config(void);
/* startup functions */
extern void init_default_profile();
extern void load_default_profile();
extern void apply_defaults();
extern void apply_pool_profiles();
extern void apply_pool_profile(struct pool *pool);
/* config writer */
extern void write_config(const char *filename);
/* API functions */
extern void api_profile_list(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __maybe_unused char *param, bool isjson, __maybe_unused char group);
extern void api_profile_add(struct io_data *io_data, __maybe_unused SOCKETTYPE c, char *param, bool isjson, __maybe_unused char group);
extern void api_profile_remove(struct io_data *io_data, __maybe_unused SOCKETTYPE c, char *param, bool isjson, __maybe_unused char group);
extern void api_pool_profile(struct io_data *io_data, __maybe_unused SOCKETTYPE c, char *param, bool isjson, __maybe_unused char group);
/* API/UI config update functions */
extern void update_config_intensity(struct profile *profile);
extern void update_config_xintensity(struct profile *profile);
extern void update_config_rawintensity(struct profile *profile);
#endif // CONFIG_PARSER_H