2016-02-08 01:27:50 +08:00
|
|
|
#ifndef __QMIC_H__
|
|
|
|
#define __QMIC_H__
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
2018-01-31 08:54:13 +08:00
|
|
|
#include "list.h"
|
|
|
|
|
2018-01-31 08:18:13 +08:00
|
|
|
#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
|
2016-02-08 01:27:50 +08:00
|
|
|
|
2021-10-02 07:23:23 +08:00
|
|
|
enum symbol_type {
|
2016-02-08 01:27:50 +08:00
|
|
|
TYPE_U8,
|
|
|
|
TYPE_U16,
|
|
|
|
TYPE_U32,
|
|
|
|
TYPE_U64,
|
|
|
|
TYPE_STRING,
|
|
|
|
TYPE_STRUCT
|
|
|
|
};
|
|
|
|
|
|
|
|
enum message_type {
|
2016-02-08 01:46:56 +08:00
|
|
|
MESSAGE_REQUEST = 0,
|
|
|
|
MESSAGE_RESPONSE = 2,
|
|
|
|
MESSAGE_INDICATION = 4,
|
2016-02-08 01:27:50 +08:00
|
|
|
};
|
|
|
|
|
2018-01-31 08:06:33 +08:00
|
|
|
extern const char *sz_simple_types[];
|
|
|
|
|
2018-01-31 08:10:54 +08:00
|
|
|
extern const char *qmi_package;
|
|
|
|
|
|
|
|
struct qmi_const {
|
|
|
|
const char *name;
|
2021-10-02 07:23:26 +08:00
|
|
|
unsigned long long value;
|
2018-01-31 08:10:54 +08:00
|
|
|
|
|
|
|
struct list_head node;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct qmi_message_member {
|
|
|
|
const char *name;
|
|
|
|
int type;
|
|
|
|
struct qmi_struct *qmi_struct;
|
|
|
|
int id;
|
|
|
|
bool required;
|
2018-02-01 04:59:05 +08:00
|
|
|
unsigned array_size;
|
|
|
|
bool array_fixed;
|
2018-01-31 08:10:54 +08:00
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2018-01-31 08:13:06 +08:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2018-01-31 08:10:54 +08:00
|
|
|
extern struct list_head qmi_consts;
|
|
|
|
extern struct list_head qmi_messages;
|
2018-01-31 08:13:06 +08:00
|
|
|
extern struct list_head qmi_structs;
|
2018-01-31 08:10:54 +08:00
|
|
|
|
2018-01-31 08:54:13 +08:00
|
|
|
void qmi_parse(void);
|
2016-02-08 01:27:50 +08:00
|
|
|
|
2018-01-31 08:54:13 +08:00
|
|
|
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);
|
2016-02-08 01:27:50 +08:00
|
|
|
|
2018-01-31 08:54:13 +08:00
|
|
|
void accessor_emit_c(FILE *fp, const char *package);
|
|
|
|
void accessor_emit_h(FILE *fp, const char *package);
|
2018-01-31 08:10:54 +08:00
|
|
|
|
2018-02-01 04:59:05 +08:00
|
|
|
void kernel_emit_c(FILE *fp, const char *package);
|
|
|
|
void kernel_emit_h(FILE *fp, const char *package);
|
|
|
|
|
2016-02-08 01:27:50 +08:00
|
|
|
#endif
|