status_led.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2000-2004
  4. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  5. */
  6. /*
  7. * The purpose of this code is to signal the operational status of a
  8. * target which usually boots over the network; while running in
  9. * PCBoot, a status LED is blinking. As soon as a valid BOOTP reply
  10. * message has been received, the LED is turned off. The Linux
  11. * kernel, once it is running, will start blinking the LED again,
  12. * with another frequency.
  13. */
  14. #ifndef _STATUS_LED_H_
  15. #define _STATUS_LED_H_
  16. #ifdef CONFIG_LED_STATUS
  17. #define LED_STATUS_PERIOD (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ)
  18. #ifdef CONFIG_LED_STATUS1
  19. #define LED_STATUS_PERIOD1 (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ1)
  20. #endif /* CONFIG_LED_STATUS1 */
  21. #ifdef CONFIG_LED_STATUS2
  22. #define LED_STATUS_PERIOD2 (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ2)
  23. #endif /* CONFIG_LED_STATUS2 */
  24. #ifdef CONFIG_LED_STATUS3
  25. #define LED_STATUS_PERIOD3 (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ3)
  26. #endif /* CONFIG_LED_STATUS3 */
  27. #ifdef CONFIG_LED_STATUS4
  28. #define LED_STATUS_PERIOD4 (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ4)
  29. #endif /* CONFIG_LED_STATUS4 */
  30. #ifdef CONFIG_LED_STATUS5
  31. #define LED_STATUS_PERIOD5 (CONFIG_SYS_HZ / CONFIG_LED_STATUS_FREQ5)
  32. #endif /* CONFIG_LED_STATUS5 */
  33. void status_led_init(void);
  34. void status_led_tick(unsigned long timestamp);
  35. void status_led_set(int led, int state);
  36. /***** MVS v1 **********************************************************/
  37. #if (defined(CONFIG_MVS) && CONFIG_MVS < 2)
  38. # define STATUS_LED_PAR im_ioport.iop_pdpar
  39. # define STATUS_LED_DIR im_ioport.iop_pddir
  40. # undef STATUS_LED_ODR
  41. # define STATUS_LED_DAT im_ioport.iop_pddat
  42. # define STATUS_LED_ACTIVE 1 /* LED on for bit == 1 */
  43. /***** Someone else defines these *************************************/
  44. #elif defined(STATUS_LED_PAR)
  45. /*
  46. * ADVICE: Define in your board configuration file rather than
  47. * filling this file up with lots of custom board stuff.
  48. */
  49. #elif defined(CONFIG_LED_STATUS_BOARD_SPECIFIC)
  50. /* led_id_t is unsigned long mask */
  51. typedef unsigned long led_id_t;
  52. extern void __led_toggle (led_id_t mask);
  53. extern void __led_init (led_id_t mask, int state);
  54. extern void __led_set (led_id_t mask, int state);
  55. void __led_blink(led_id_t mask, int freq);
  56. #else
  57. # error Status LED configuration missing
  58. #endif
  59. /************************************************************************/
  60. #ifndef CONFIG_LED_STATUS_BOARD_SPECIFIC
  61. # include <asm/status_led.h>
  62. #endif
  63. #endif /* CONFIG_LED_STATUS */
  64. /*
  65. * Coloured LEDs API
  66. */
  67. #ifndef __ASSEMBLY__
  68. void coloured_LED_init(void);
  69. void red_led_on(void);
  70. void red_led_off(void);
  71. void green_led_on(void);
  72. void green_led_off(void);
  73. void yellow_led_on(void);
  74. void yellow_led_off(void);
  75. void blue_led_on(void);
  76. void blue_led_off(void);
  77. #else
  78. .extern LED_init
  79. .extern red_led_on
  80. .extern red_led_off
  81. .extern yellow_led_on
  82. .extern yellow_led_off
  83. .extern green_led_on
  84. .extern green_led_off
  85. .extern blue_led_on
  86. .extern blue_led_off
  87. #endif
  88. #endif /* _STATUS_LED_H_ */