1 /** 2 * @file 3 * @brief PWMs Devicetree macro public API header file. 4 */ 5 6 /* 7 * Copyright (c) 2020, Linaro Ltd. 8 * 9 * SPDX-License-Identifier: Apache-2.0 10 */ 11 12 #ifndef ZEPHYR_INCLUDE_DEVICETREE_PWMS_H_ 13 #define ZEPHYR_INCLUDE_DEVICETREE_PWMS_H_ 14 15 #ifdef __cplusplus 16 extern "C" { 17 #endif 18 19 /** 20 * @defgroup devicetree-pwms Devicetree PWMs API 21 * @ingroup devicetree 22 * @{ 23 */ 24 25 /** 26 * @brief Get a label property from a pwms property at an index 27 * 28 * It's an error if the PWM controller node referenced by the phandle 29 * in node_id's pwms property at index "idx" has no label property. 30 * 31 * Example devicetree fragment: 32 * 33 * pwm1: pwm-controller@... { 34 * label = "PWM_1"; 35 * }; 36 * 37 * pwm2: pwm-controller@... { 38 * label = "PWM_2"; 39 * }; 40 * 41 * n: node { 42 * pwms = <&pwm1 1 PWM_POLARITY_NORMAL>, 43 * <&pwm2 3 PWM_POLARITY_INVERTED>; 44 * }; 45 * 46 * Example usage: 47 * 48 * DT_PWMS_LABEL_BY_IDX(DT_NODELABEL(n), 0) // "PWM_1" 49 * DT_PWMS_LABEL_BY_IDX(DT_NODELABEL(n), 1) // "PWM_2" 50 * 51 * @param node_id node identifier for a node with a pwms property 52 * @param idx logical index into pwms property 53 * @return the label property of the node referenced at index "idx" 54 * @see DT_PROP_BY_PHANDLE_IDX() 55 */ 56 #define DT_PWMS_LABEL_BY_IDX(node_id, idx) \ 57 __DEPRECATED_MACRO \ 58 DT_PROP_BY_PHANDLE_IDX(node_id, pwms, idx, label) 59 60 /** 61 * @brief Get a label property from a pwms property by name 62 * 63 * It's an error if the PWM controller node referenced by the 64 * phandle in node_id's pwms property at the element named "name" 65 * has no label property. 66 * 67 * Example devicetree fragment: 68 * 69 * pwm1: pwm-controller@... { 70 * label = "PWM_1"; 71 * }; 72 * 73 * pwm2: pwm-controller@... { 74 * label = "PWM_2"; 75 * }; 76 * 77 * n: node { 78 * pwms = <&pwm1 1 PWM_POLARITY_NORMAL>, 79 * <&pwm2 3 PWM_POLARITY_INVERTED>; 80 * pwm-names = "alpha", "beta"; 81 * }; 82 * 83 * Example usage: 84 * 85 * DT_PWMS_LABEL_BY_NAME(DT_NODELABEL(n), alpha) // "PWM_1" 86 * DT_PWMS_LABEL_BY_NAME(DT_NODELABEL(n), beta) // "PWM_2" 87 * 88 * @param node_id node identifier for a node with a pwms property 89 * @param name lowercase-and-underscores name of a pwms element 90 * as defined by the node's pwm-names property 91 * @return the label property of the node referenced at the named element 92 * @see DT_PHANDLE_BY_NAME() 93 */ 94 #define DT_PWMS_LABEL_BY_NAME(node_id, name) \ 95 __DEPRECATED_MACRO \ 96 DT_PROP(DT_PHANDLE_BY_NAME(node_id, pwms, name), label) 97 98 /** 99 * @brief Equivalent to DT_PWMS_LABEL_BY_IDX(node_id, 0) 100 * @param node_id node identifier for a node with a pwms property 101 * @return the label property of the node referenced at index 0 102 * @see DT_PWMS_LABEL_BY_IDX() 103 */ 104 #define DT_PWMS_LABEL(node_id) __DEPRECATED_MACRO DT_PWMS_LABEL_BY_IDX(node_id, 0) 105 106 /** 107 * @brief Get the node identifier for the PWM controller from a 108 * pwms property at an index 109 * 110 * Example devicetree fragment: 111 * 112 * pwm1: pwm-controller@... { ... }; 113 * 114 * pwm2: pwm-controller@... { ... }; 115 * 116 * n: node { 117 * pwms = <&pwm1 1 PWM_POLARITY_NORMAL>, 118 * <&pwm2 3 PWM_POLARITY_INVERTED>; 119 * }; 120 * 121 * Example usage: 122 * 123 * DT_PWMS_CTLR_BY_IDX(DT_NODELABEL(n), 0) // DT_NODELABEL(pwm1) 124 * DT_PWMS_CTLR_BY_IDX(DT_NODELABEL(n), 1) // DT_NODELABEL(pwm2) 125 * 126 * @param node_id node identifier for a node with a pwms property 127 * @param idx logical index into pwms property 128 * @return the node identifier for the PWM controller referenced at 129 * index "idx" 130 * @see DT_PROP_BY_PHANDLE_IDX() 131 */ 132 #define DT_PWMS_CTLR_BY_IDX(node_id, idx) \ 133 DT_PHANDLE_BY_IDX(node_id, pwms, idx) 134 135 /** 136 * @brief Get the node identifier for the PWM controller from a 137 * pwms property by name 138 * 139 * Example devicetree fragment: 140 * 141 * pwm1: pwm-controller@... { ... }; 142 * 143 * pwm2: pwm-controller@... { ... }; 144 * 145 * n: node { 146 * pwms = <&pwm1 1 PWM_POLARITY_NORMAL>, 147 * <&pwm2 3 PWM_POLARITY_INVERTED>; 148 * pwm-names = "alpha", "beta"; 149 * }; 150 * 151 * Example usage: 152 * 153 * DT_PWMS_CTLR_BY_NAME(DT_NODELABEL(n), alpha) // DT_NODELABEL(pwm1) 154 * DT_PWMS_CTLR_BY_NAME(DT_NODELABEL(n), beta) // DT_NODELABEL(pwm2) 155 * 156 * @param node_id node identifier for a node with a pwms property 157 * @param name lowercase-and-underscores name of a pwms element 158 * as defined by the node's pwm-names property 159 * @return the node identifier for the PWM controller in the named element 160 * @see DT_PHANDLE_BY_NAME() 161 */ 162 #define DT_PWMS_CTLR_BY_NAME(node_id, name) \ 163 DT_PHANDLE_BY_NAME(node_id, pwms, name) 164 165 /** 166 * @brief Equivalent to DT_PWMS_CTLR_BY_IDX(node_id, 0) 167 * @param node_id node identifier for a node with a pwms property 168 * @return the node identifier for the PWM controller at index 0 169 * in the node's "pwms" property 170 * @see DT_PWMS_CTLR_BY_IDX() 171 */ 172 #define DT_PWMS_CTLR(node_id) DT_PWMS_CTLR_BY_IDX(node_id, 0) 173 174 /** 175 * @brief Get PWM specifier's cell value at an index 176 * 177 * Example devicetree fragment: 178 * 179 * pwm1: pwm-controller@... { 180 * compatible = "vnd,pwm"; 181 * label = "PWM_1"; 182 * #pwm-cells = <2>; 183 * }; 184 * 185 * pwm2: pwm-controller@... { 186 * compatible = "vnd,pwm"; 187 * label = "PWM_2"; 188 * #pwm-cells = <2>; 189 * }; 190 * 191 * n: node { 192 * pwms = <&pwm1 1 200000 PWM_POLARITY_NORMAL>, 193 * <&pwm2 3 100000 PWM_POLARITY_INVERTED>; 194 * }; 195 * 196 * Bindings fragment for the "vnd,pwm" compatible: 197 * 198 * pwm-cells: 199 * - channel 200 * - period 201 * - flags 202 * 203 * Example usage: 204 * 205 * DT_PWMS_CELL_BY_IDX(DT_NODELABEL(n), 0, channel) // 1 206 * DT_PWMS_CELL_BY_IDX(DT_NODELABEL(n), 1, channel) // 3 207 * DT_PWMS_CELL_BY_IDX(DT_NODELABEL(n), 0, period) // 200000 208 * DT_PWMS_CELL_BY_IDX(DT_NODELABEL(n), 1, period) // 100000 209 * DT_PWMS_CELL_BY_IDX(DT_NODELABEL(n), 0, flags) // PWM_POLARITY_NORMAL 210 * DT_PWMS_CELL_BY_IDX(DT_NODELABEL(n), 1, flags) // PWM_POLARITY_INVERTED 211 * 212 * @param node_id node identifier for a node with a pwms property 213 * @param idx logical index into pwms property 214 * @param cell lowercase-and-underscores cell name 215 * @return the cell value at index "idx" 216 * @see DT_PHA_BY_IDX() 217 */ 218 #define DT_PWMS_CELL_BY_IDX(node_id, idx, cell) \ 219 DT_PHA_BY_IDX(node_id, pwms, idx, cell) 220 221 /** 222 * @brief Get a PWM specifier's cell value by name 223 * 224 * Example devicetree fragment: 225 * 226 * pwm1: pwm-controller@... { 227 * compatible = "vnd,pwm"; 228 * label = "PWM_1"; 229 * #pwm-cells = <2>; 230 * }; 231 * 232 * pwm2: pwm-controller@... { 233 * compatible = "vnd,pwm"; 234 * label = "PWM_2"; 235 * #pwm-cells = <2>; 236 * }; 237 * 238 * n: node { 239 * pwms = <&pwm1 1 200000 PWM_POLARITY_NORMAL>, 240 * <&pwm2 3 100000 PWM_POLARITY_INVERTED>; 241 * pwm-names = "alpha", "beta"; 242 * }; 243 * 244 * Bindings fragment for the "vnd,pwm" compatible: 245 * 246 * pwm-cells: 247 * - channel 248 * - period 249 * - flags 250 * 251 * Example usage: 252 * 253 * DT_PWMS_CELL_BY_NAME(DT_NODELABEL(n), alpha, channel) // 1 254 * DT_PWMS_CELL_BY_NAME(DT_NODELABEL(n), beta, channel) // 3 255 * DT_PWMS_CELL_BY_NAME(DT_NODELABEL(n), alpha, period) // 200000 256 * DT_PWMS_CELL_BY_NAME(DT_NODELABEL(n), beta, period) // 100000 257 * DT_PWMS_CELL_BY_NAME(DT_NODELABEL(n), alpha, flags) // PWM_POLARITY_NORMAL 258 * DT_PWMS_CELL_BY_NAME(DT_NODELABEL(n), beta, flags) // PWM_POLARITY_INVERTED 259 * 260 * @param node_id node identifier for a node with a pwms property 261 * @param name lowercase-and-underscores name of a pwms element 262 * as defined by the node's pwm-names property 263 * @param cell lowercase-and-underscores cell name 264 * @return the cell value in the specifier at the named element 265 * @see DT_PHA_BY_NAME() 266 */ 267 #define DT_PWMS_CELL_BY_NAME(node_id, name, cell) \ 268 DT_PHA_BY_NAME(node_id, pwms, name, cell) 269 270 /** 271 * @brief Equivalent to DT_PWMS_CELL_BY_IDX(node_id, 0, cell) 272 * @param node_id node identifier for a node with a pwms property 273 * @param cell lowercase-and-underscores cell name 274 * @return the cell value at index 0 275 * @see DT_PWMS_CELL_BY_IDX() 276 */ 277 #define DT_PWMS_CELL(node_id, cell) DT_PWMS_CELL_BY_IDX(node_id, 0, cell) 278 279 /** 280 * @brief Get a PWM specifier's channel cell value at an index 281 * 282 * This macro only works for PWM specifiers with cells named "channel". 283 * Refer to the node's binding to check if necessary. 284 * 285 * This is equivalent to DT_PWMS_CELL_BY_IDX(node_id, idx, channel). 286 * 287 * @param node_id node identifier for a node with a pwms property 288 * @param idx logical index into pwms property 289 * @return the channel cell value at index "idx" 290 * @see DT_PWMS_CELL_BY_IDX() 291 */ 292 #define DT_PWMS_CHANNEL_BY_IDX(node_id, idx) \ 293 DT_PWMS_CELL_BY_IDX(node_id, idx, channel) 294 295 /** 296 * @brief Get a PWM specifier's channel cell value by name 297 * 298 * This macro only works for PWM specifiers with cells named "channel". 299 * Refer to the node's binding to check if necessary. 300 * 301 * This is equivalent to DT_PWMS_CELL_BY_NAME(node_id, name, channel). 302 * 303 * @param node_id node identifier for a node with a pwms property 304 * @param name lowercase-and-underscores name of a pwms element 305 * as defined by the node's pwm-names property 306 * @return the channel cell value in the specifier at the named element 307 * @see DT_PWMS_CELL_BY_NAME() 308 */ 309 #define DT_PWMS_CHANNEL_BY_NAME(node_id, name) \ 310 DT_PWMS_CELL_BY_NAME(node_id, name, channel) 311 312 /** 313 * @brief Equivalent to DT_PWMS_CHANNEL_BY_IDX(node_id, 0) 314 * @param node_id node identifier for a node with a pwms property 315 * @return the channel cell value at index 0 316 * @see DT_PWMS_CHANNEL_BY_IDX() 317 */ 318 #define DT_PWMS_CHANNEL(node_id) DT_PWMS_CHANNEL_BY_IDX(node_id, 0) 319 320 /** 321 * @brief Get PWM specifier's period cell value at an index 322 * 323 * This macro only works for PWM specifiers with cells named "period". 324 * Refer to the node's binding to check if necessary. 325 * 326 * This is equivalent to DT_PWMS_CELL_BY_IDX(node_id, idx, period). 327 * 328 * @param node_id node identifier for a node with a pwms property 329 * @param idx logical index into pwms property 330 * @return the period cell value at index "idx" 331 * @see DT_PWMS_CELL_BY_IDX() 332 */ 333 #define DT_PWMS_PERIOD_BY_IDX(node_id, idx) \ 334 DT_PWMS_CELL_BY_IDX(node_id, idx, period) 335 336 /** 337 * @brief Get a PWM specifier's period cell value by name 338 * 339 * This macro only works for PWM specifiers with cells named "period". 340 * Refer to the node's binding to check if necessary. 341 * 342 * This is equivalent to DT_PWMS_CELL_BY_NAME(node_id, name, period). 343 * 344 * @param node_id node identifier for a node with a pwms property 345 * @param name lowercase-and-underscores name of a pwms element 346 * as defined by the node's pwm-names property 347 * @return the period cell value in the specifier at the named element 348 * @see DT_PWMS_CELL_BY_NAME() 349 */ 350 #define DT_PWMS_PERIOD_BY_NAME(node_id, name) \ 351 DT_PWMS_CELL_BY_NAME(node_id, name, period) 352 353 /** 354 * @brief Equivalent to DT_PWMS_PERIOD_BY_IDX(node_id, 0) 355 * @param node_id node identifier for a node with a pwms property 356 * @return the period cell value at index 0 357 * @see DT_PWMS_PERIOD_BY_IDX() 358 */ 359 #define DT_PWMS_PERIOD(node_id) DT_PWMS_PERIOD_BY_IDX(node_id, 0) 360 361 /** 362 * @brief Get a PWM specifier's flags cell value at an index 363 * 364 * This macro expects PWM specifiers with cells named "flags". 365 * If there is no "flags" cell in the PWM specifier, zero is returned. 366 * Refer to the node's binding to check specifier cell names if necessary. 367 * 368 * This is equivalent to DT_PWMS_CELL_BY_IDX(node_id, idx, flags). 369 * 370 * @param node_id node identifier for a node with a pwms property 371 * @param idx logical index into pwms property 372 * @return the flags cell value at index "idx", or zero if there is none 373 * @see DT_PWMS_CELL_BY_IDX() 374 */ 375 #define DT_PWMS_FLAGS_BY_IDX(node_id, idx) \ 376 DT_PHA_BY_IDX_OR(node_id, pwms, idx, flags, 0) 377 378 /** 379 * @brief Get a PWM specifier's flags cell value by name 380 * 381 * This macro expects PWM specifiers with cells named "flags". 382 * If there is no "flags" cell in the PWM specifier, zero is returned. 383 * Refer to the node's binding to check specifier cell names if necessary. 384 * 385 * This is equivalent to DT_PWMS_CELL_BY_NAME(node_id, name, flags) if 386 * there is a flags cell, but expands to zero if there is none. 387 * 388 * @param node_id node identifier for a node with a pwms property 389 * @param name lowercase-and-underscores name of a pwms element 390 * as defined by the node's pwm-names property 391 * @return the flags cell value in the specifier at the named element, 392 * or zero if there is none 393 * @see DT_PWMS_CELL_BY_NAME() 394 */ 395 #define DT_PWMS_FLAGS_BY_NAME(node_id, name) \ 396 DT_PHA_BY_NAME_OR(node_id, pwms, name, flags, 0) 397 398 /** 399 * @brief Equivalent to DT_PWMS_FLAGS_BY_IDX(node_id, 0) 400 * @param node_id node identifier for a node with a pwms property 401 * @return the flags cell value at index 0, or zero if there is none 402 * @see DT_PWMS_FLAGS_BY_IDX() 403 */ 404 #define DT_PWMS_FLAGS(node_id) DT_PWMS_FLAGS_BY_IDX(node_id, 0) 405 406 /** 407 * @brief Get a label property from a DT_DRV_COMPAT instance's pwms 408 * property by name 409 * @param inst DT_DRV_COMPAT instance number 410 * @param idx logical index into pwms property 411 * @return the label property of the node referenced at index "idx" 412 * @see DT_PWMS_LABEL_BY_IDX() 413 */ 414 #define DT_INST_PWMS_LABEL_BY_IDX(inst, idx) \ 415 __DEPRECATED_MACRO \ 416 DT_PWMS_LABEL_BY_IDX(DT_DRV_INST(inst), idx) 417 418 /** 419 * @brief Get a label property from a DT_DRV_COMPAT instance's pwms 420 * property by name 421 * @param inst DT_DRV_COMPAT instance number 422 * @param name lowercase-and-underscores name of a pwms element 423 * as defined by the node's pwm-names property 424 * @return the label property of the node referenced at the named element 425 * @see DT_PWMS_LABEL_BY_NAME() 426 */ 427 #define DT_INST_PWMS_LABEL_BY_NAME(inst, name) \ 428 __DEPRECATED_MACRO \ 429 DT_PWMS_LABEL_BY_NAME(DT_DRV_INST(inst), name) 430 431 /** 432 * @brief Equivalent to DT_INST_PWMS_LABEL_BY_IDX(inst, 0) 433 * @param inst DT_DRV_COMPAT instance number 434 * @return the label property of the node referenced at index 0 435 * @see DT_PWMS_LABEL_BY_IDX() 436 */ 437 #define DT_INST_PWMS_LABEL(inst) __DEPRECATED_MACRO DT_INST_PWMS_LABEL_BY_IDX(inst, 0) 438 439 /** 440 * @brief Get the node identifier for the PWM controller from a 441 * DT_DRV_COMPAT instance's pwms property at an index 442 * 443 * @param inst DT_DRV_COMPAT instance number 444 * @param idx logical index into pwms property 445 * @return the node identifier for the PWM controller referenced at 446 * index "idx" 447 * @see DT_PWMS_CTLR_BY_IDX() 448 */ 449 #define DT_INST_PWMS_CTLR_BY_IDX(inst, idx) \ 450 DT_PWMS_CTLR_BY_IDX(DT_DRV_INST(inst), idx) 451 452 /** 453 * @brief Get the node identifier for the PWM controller from a 454 * DT_DRV_COMPAT instance's pwms property by name 455 * @param inst DT_DRV_COMPAT instance number 456 * @param name lowercase-and-underscores name of a pwms element 457 * as defined by the node's pwm-names property 458 * @return the node identifier for the PWM controller in the named element 459 * @see DT_PWMS_CTLR_BY_NAME() 460 */ 461 #define DT_INST_PWMS_CTLR_BY_NAME(inst, name) \ 462 DT_PWMS_CTLR_BY_NAME(DT_DRV_INST(inst), name) 463 464 /** 465 * @brief Equivalent to DT_INST_PWMS_CTLR_BY_IDX(inst, 0) 466 * @param inst DT_DRV_COMPAT instance number 467 * @return the node identifier for the PWM controller at index 0 468 * in the instance's "pwms" property 469 * @see DT_PWMS_CTLR_BY_IDX() 470 */ 471 #define DT_INST_PWMS_CTLR(inst) DT_INST_PWMS_CTLR_BY_IDX(inst, 0) 472 473 /** 474 * @brief Get a DT_DRV_COMPAT instance's PWM specifier's cell value 475 * at an index 476 * @param inst DT_DRV_COMPAT instance number 477 * @param idx logical index into pwms property 478 * @param cell lowercase-and-underscores cell name 479 * @return the cell value at index "idx" 480 */ 481 #define DT_INST_PWMS_CELL_BY_IDX(inst, idx, cell) \ 482 DT_PWMS_CELL_BY_IDX(DT_DRV_INST(inst), idx, cell) 483 484 /** 485 * @brief Get a DT_DRV_COMPAT instance's PWM specifier's cell value by name 486 * @param inst DT_DRV_COMPAT instance number 487 * @param name lowercase-and-underscores name of a pwms element 488 * as defined by the node's pwm-names property 489 * @param cell lowercase-and-underscores cell name 490 * @return the cell value in the specifier at the named element 491 * @see DT_PWMS_CELL_BY_NAME() 492 */ 493 #define DT_INST_PWMS_CELL_BY_NAME(inst, name, cell) \ 494 DT_PWMS_CELL_BY_NAME(DT_DRV_INST(inst), name, cell) 495 496 /** 497 * @brief Equivalent to DT_INST_PWMS_CELL_BY_IDX(inst, 0, cell) 498 * @param inst DT_DRV_COMPAT instance number 499 * @param cell lowercase-and-underscores cell name 500 * @return the cell value at index 0 501 */ 502 #define DT_INST_PWMS_CELL(inst, cell) \ 503 DT_INST_PWMS_CELL_BY_IDX(inst, 0, cell) 504 505 /** 506 * @brief Equivalent to DT_INST_PWMS_CELL_BY_IDX(inst, idx, channel) 507 * @param inst DT_DRV_COMPAT instance number 508 * @param idx logical index into pwms property 509 * @return the channel cell value at index "idx" 510 * @see DT_INST_PWMS_CELL_BY_IDX() 511 */ 512 #define DT_INST_PWMS_CHANNEL_BY_IDX(inst, idx) \ 513 DT_INST_PWMS_CELL_BY_IDX(inst, idx, channel) 514 515 /** 516 * @brief Equivalent to DT_INST_PWMS_CELL_BY_NAME(inst, name, channel) 517 * @param inst DT_DRV_COMPAT instance number 518 * @param name lowercase-and-underscores name of a pwms element 519 * as defined by the node's pwm-names property 520 * @return the channel cell value in the specifier at the named element 521 * @see DT_INST_PWMS_CELL_BY_NAME() 522 */ 523 #define DT_INST_PWMS_CHANNEL_BY_NAME(inst, name) \ 524 DT_INST_PWMS_CELL_BY_NAME(inst, name, channel) 525 526 /** 527 * @brief Equivalent to DT_INST_PWMS_CHANNEL_BY_IDX(inst, 0) 528 * @param inst DT_DRV_COMPAT instance number 529 * @return the channel cell value at index 0 530 * @see DT_INST_PWMS_CHANNEL_BY_IDX() 531 */ 532 #define DT_INST_PWMS_CHANNEL(inst) DT_INST_PWMS_CHANNEL_BY_IDX(inst, 0) 533 534 /** 535 * @brief Equivalent to DT_INST_PWMS_CELL_BY_IDX(inst, idx, period) 536 * @param inst DT_DRV_COMPAT instance number 537 * @param idx logical index into pwms property 538 * @return the period cell value at index "idx" 539 * @see DT_INST_PWMS_CELL_BY_IDX() 540 */ 541 #define DT_INST_PWMS_PERIOD_BY_IDX(inst, idx) \ 542 DT_INST_PWMS_CELL_BY_IDX(inst, idx, period) 543 544 /** 545 * @brief Equivalent to DT_INST_PWMS_CELL_BY_NAME(inst, name, period) 546 * @param inst DT_DRV_COMPAT instance number 547 * @param name lowercase-and-underscores name of a pwms element 548 * as defined by the node's pwm-names property 549 * @return the period cell value in the specifier at the named element 550 * @see DT_INST_PWMS_CELL_BY_NAME() 551 */ 552 #define DT_INST_PWMS_PERIOD_BY_NAME(inst, name) \ 553 DT_INST_PWMS_CELL_BY_NAME(inst, name, period) 554 555 /** 556 * @brief Equivalent to DT_INST_PWMS_PERIOD_BY_IDX(inst, 0) 557 * @param inst DT_DRV_COMPAT instance number 558 * @return the period cell value at index 0 559 * @see DT_INST_PWMS_PERIOD_BY_IDX() 560 */ 561 #define DT_INST_PWMS_PERIOD(inst) DT_INST_PWMS_PERIOD_BY_IDX(inst, 0) 562 563 /** 564 * @brief Equivalent to DT_INST_PWMS_CELL_BY_IDX(inst, idx, flags) 565 * @param inst DT_DRV_COMPAT instance number 566 * @param idx logical index into pwms property 567 * @return the flags cell value at index "idx", or zero if there is none 568 * @see DT_INST_PWMS_CELL_BY_IDX() 569 */ 570 #define DT_INST_PWMS_FLAGS_BY_IDX(inst, idx) \ 571 DT_INST_PWMS_CELL_BY_IDX(inst, idx, flags) 572 573 /** 574 * @brief Equivalent to DT_INST_PWMS_CELL_BY_NAME(inst, name, flags) 575 * @param inst DT_DRV_COMPAT instance number 576 * @param name lowercase-and-underscores name of a pwms element 577 * as defined by the node's pwm-names property 578 * @return the flags cell value in the specifier at the named element, 579 * or zero if there is none 580 * @see DT_INST_PWMS_CELL_BY_NAME() 581 */ 582 #define DT_INST_PWMS_FLAGS_BY_NAME(inst, name) \ 583 DT_INST_PWMS_CELL_BY_NAME(inst, name, flags) 584 585 /** 586 * @brief Equivalent to DT_INST_PWMS_FLAGS_BY_IDX(inst, 0) 587 * @param inst DT_DRV_COMPAT instance number 588 * @return the flags cell value at index 0, or zero if there is none 589 * @see DT_INST_PWMS_FLAGS_BY_IDX() 590 */ 591 #define DT_INST_PWMS_FLAGS(inst) DT_INST_PWMS_FLAGS_BY_IDX(inst, 0) 592 593 /** 594 * @} 595 */ 596 597 #ifdef __cplusplus 598 } 599 #endif 600 601 #endif /* ZEPHYR_INCLUDE_DEVICETREE_PWMS_H_ */ 602