coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
leds.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #include <assert.h>
4 #include <soc/ti/am335x/gpio.h>
5 
6 #include "leds.h"
7 
8 static const int led_gpios[BEAGLEBONE_LED_COUNT] = {
13 };
14 
16 {
17  int i;
18 
19  for (i = 0; i < ARRAY_SIZE(led_gpios); i++)
21 }
22 
23 void beaglebone_leds_set(enum beaglebone_led led, int on)
24 {
25  int res;
26 
27  ASSERT(led < ARRAY_SIZE(led_gpios) && led_gpios[led]);
28  res = gpio_set_value(led_gpios[led], on);
29  ASSERT(res != -1);
30 }
#define ASSERT(x)
Definition: assert.h:44
#define ARRAY_SIZE(a)
Definition: helpers.h:12
static const int led_gpios[BEAGLEBONE_LED_COUNT]
Definition: leds.c:8
void beaglebone_leds_set(enum beaglebone_led led, int on)
Definition: leds.c:23
void beaglebone_leds_init(void)
Definition: leds.c:15
beaglebone_led
Definition: leds.h:6
@ BEAGLEBONE_LED_COUNT
Definition: leds.h:11
@ BEAGLEBONE_LED_USR3
Definition: leds.h:10
@ BEAGLEBONE_LED_USR0
Definition: leds.h:7
@ BEAGLEBONE_LED_USR1
Definition: leds.h:8
@ BEAGLEBONE_LED_USR2
Definition: leds.h:9
int gpio_direction_output(unsigned int gpio, int value)
Make a GPIO an output, and set its value.
Definition: gpio.c:151
int gpio_set_value(unsigned int gpio, int value)
Set an output GPIO's value.
Definition: gpio.c:176
@ AM335X_GPIO_BITS_PER_BANK
Definition: gpio.h:9