[PATCH skeleton v4 01/18] LED test
OpenBMC Patches
openbmc-patches at stwcx.xyz
Mon Nov 23 12:20:13 AEDT 2015
From: Ken <ken.sk.lai at mail.foxconn.com>
---
bin/Barreleye.py | 1 +
objects/led_controller.c | 16 +++++++++++++---
2 files changed, 14 insertions(+), 3 deletions(-)
mode change 100644 => 100755 objects/led_controller.c
diff --git a/bin/Barreleye.py b/bin/Barreleye.py
index 65a6aa4..98d7321 100755
--- a/bin/Barreleye.py
+++ b/bin/Barreleye.py
@@ -408,6 +408,7 @@ GPIO_CONFIG['BMC_READY'] = { 'gpio_pin': 'H2', 'direction': 'out' }
GPIO_CONFIG['POWER_BUTTON'] = { 'gpio_pin': 'E0', 'direction': 'both' }
GPIO_CONFIG['PCIE_RESET'] = { 'gpio_pin': 'B5', 'direction': 'out' }
GPIO_CONFIG['USB_RESET'] = { 'gpio_pin': 'B6', 'direction': 'out' }
+GPIO_CONFIG['BEEP'] = { 'gpio_pin': 'N7', 'direction': 'out' }
GPIO_CONFIG['SLOT0_RISER_PRESENT'] = { 'gpio_pin': 'N0', 'direction': 'in' }
GPIO_CONFIG['SLOT1_RISER_PRESENT'] = { 'gpio_pin': 'N1', 'direction': 'in' }
GPIO_CONFIG['SLOT2_RISER_PRESENT'] = { 'gpio_pin': 'N2', 'direction': 'in' }
diff --git a/objects/led_controller.c b/objects/led_controller.c
old mode 100644
new mode 100755
index 8c3fa3c..5bb4542
--- a/objects/led_controller.c
+++ b/objects/led_controller.c
@@ -10,11 +10,12 @@ static const gchar* dbus_name = "org.openbmc.control.led";
static GDBusObjectManagerServer *manager = NULL;
-#define NUM_GPIO 2
+#define NUM_GPIO 3
GPIO led_gpio[NUM_GPIO] = {
(GPIO){"IDENTIFY"},
- (GPIO){"BMC_READY"}
+ (GPIO){"BMC_READY"},
+ (GPIO){"BEEP"}
};
@@ -67,21 +68,30 @@ on_set_off (Led *led,
return TRUE;
}
+int tmp=0;
void init_led(Led* led, GPIO* mygpio)
{
int rc = GPIO_OK;
+ int i=5;
+ tmp++;
do {
uint8_t val;
rc = gpio_open(mygpio);
if (rc != GPIO_OK) { break; }
rc = gpio_read(mygpio,&val);
if (rc != GPIO_OK) { break; }
+ led_set_state(led,"off");
if (val == 0) {
led_set_state(led,"on");
} else {
led_set_state(led,"off");
}
- } while(0);
+ i--;
+ } while(i!=0);
+
+if(tmp==3)
+ led_set_state(led,"off");
+
gpio_close(mygpio);
if (rc != GPIO_OK) {
g_print("ERROR led controller: GPIO error %s (rc=%d)\n",
--
2.6.3
More information about the openbmc
mailing list