[dahdi-commits] sruffell: branch linux/sruffell/dahdi-linux-cmdqueue r6038 - /linux/team/sruf...

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Tue Feb 24 18:08:01 CST 2009


Author: sruffell
Date: Tue Feb 24 18:08:00 2009
New Revision: 6038

URL: http://svn.digium.com/svn-view/dahdi?view=rev&rev=6038
Log:
A little bit of cleanup on the initialization of the led state.

Modified:
    linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/base.c
    linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/wcte12xp.h

Modified: linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/base.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/base.c?view=diff&rev=6038&r1=6037&r2=6038
==============================================================================
--- linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/base.c Tue Feb 24 18:08:00 2009
@@ -283,7 +283,7 @@
 {
 	struct command *cmd;
 
-	leds = ~leds & 0x0E; /* invert the LED bits (3 downto 1)*/
+	leds = (~leds) & 0x0E; /* invert the LED bits (3 downto 1)*/
 
 	while (!(cmd = get_free_cmd(wc))) {
 		msleep(10);
@@ -1043,10 +1043,7 @@
 			module_printk("Wrote '%x' but read '%x'\n", x, reg);
 	}
 
-	/* all LED's blank */
-	wc->ledtestreg = UNSET_LED_ORANGE(wc->ledtestreg);
-	wc->ledtestreg = UNSET_LED_REDGREEN(wc->ledtestreg);
-	t1_setleds(wc, wc->ledtestreg);
+	t1_setleds(wc, wc->ledstate);
 
 #ifdef VPM_SUPPORT
 	t1_vpm150m_init(wc);
@@ -1179,12 +1176,11 @@
 	unsigned char led;
 	unsigned long flags;
 
-	led = wc->ledtestreg;
+	led = wc->ledstate;
 
 	if (wc->span.alarms & (DAHDI_ALARM_RED | DAHDI_ALARM_BLUE)) {
 		/* When we're in red alarm, blink the led once a second. */
 		if (time_after(jiffies, wc->blinktimer)) {
-			wc->blinktimer = jiffies + HZ/2;
 			led = (led & __LED_GREEN) ? SET_LED_RED(led) : UNSET_LED_REDGREEN(led);
 		}
 	} else if (wc->span.alarms & DAHDI_ALARM_YELLOW) {
@@ -1201,15 +1197,16 @@
 			led = UNSET_LED_REDGREEN(led); 
 	}
 
-	if (led != wc->ledtestreg) {
+	if (led != wc->ledstate) {
 		struct command *cmd;
 		cmd = get_free_cmd(wc);
 		if (cmd) {
+			wc->blinktimer = jiffies + HZ/2;
 			cmd->flags |= __CMD_LEDS;
 			cmd->address = ~led & 0x0E;
 			submit_cmd(wc, cmd);
 			spin_lock_irqsave(&wc->reglock, flags);
-			wc->ledtestreg = led;
+			wc->ledstate = led;
 			spin_unlock_irqrestore(&wc->reglock, flags);
 		}
 	}
@@ -1360,6 +1357,7 @@
 	int startinglatency;
 	unsigned int index = -1;
 
+	printk(KERN_DEBUG "Compiled at %s\n", __TIME__);
 	for (x = 0; x < sizeof(ifaces) / sizeof(ifaces[0]); x++) {
 		if (!ifaces[x]) {
 			index = x;
@@ -1379,6 +1377,7 @@
 
 	ifaces[index] = wc;
 	memset(wc, 0, sizeof(*wc));
+	wc->ledstate = -1;
 	spin_lock_init(&wc->reglock);
 	spin_lock_init(&wc->cmd_list_lock);
 	INIT_LIST_HEAD(&wc->active_cmds);

Modified: linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/wcte12xp.h
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/wcte12xp.h?view=diff&rev=6038&r1=6037&r2=6038
==============================================================================
--- linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/wcte12xp.h (original)
+++ linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/wcte12xp.h Tue Feb 24 18:08:00 2009
@@ -65,12 +65,12 @@
 #define __LED_GREEN	(1<<2)
 #define __LED_RED	(1<<1)
 
-#define SET_LED_ORANGE(a) a | __LED_ORANGE 
-#define SET_LED_RED(a) (a | __LED_RED) & ~__LED_GREEN
-#define SET_LED_GREEN(a) (a | __LED_GREEN) & ~__LED_RED
+#define SET_LED_ORANGE(a) (a | __LED_ORANGE)
+#define SET_LED_RED(a) ((a | __LED_RED) & ~__LED_GREEN)
+#define SET_LED_GREEN(a) ((a | __LED_GREEN) & ~__LED_RED)
 
-#define UNSET_LED_ORANGE(a) a & ~__LED_ORANGE 
-#define UNSET_LED_REDGREEN(a) a | __LED_RED | __LED_GREEN
+#define UNSET_LED_ORANGE(a) (a & ~__LED_ORANGE)
+#define UNSET_LED_REDGREEN(a) (a | __LED_RED | __LED_GREEN)
 
 #define CMD_WR(a,b) (((a) << 8) | (b) | __CMD_WR)
 #define CMD_RD(a) (((a) << 8) | __CMD_RD)
@@ -126,7 +126,7 @@
 	atomic_t initialized;
 	unsigned long alarmtimer;
 	int *chanmap;
-	unsigned char ledtestreg;
+	unsigned char ledstate;
 	unsigned char ec_chunk1[32][DAHDI_CHUNKSIZE];
 	unsigned char ec_chunk2[32][DAHDI_CHUNKSIZE];
 	struct dahdi_span span;						/* Span */




More information about the dahdi-commits mailing list