|
7 | 7 | #ifndef ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_GPIO_H_ |
8 | 8 | #define ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_GPIO_H_ |
9 | 9 |
|
| 10 | +/* |
| 11 | + * Assigned Bit Positions |
| 12 | + * |
| 13 | + * @note: This table is intended as a convenience to summarize the bit |
| 14 | + * assignments used in the fields defined below. The GPIO_foo_SHIFT |
| 15 | + * macros are the canonical definition. |
| 16 | + * |
| 17 | + * Bit Prefix Variations |
| 18 | + * ===== ============== ======================================================= |
| 19 | + * 0 GPIO_ACTIVE high or low |
| 20 | + * 1 GPIO_SIGNALING single-ended or push-pull |
| 21 | + * 2 GPIO_LINE source or drain |
| 22 | + * 3-4 GPIO_PUD pull normal/up/down |
| 23 | + * 5-8 GPIO_IO in, out, initialize, initial value |
| 24 | + * 9-13 GPIO_INT enable, level/edge, low, high, double-edge |
| 25 | + * 14 GPIO_POL polarity normal/invert |
| 26 | + * 15 GPIO_DEBOUNCE disable/enable |
| 27 | + * 16-17 GPIO_DS_LOW drive strength for output low: default/low/high/discon |
| 28 | + * 18-19 GPIO_DS_HIGH drive strength for output high: default/low/high/discon |
| 29 | + */ |
| 30 | + |
10 | 31 | /** |
11 | 32 | * @name GPIO active level indicator. |
12 | 33 | * |
|
324 | 345 | * The drive strength of individual pins can be configured |
325 | 346 | * independently for when the pin output is low and high. |
326 | 347 | * |
327 | | - * The `GPIO_DS_*_LOW` enumerations define the drive strength of a pin |
| 348 | + * The `GPIO_DS_*_LOW` bits define the drive strength of a pin |
328 | 349 | * when output is low. |
329 | | -
|
330 | | - * The `GPIO_DS_*_HIGH` enumerations define the drive strength of a pin |
| 350 | + * |
| 351 | + * The `GPIO_DS_*_HIGH` bits define the drive strength of a pin |
331 | 352 | * when output is high. |
332 | 353 | * |
333 | | - * The `DISCONNECT` drive strength indicates that the pin is placed in a |
334 | | - * high impedance state and not driven, this option is used to |
335 | | - * configure hardware that supports a open collector drive mode. |
| 354 | + * If the device does not distinguish drive strength by signal level, |
| 355 | + * the drive strength configuration from `GPIO_DS_*_LOW` shall be |
| 356 | + * used. |
336 | 357 | * |
337 | | - * The interface supports two different drive strengths: |
338 | | - * `DFLT` - The lowest drive strength supported by the HW |
339 | | - * `ALT` - The highest drive strength supported by the HW |
| 358 | + * The interface supports several drive strengths: |
| 359 | + * `LO` - The lowest drive strength supported by the HW |
| 360 | + * `HI` - The highest drive strength supported by the HW |
| 361 | + * `DISCONNECT` - The pin is placed in a high impedance state and not |
| 362 | + * driven (open drain mode) |
340 | 363 | * |
341 | | - * On hardware that supports only one standard drive strength, both |
342 | | - * `DFLT` and `ALT` have the same behavior. |
| 364 | + * In addition `DFLT` represents the default drive strength for a |
| 365 | + * particular driver, and may be either `LO` or `HI`. |
| 366 | + * |
| 367 | + * On hardware that supports only one standard drive strength `LO` and |
| 368 | + * `HI` have the same behavior. |
343 | 369 | * |
344 | 370 | * On hardware that does not support a disconnect mode, `DISCONNECT` |
345 | 371 | * will behave the same as `DFLT`. |
346 | 372 | * |
347 | 373 | * @{ |
348 | 374 | */ |
349 | 375 | /** @cond INTERNAL_HIDDEN */ |
350 | | -#define GPIO_DS_LOW_POS 16 |
351 | | -#define GPIO_DS_LOW_MASK (3 << GPIO_DS_LOW_POS) |
| 376 | +#define GPIO_DS_LOW_SHIFT 16 |
| 377 | +#define GPIO_DS_LOW_MASK (3 << GPIO_DS_LOW_SHIFT) |
352 | 378 | /** @endcond */ |
353 | 379 |
|
354 | | -/** Default drive strength standard when GPIO pin output is low. |
355 | | - */ |
356 | | -#define GPIO_DS_DFLT_LOW (0 << GPIO_DS_LOW_POS) |
| 380 | +/** Use default drive strength when GPIO pin output is low. */ |
| 381 | +#define GPIO_DS_DFLT_LOW (0 << GPIO_DS_LOW_SHIFT) |
357 | 382 |
|
358 | | -/** Alternative drive strength when GPIO pin output is low. |
359 | | - * For hardware that does not support configurable drive strength |
360 | | - * use the default drive strength. |
361 | | - */ |
362 | | -#define GPIO_DS_ALT_LOW (1 << GPIO_DS_LOW_POS) |
| 383 | +/** Use low/reduced drive strength when GPIO pin output is low. */ |
| 384 | +#define GPIO_DS_LO_LOW (1 << GPIO_DS_LOW_SHIFT) |
| 385 | + |
| 386 | +/** Use high/increased drive strength when GPIO pin output is low. */ |
| 387 | +#define GPIO_DS_HI_LOW (2 << GPIO_DS_LOW_SHIFT) |
363 | 388 |
|
364 | 389 | /** Disconnect pin when GPIO pin output is low. |
365 | 390 | * For hardware that does not support disconnect use the default |
366 | 391 | * drive strength. |
367 | 392 | */ |
368 | | -#define GPIO_DS_DISCONNECT_LOW (3 << GPIO_DS_LOW_POS) |
| 393 | +#define GPIO_DS_DISCONNECT_LOW (3 << GPIO_DS_LOW_SHIFT) |
369 | 394 |
|
370 | 395 | /** @cond INTERNAL_HIDDEN */ |
371 | | -#define GPIO_DS_HIGH_POS 18 |
372 | | -#define GPIO_DS_HIGH_MASK (3 << GPIO_DS_HIGH_POS) |
| 396 | +#define GPIO_DS_HIGH_SHIFT 18 |
| 397 | +#define GPIO_DS_HIGH_MASK (3 << GPIO_DS_HIGH_SHIFT) |
373 | 398 | /** @endcond */ |
374 | 399 |
|
375 | | -/** Default drive strength when GPIO pin output is high. */ |
376 | | -#define GPIO_DS_DFLT_HIGH (0 << GPIO_DS_HIGH_POS) |
| 400 | +/** Use default drive strength when GPIO pin output is low. */ |
| 401 | +#define GPIO_DS_DFLT_HIGH (0 << GPIO_DS_HIGH_SHIFT) |
377 | 402 |
|
378 | | -/** Alternative drive strength when GPIO pin output is high. |
379 | | - * For hardware that does not support configurable drive strengths |
380 | | - * use the default drive strength. |
381 | | - */ |
382 | | -#define GPIO_DS_ALT_HIGH (1 << GPIO_DS_HIGH_POS) |
| 403 | +/** Use low/reduced drive strength when GPIO pin output is low. */ |
| 404 | +#define GPIO_DS_LO_HIGH (1 << GPIO_DS_HIGH_SHIFT) |
| 405 | + |
| 406 | +/** Use high/increased drive strength when GPIO pin output is low. */ |
| 407 | +#define GPIO_DS_HI_HIGH (2 << GPIO_DS_HIGH_SHIFT) |
383 | 408 |
|
384 | | -/** Disconnect pin when GPIO pin output is high. |
| 409 | +/** Disconnect pin when GPIO pin output is low. |
385 | 410 | * For hardware that does not support disconnect use the default |
386 | 411 | * drive strength. |
387 | 412 | */ |
388 | | -#define GPIO_DS_DISCONNECT_HIGH (3 << GPIO_DS_HIGH_POS) |
| 413 | +#define GPIO_DS_DISCONNECT_HIGH (3 << GPIO_DS_HIGH_SHIFT) |
389 | 414 |
|
390 | 415 | /** @} */ |
391 | 416 |
|
|
443 | 468 | */ |
444 | 469 | #define GPIO_INT GPIO_INT_ENABLE |
445 | 470 |
|
| 471 | +/** Legacy alias identifying high drive strength when GPIO output is |
| 472 | + * low. |
| 473 | + * |
| 474 | + * @deprecated Replace with `GPIO_DS_HI_LOW` |
| 475 | + */ |
| 476 | +#define GPIO_DS_ALT_LOW GPIO_DS_HI_LOW |
| 477 | + |
| 478 | +/** Legacy alias identifying high drive strength when GPIO output is |
| 479 | + * high. |
| 480 | + * |
| 481 | + * @deprecated Replace with `GPIO_DS_HI_HIGH` |
| 482 | + */ |
| 483 | +#define GPIO_DS_ALT_HIGH GPIO_DS_HI_HIGH |
| 484 | + |
446 | 485 | /** @} */ |
447 | 486 |
|
448 | 487 | #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_GPIO_GPIO_H_ */ |
0 commit comments