gpio_led.c 546 B

1234567891011121314151617181920212223242526
  1. /*
  2. * Status LED driver based on GPIO access conventions of Linux
  3. *
  4. * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
  5. * Licensed under the GPL-2 or later.
  6. */
  7. #include <common.h>
  8. #include <status_led.h>
  9. #include <asm/gpio.h>
  10. void __led_init(led_id_t mask, int state)
  11. {
  12. gpio_request(mask, "gpio_led");
  13. gpio_direction_output(mask, state == STATUS_LED_ON);
  14. }
  15. void __led_set(led_id_t mask, int state)
  16. {
  17. gpio_set_value(mask, state == STATUS_LED_ON);
  18. }
  19. void __led_toggle(led_id_t mask)
  20. {
  21. gpio_set_value(mask, !gpio_get_value(mask));
  22. }