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
|
/* SPDX-License-Identifier: ISC */
/* Copyright (c) 2019, The Linux Foundation. All rights reserved. */
#ifndef __WIL_CONFIG_H__
#define __WIL_CONFIG_H__
#define WIL_CONFIG_VAR_OFFSET(_struct, _var) (offsetof(_struct, _var))
#define WIL_CONFIG_VAR_SIZE(_struct, _var) (FIELD_SIZEOF(_struct, _var))
enum wil_ini_param_type {
wil_ini_param_type_unsigned,
wil_ini_param_type_signed,
wil_ini_param_type_string,
wil_ini_param_type_macaddr,
};
#define WIL_CONFIG_INI_PARAM(_name, _type, _ref, _offset, _size, _min, _max)\
{ \
(_name), \
(_type), \
(_ref), \
(_offset), \
(_size), \
(_min), \
(_max), \
(NULL), \
}
#define WIL_CONFIG_INI_STRING_PARAM(_name, _ref, _offset, _size)\
{ \
(_name), \
(wil_ini_param_type_string), \
(_ref), \
(_offset), \
(_size), \
(0), \
(0), \
(NULL), \
}
#define WIL_CONFIG_INI_PARAM_WITH_HANDLER(_name, _handler)\
{ \
(_name), \
(wil_ini_param_type_string), \
(NULL), \
(0), \
(0), \
(0), \
(0), \
(_handler), \
}
/* forward declaration */
struct wil6210_priv;
struct wil_config_entry {
char *name; /* variable name as expected in wigig.ini file */
enum wil_ini_param_type type; /* variable type */
void *var_ref; /* reference to global variable */
u16 var_offset; /* offset to field inside wil6210_priv structure */
u32 var_size; /* size (in bytes) of the field */
unsigned long min_val; /* minimum value, for range checking */
unsigned long max_val; /* maximum value, for range checking */
/* handler function for complex parameters */
int (*handler)(struct wil6210_priv *wil, const char *buf,
size_t count);
};
/* read and parse ini file */
int wil_parse_config_ini(struct wil6210_priv *wil);
#endif /* __WIL_CONFIG_H__ */
|