mirror of
https://github.com/linux-msm/qmic.git
synced 2024-11-23 09:44:06 +08:00
ad480502eb
The language supports specifying 64-bit unsigned values, but the num field of the token structure is not guaranteed to be 64 bits wide. Change its type to be unsigned long long, and change the code that parses numbers to use strtoull() so we can actually accept a 64-bit value. This is also true of the value field of the token type. Change it to unsigned long long as well (and format it as unsigned). Check the return value of strtoull(), and if the result is out of range, report an error. Signed-off-by: Alex Elder <elder@linaro.org> Message-Id: <20211001232338.769309-23-elder@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
91 lines
1.5 KiB
C
91 lines
1.5 KiB
C
#ifndef __QMIC_H__
|
|
#define __QMIC_H__
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "list.h"
|
|
|
|
#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
|
|
|
|
enum symbol_type {
|
|
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 long long 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_size;
|
|
bool array_fixed;
|
|
|
|
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);
|
|
|
|
void kernel_emit_c(FILE *fp, const char *package);
|
|
void kernel_emit_h(FILE *fp, const char *package);
|
|
|
|
#endif
|