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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Samsung Exynos SoC series dsp driver
*
* Copyright (c) 2019 Samsung Electronics Co., Ltd.
* http://www.samsung.com/
*/
#ifndef __DL_DSP_RULE_READER_H__
#define __DL_DSP_RULE_READER_H__
#include "dl/dsp-common.h"
#include "dl/dsp-list.h"
#define RULE_MAX (100)
#pragma pack(push, 4)
enum dsp_sign_type {
SIGNED,
UNSIGNED
};
struct dsp_type {
int bit_sz;
enum dsp_sign_type sign;
};
enum dsp_element_type {
EXP_OP,
EXP_INTEGER,
EXP_LINKER_VALUE
};
enum dsp_linker_value_type {
ADDEND,
BLOCK_ADDR_AR,
BLOCK_ADDR_BR,
ITEM_ADDR_AR,
ITEM_ADDR_BR,
ITEM_VALUE,
STORED_VALUE,
SYMBOL_ADDR_AR,
SYMBOL_ADDR_BR,
SYMBOL_BLOCK_ADDR_AR,
SYMBOL_BLOCK_ADDR_BR
};
struct dsp_exp_element {
enum dsp_element_type type;
union {
char op;
enum dsp_linker_value_type linker_value;
int integer;
};
struct dsp_list_node list_node;
};
enum dsp_bit_ext_type {
BIT_ONE,
BIT_ZERO,
BIT_SIGN,
BIT_NONE
};
struct dsp_bit_slice {
enum dsp_bit_ext_type h_ext;
int high;
int low;
enum dsp_bit_ext_type l_ext;
int value;
struct dsp_list_node list_node;
};
enum dsp_pos_type {
BIT_POS,
BIT_SLICE_LIST
};
struct dsp_pos {
enum dsp_pos_type type;
union {
int bit_pos;
struct dsp_list_head bit_slice_list;
};
struct dsp_list_node list_node;
};
struct dsp_cont {
struct dsp_type type;
int inst_num;
};
enum dsp_range_type {
RANGE_STRICT,
RANGE_NOSTRICT
};
struct dsp_reloc_rule {
int idx;
struct dsp_list_head exp;
struct dsp_type type;
struct dsp_list_head pos_list;
struct dsp_cont cont;
enum dsp_range_type range_chk;
};
struct dsp_reloc_rule_list {
struct dsp_reloc_rule *list[RULE_MAX];
int cnt;
};
#pragma pack(pop)
void dsp_type_print(struct dsp_type *type);
void dsp_exp_binary_op(struct dsp_list_head *head, struct dsp_list_head *head1,
struct dsp_list_head *head2, char op);
void dsp_exp_print(struct dsp_list_head *head);
int dsp_exp_import(struct dsp_exp_element *exp, struct dsp_dl_lib_file *file);
void dsp_exp_free(struct dsp_list_head *head);
void dsp_bit_ext_print(enum dsp_bit_ext_type ext);
void dsp_bit_slice_print(struct dsp_list_head *head);
int dsp_bit_slice_import(struct dsp_bit_slice *bs,
struct dsp_dl_lib_file *file);
void dsp_bit_slice_free(struct dsp_list_head *head);
void dsp_pos_print(struct dsp_list_head *head);
int dsp_pos_import(struct dsp_pos *pos, struct dsp_dl_lib_file *file);
void dsp_pos_free(struct dsp_list_head *head);
void dsp_cont_print(struct dsp_cont *cont);
void dsp_range_print(enum dsp_range_type ran);
void dsp_reloc_rule_print(struct dsp_reloc_rule *rule);
int dsp_reloc_rule_import(struct dsp_reloc_rule *rule,
struct dsp_dl_lib_file *file);
void dsp_reloc_rule_free(struct dsp_reloc_rule *rule);
void dsp_reloc_rule_list_print(struct dsp_reloc_rule_list *list);
int dsp_reloc_rule_list_import(struct dsp_reloc_rule_list *list,
struct dsp_dl_lib_file *file);
void dsp_reloc_rule_list_free(struct dsp_reloc_rule_list *list);
#endif
|