Tom Rix | c36db31 | 2009-05-15 23:47:12 +0200 | [diff] [blame] | 1 | Status LED |
| 2 | ======================================== |
| 3 | |
| 4 | This README describes the status LED API. |
| 5 | |
| 6 | The API is defined by the include file include/status_led.h |
| 7 | |
Uri Mashiach | 3dc6f65 | 2017-01-19 10:51:05 +0200 | [diff] [blame] | 8 | The first step is to enable CONFIG_LED_STATUS in menuconfig: |
| 9 | > Device Drivers > LED Support. |
Tom Rix | c36db31 | 2009-05-15 23:47:12 +0200 | [diff] [blame] | 10 | |
Uri Mashiach | 3dc6f65 | 2017-01-19 10:51:05 +0200 | [diff] [blame] | 11 | If the LED support is only for specific board, enable |
| 12 | CONFIG_LED_STATUS_BOARD_SPECIFIC in the menuconfig. |
Tom Rix | c36db31 | 2009-05-15 23:47:12 +0200 | [diff] [blame] | 13 | |
Uri Mashiach | 3dc6f65 | 2017-01-19 10:51:05 +0200 | [diff] [blame] | 14 | Status LEDS 0 to 5 are enabled by the following configurations at menuconfig: |
| 15 | CONFIG_STATUS_LED0, CONFIG_STATUS_LED1, ... CONFIG_STATUS_LED5 |
Tom Rix | c36db31 | 2009-05-15 23:47:12 +0200 | [diff] [blame] | 16 | |
Uri Mashiach | 3dc6f65 | 2017-01-19 10:51:05 +0200 | [diff] [blame] | 17 | The following should be configured for each of the enabled LEDs: |
| 18 | CONFIG_STATUS_LED_BIT<n> |
| 19 | CONFIG_STATUS_LED_STATE<n> |
| 20 | CONFIG_STATUS_LED_FREQ<n> |
| 21 | Where <n> is an integer 1 through 5 (empty for 0). |
Tom Rix | c36db31 | 2009-05-15 23:47:12 +0200 | [diff] [blame] | 22 | |
Uri Mashiach | 3dc6f65 | 2017-01-19 10:51:05 +0200 | [diff] [blame] | 23 | CONFIG_STATUS_LED_BIT is passed into the __led_* functions to identify which LED |
| 24 | is being acted on. As such, the value choose must be unique with with respect to |
| 25 | the other CONFIG_STATUS_LED_BIT's. Mapping the value to a physical LED is the |
Tom Rix | c36db31 | 2009-05-15 23:47:12 +0200 | [diff] [blame] | 26 | reponsiblity of the __led_* function. |
| 27 | |
Uri Mashiach | 3dc6f65 | 2017-01-19 10:51:05 +0200 | [diff] [blame] | 28 | CONFIG_STATUS_LED_STATE is the initial state of the LED. It should be set to one |
| 29 | of these values: CONFIG_LED_STATUS_OFF or CONFIG_LED_STATUS_ON. |
Tom Rix | c36db31 | 2009-05-15 23:47:12 +0200 | [diff] [blame] | 30 | |
Uri Mashiach | 3dc6f65 | 2017-01-19 10:51:05 +0200 | [diff] [blame] | 31 | CONFIG_STATUS_LED_FREQ determines the LED blink frequency. |
| 32 | Values range from 2 to 10. |
Tom Rix | c36db31 | 2009-05-15 23:47:12 +0200 | [diff] [blame] | 33 | |
| 34 | Some other LED macros |
Uri Mashiach | 3dc6f65 | 2017-01-19 10:51:05 +0200 | [diff] [blame] | 35 | --------------------- |
Tom Rix | c36db31 | 2009-05-15 23:47:12 +0200 | [diff] [blame] | 36 | |
Uri Mashiach | 3dc6f65 | 2017-01-19 10:51:05 +0200 | [diff] [blame] | 37 | CONFIG_STATUS_LED_BOOT is the LED to light when the board is booting. |
| 38 | This must be a valid LED number (0-5). |
Tom Rix | c36db31 | 2009-05-15 23:47:12 +0200 | [diff] [blame] | 39 | |
Uri Mashiach | 3dc6f65 | 2017-01-19 10:51:05 +0200 | [diff] [blame] | 40 | CONFIG_STATUS_LED_RED is the red LED. It is used to signal errors. This must be |
| 41 | a valid LED number (0-5). Other similar color LED's macros are |
| 42 | CONFIG_STATUS_LED_GREEN, CONFIG_STATUS_LED_YELLOW and CONFIG_STATUS_LED_BLUE. |
Tom Rix | c36db31 | 2009-05-15 23:47:12 +0200 | [diff] [blame] | 43 | |
Uri Mashiach | 3dc6f65 | 2017-01-19 10:51:05 +0200 | [diff] [blame] | 44 | General LED functions |
| 45 | --------------------- |
| 46 | The following functions should be defined: |
Tom Rix | c36db31 | 2009-05-15 23:47:12 +0200 | [diff] [blame] | 47 | |
Uri Mashiach | 3dc6f65 | 2017-01-19 10:51:05 +0200 | [diff] [blame] | 48 | __led_init is called once to initialize the LED to CONFIG_STATUS_LED_STATE. |
| 49 | One time start up code should be placed here. |
Tom Rix | c36db31 | 2009-05-15 23:47:12 +0200 | [diff] [blame] | 50 | |
Wolfgang Denk | 1d695be | 2009-07-07 22:35:02 +0200 | [diff] [blame] | 51 | __led_set is called to change the state of the LED. |
Tom Rix | c36db31 | 2009-05-15 23:47:12 +0200 | [diff] [blame] | 52 | |
| 53 | __led_toggle is called to toggle the current state of the LED. |
| 54 | |
| 55 | Colour LED |
| 56 | ======================================== |
| 57 | |
Wolfgang Denk | 1d695be | 2009-07-07 22:35:02 +0200 | [diff] [blame] | 58 | Colour LED's are at present only used by ARM. |
Tom Rix | c36db31 | 2009-05-15 23:47:12 +0200 | [diff] [blame] | 59 | |
| 60 | The functions names explain their purpose. |
| 61 | |
| 62 | coloured_LED_init |
| 63 | red_LED_on |
| 64 | red_LED_off |
| 65 | green_LED_on |
| 66 | green_LED_off |
| 67 | yellow_LED_on |
| 68 | yellow_LED_off |
| 69 | blue_LED_on |
| 70 | blue_LED_off |
| 71 | |
Peter Tyser | cede5d8 | 2010-04-12 22:28:04 -0500 | [diff] [blame] | 72 | These are weakly defined in arch/arm/lib/board.c to noops. Where applicable, define |
Tom Rix | c36db31 | 2009-05-15 23:47:12 +0200 | [diff] [blame] | 73 | these functions in the board specific source. |
| 74 | |
| 75 | TBD : Describe older board dependent macros similar to what is done for |
Tom Rix | c36db31 | 2009-05-15 23:47:12 +0200 | [diff] [blame] | 76 | |
| 77 | TBD : Describe general support via asm/status_led.h |