summaryrefslogtreecommitdiff
path: root/qmic.h
blob: 8b7c991bf4c28614b4d05acb0d2e3cfbdfb2b7f1 (plain)
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
#ifndef __QMIC_H__
#define __QMIC_H__

#include <stdbool.h>

#include "list.h"

#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))

enum {
	TYPE_U8,
	TYPE_U16,
	TYPE_U32,
	TYPE_U64,
	TYPE_STRING,
	TYPE_STRUCT
};

enum message_type {
	MESSAGE_REQUEST = 0,
	MESSAGE_RESPONSE = 2,
	MESSAGE_INDICATION = 4,
};

extern const char *sz_simple_types[];

extern const char *qmi_package;

struct qmi_const {
	const char *name;
	unsigned value;

	struct list_head node;
};

struct qmi_message_member {
	const char *name;
	int type;
	struct qmi_struct *qmi_struct;
	int id;
	bool required;
	unsigned array;

	struct list_head node;
};

struct qmi_message {
	enum message_type type;
	const char *name;
	unsigned msg_id;

	struct list_head node;

	struct list_head members;
};

struct qmi_struct_member {
	const char *name;
	int type;

	struct list_head node;
};

struct qmi_struct {
	const char *name;

	struct list_head node;

	struct list_head members;
};

extern struct list_head qmi_consts;
extern struct list_head qmi_messages;
extern struct list_head qmi_structs;

void qmi_parse(void);

void emit_source_includes(FILE *fp, const char *package);
void guard_header(FILE *fp, const char *package);
void guard_footer(FILE *fp);
void qmi_const_header(FILE *fp);

void accessor_emit_c(FILE *fp, const char *package);
void accessor_emit_h(FILE *fp, const char *package);

#endif