4 * Copyright (c) 2005-2011 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
15 #if CONFIG_POST & CONFIG_SYS_POST_BSPEC1
16 int led_post_test(int flags)
18 unsigned leds[] = { CONFIG_POST_BSPEC1_GPIO_LEDS };
21 /* First turn them all off */
22 for (i = 0; i < ARRAY_SIZE(leds); ++i) {
23 if (gpio_request(leds[i], "post")) {
24 printf("could not request gpio %u\n", leds[i]);
27 gpio_direction_output(leds[i], 0);
30 /* Now turn them on one by one */
31 for (i = 0; i < ARRAY_SIZE(leds); ++i) {
32 printf("LED%i on", i + 1);
33 gpio_set_value(leds[i], 1);
35 printf("\b\b\b\b\b\b\b");
43 #if CONFIG_POST & CONFIG_SYS_POST_BSPEC2
44 int button_post_test(int flags)
46 unsigned buttons[] = { CONFIG_POST_BSPEC2_GPIO_BUTTONS };
47 unsigned int sws[] = { CONFIG_POST_BSPEC2_GPIO_NAMES };
49 unsigned short value = 0;
52 for (i = 0; i < ARRAY_SIZE(buttons); ++i) {
53 if (gpio_request(buttons[i], "post")) {
54 printf("could not request gpio %u\n", buttons[i]);
57 gpio_direction_input(buttons[i]);
60 printf("\n--------Press SW%i: %2d ", sws[i], delay);
63 for (j = 0; j < 100; j++) {
64 value = gpio_get_value(buttons[i]);
69 printf("\b\b\b%2d ", delay);
78 gpio_free(buttons[i]);