@@ -23,11 +23,10 @@ extern "C" {
23
23
*/
24
24
25
25
/**
26
- * @brief Get a label property from the node referenced by an
27
- * io-channels property at an index
26
+ * @brief Get IO channels controller "name" (label property) at an index
28
27
*
29
- * It's an error if the node referenced by the phandle in node_id's
30
- * io-channels property at index "idx" has no label property.
28
+ * It's an error if the IO channels controller referenced by the phandle
29
+ * in property "io_channels" at index "idx" has no label property.
31
30
*
32
31
* Example devicetree fragment:
33
32
*
@@ -47,20 +46,19 @@ extern "C" {
47
46
*
48
47
* DT_IO_CHANNELS_LABEL_BY_IDX(DT_NODELABEL(n), 1) // "ADC_2"
49
48
*
50
- * @param node_id node identifier for a node with an io-channels property
51
- * @param idx logical index into io-channels property
52
- * @return the label property of the node referenced at index " idx"
53
- * @see DT_PROP_BY_PHANDLE_IDX ()
49
+ * @param node_id node identifier
50
+ * @param idx logical index into the property
51
+ * @return the label property for the referenced node at index idx
52
+ * @see DT_PHANDLE_BY_IDX ()
54
53
*/
55
54
#define DT_IO_CHANNELS_LABEL_BY_IDX (node_id , idx ) \
56
55
DT_PROP_BY_PHANDLE_IDX(node_id, io_channels, idx, label)
57
56
58
57
/**
59
- * @brief Get a label property from an io-channels property by name
58
+ * @brief Get IO channels controller "name" (label property) by name
60
59
*
61
- * It's an error if the node referenced by the phandle in node_id's
62
- * io-channels property at the element named "name" has no label
63
- * property.
60
+ * It's an error if the IO channels controller referenced by the phandle
61
+ * in property "io_channels" at index "idx" has no label property.
64
62
*
65
63
* Example devicetree fragment:
66
64
*
@@ -81,169 +79,111 @@ extern "C" {
81
79
*
82
80
* DT_IO_CHANNELS_LABEL_BY_NAME(DT_NODELABEL(n), bandgap) // "ADC_2"
83
81
*
84
- * @param node_id node identifier for a node with an io-channels property
85
- * @param name lowercase-and-underscores name of an io-channels element
86
- * as defined by the node's io-channel-names property
87
- * @return the label property of the node referenced at the named element
82
+ * @param node_id node identifier
83
+ * @param name lowercase-and-underscores "io_channel" name
84
+ * @return the label property for the referenced node by name
88
85
* @see DT_PHANDLE_BY_NAME()
89
86
*/
90
87
#define DT_IO_CHANNELS_LABEL_BY_NAME (node_id , name ) \
91
88
DT_PROP(DT_PHANDLE_BY_NAME(node_id, io_channels, name), label)
92
89
93
90
/**
94
91
* @brief Equivalent to DT_IO_CHANNELS_LABEL_BY_IDX(node_id, 0)
95
- * @param node_id node identifier for a node with an io-channels property
96
- * @return the label property of the node referenced at index 0
92
+ * @param node_id node identifier
93
+ * @return the label property for the named specifier at index 0
97
94
* @see DT_IO_CHANNELS_LABEL_BY_IDX()
98
95
*/
99
96
#define DT_IO_CHANNELS_LABEL (node_id ) DT_IO_CHANNELS_LABEL_BY_IDX(node_id, 0)
100
97
101
98
/**
102
- * @brief Get a label property from a DT_DRV_COMPAT instance's io-channels
103
- * property at an index
104
- * @param inst DT_DRV_COMPAT instance number
105
- * @param idx logical index into io-channels property
106
- * @return the label property of the node referenced at index "idx"
107
- * @see DT_IO_CHANNELS_LABEL_BY_IDX()
99
+ * @brief Get IO channel's controller "name" at an index
100
+ * (see @ref DT_IO_CHANNELS_LABEL_BY_IDX)
101
+ * @param inst instance number
102
+ * @param idx logical index into the property
103
+ * @return the label property for the named specifier at index idx
108
104
*/
109
105
#define DT_INST_IO_CHANNELS_LABEL_BY_IDX (inst , idx ) \
110
106
DT_IO_CHANNELS_LABEL_BY_IDX(DT_DRV_INST(inst), idx)
111
107
112
108
/**
113
- * @brief Get a label property from a DT_DRV_COMPAT instance's io-channels
114
- * property by name
115
- * @param inst DT_DRV_COMPAT instance number
116
- * @param name lowercase-and-underscores name of an io-channels element
117
- * as defined by the instance's io-channel-names property
118
- * @return the label property of the node referenced at the named element
119
- * @see DT_IO_CHANNELS_LABEL_BY_NAME()
109
+ * @brief Get IO channel's controller "name" by name
110
+ * (see @ref DT_IO_CHANNELS_LABEL_BY_NAME)
111
+ * @param inst instance number
112
+ * @param name lowercase-and-underscores "io_channel" name
113
+ * @return the label property for the named specifier by name
120
114
*/
121
115
#define DT_INST_IO_CHANNELS_LABEL_BY_NAME (inst , name ) \
122
116
DT_IO_CHANNELS_LABEL_BY_NAME(DT_DRV_INST(inst), name)
123
117
124
118
/**
125
119
* @brief Equivalent to DT_INST_IO_CHANNELS_LABEL_BY_IDX(inst, 0)
126
- * @param inst DT_DRV_COMPAT instance number
127
- * @return the label property of the node referenced at index 0
120
+ * @param inst instance number
121
+ * @return the label property for the named specifier at index 0
128
122
*/
129
123
#define DT_INST_IO_CHANNELS_LABEL (inst ) DT_INST_IO_CHANNELS_LABEL_BY_IDX(inst, 0)
130
124
131
125
/**
132
- * @brief Get an io-channels specifier input cell at an index
133
- *
134
- * This macro only works for io-channels specifiers with cells named
135
- * "input". Refer to the node's binding to check if necessary.
136
- *
137
- * Example devicetree fragment:
138
- *
139
- * adc1: adc@... {
140
- * compatible = "vnd,adc";
141
- * #io-channel-cells = <1>;
142
- * };
126
+ * @brief Get IO channels controller 'input' at an index
143
127
*
144
- * adc2: adc@... {
145
- * compatible = "vnd,adc";
146
- * #io-channel-cells = <1>;
147
- * };
128
+ * This macro only works for IO channels controllers that specify a 'input'
129
+ * field in the phandle-array specifier. Refer to the specific IO channels
130
+ * controller binding if needed.
148
131
*
149
- * n: node {
150
- * io-channels = <&adc1 10>, <&adc2 20>;
151
- * };
152
- *
153
- * Bindings fragment for the vnd,adc compatible:
154
- *
155
- * io-channel-cells:
156
- * - input
157
- *
158
- * Example usage:
159
- *
160
- * DT_IO_CHANNELS_INPUT_BY_IDX(DT_NODELABEL(n), 0) // 10
161
- * DT_IO_CHANNELS_INPUT_BY_IDX(DT_NODELABEL(n), 1) // 20
162
- *
163
- * @param node_id node identifier for a node with an io-channels property
164
- * @param idx logical index into io-channels property
165
- * @return the input cell in the specifier at index "idx"
132
+ * @param node_id node identifier
133
+ * @param idx logical index into the property
134
+ * @return the input value for the named specifier at index idx
166
135
* @see DT_PHA_BY_IDX()
136
+ * @see DT_PHA()
167
137
*/
168
138
#define DT_IO_CHANNELS_INPUT_BY_IDX (node_id , idx ) \
169
139
DT_PHA_BY_IDX(node_id, io_channels, idx, input)
170
140
171
141
/**
172
- * @brief Get an io-channels specifier input cell by name
173
- *
174
- * This macro only works for io-channels specifiers with cells named
175
- * "input". Refer to the node's binding to check if necessary.
142
+ * @brief Get IO channels controller 'input' by name
176
143
*
177
- * Example devicetree fragment:
178
- *
179
- * adc1: adc@... {
180
- * compatible = "vnd,adc";
181
- * #io-channel-cells = <1>;
182
- * };
183
- *
184
- * adc2: adc@... {
185
- * compatible = "vnd,adc";
186
- * #io-channel-cells = <1>;
187
- * };
144
+ * This macro only works for IO channels controllers that specify a 'input'
145
+ * field in the phandle-array specifier. Refer to the specific IO channels
146
+ * controller binding if needed.
188
147
*
189
- * n: node {
190
- * io-channels = <&adc1 10>, <&adc2 20>;
191
- * io-channel-names = "SENSOR", "BANDGAP";
192
- * };
193
- *
194
- * Bindings fragment for the vnd,adc compatible:
195
- *
196
- * io-channel-cells:
197
- * - input
198
- *
199
- * Example usage:
200
- *
201
- * DT_IO_CHANNELS_INPUT_BY_NAME(DT_NODELABEL(n), sensor) // 10
202
- * DT_IO_CHANNELS_INPUT_BY_NAME(DT_NODELABEL(n), bandgap) // 20
203
- *
204
- * @param node_id node identifier for a node with an io-channels property
205
- * @param name lowercase-and-underscores name of an io-channels element
206
- * as defined by the node's io-channel-names property
207
- * @return the input cell in the specifier at the named element
148
+ * @param node_id node identifier
149
+ * @param name lowercase-and-underscores "io_channel" name
150
+ * @return the input value for the named specifier by name
208
151
* @see DT_PHA_BY_NAME()
209
152
*/
210
153
#define DT_IO_CHANNELS_INPUT_BY_NAME (node_id , name ) \
211
154
DT_PHA_BY_NAME(node_id, io_channels, name, input)
212
155
/**
213
156
* @brief Equivalent to DT_IO_CHANNELS_INPUT_BY_IDX(node_id, 0)
214
- * @param node_id node identifier for a node with an io-channels property
215
- * @return the input cell in the specifier at index 0
157
+ * @param node_id node identifier
158
+ * @return the label property for the named specifier at index 0
216
159
* @see DT_IO_CHANNELS_INPUT_BY_IDX()
217
160
*/
218
161
#define DT_IO_CHANNELS_INPUT (node_id ) DT_IO_CHANNELS_INPUT_BY_IDX(node_id, 0)
219
162
220
163
/**
221
- * @brief Get an input cell from the "DT_DRV_INST(inst)" io-channels
222
- * property at an index
223
- * @param inst DT_DRV_COMPAT instance number
224
- * @param idx logical index into io-channels property
225
- * @return the input cell in the specifier at index "idx"
226
- * @see DT_IO_CHANNELS_INPUT_BY_IDX()
164
+ * @brief Get IO channel's controller "input" at an index
165
+ * (see @ref DT_IO_CHANNELS_INPUT_BY_IDX)
166
+ * @param inst instance number
167
+ * @param idx logical index into the property
168
+ * @return the input value for the named specifier at index idx
227
169
*/
228
170
#define DT_INST_IO_CHANNELS_INPUT_BY_IDX (inst , idx ) \
229
171
DT_IO_CHANNELS_INPUT_BY_IDX(DT_DRV_INST(inst), idx)
230
172
231
173
/**
232
- * @brief Get an input cell from the "DT_DRV_INST(inst)" io-channels
233
- * property by name
234
- * @param inst DT_DRV_COMPAT instance number
235
- * @param name lowercase-and-underscores name of an io-channels element
236
- * as defined by the instance's io-channel-names property
237
- * @return the input cell in the specifier at the named element
238
- * @see DT_IO_CHANNELS_INPUT_BY_NAME()
174
+ * @brief Get IO channel's controller "input" by name
175
+ * (see @ref DT_IO_CHANNELS_INPUT_BY_NAME)
176
+ * @param inst instance number
177
+ * @param name lowercase-and-underscores "io_channel" name
178
+ * @return the input value for the named specifier at index idx
239
179
*/
240
180
#define DT_INST_IO_CHANNELS_INPUT_BY_NAME (inst , name ) \
241
181
DT_IO_CHANNELS_INPUT_BY_NAME(DT_DRV_INST(inst), name)
242
182
243
183
/**
244
- * @brief Equivalent to DT_INST_IO_CHANNELS_INPUT_BY_IDX (inst, 0)
245
- * @param inst DT_DRV_COMPAT instance number
246
- * @return the input cell in the specifier at index 0
184
+ * @brief Equivalent to DT_INST_IO_CHANNELS_INPUT (inst, 0)
185
+ * @param inst instance number
186
+ * @return the input property for the named specifier at index 0
247
187
*/
248
188
#define DT_INST_IO_CHANNELS_INPUT (inst ) DT_INST_IO_CHANNELS_INPUT_BY_IDX(inst, 0)
249
189
@@ -255,4 +195,5 @@ extern "C" {
255
195
}
256
196
#endif
257
197
198
+
258
199
#endif /* ZEPHYR_INCLUDE_DEVICETREE_ADC_H_ */
0 commit comments