++void led_active(int mod, int state)
++{
++ unsigned int flags = 0;
++
++//printk("mod = %d state = %d\n", mod, state);
++ spin_lock_irqsave(&config_lock, flags);
++ if ((mod >= 5) || (state >= 5))
++ {
++ spin_unlock_irqrestore(&config_lock, flags);
++ return;
++ }
++
++ switch (mod)
++ {
++ case 2: /*system led */
++ sys_mod_state = state;
++ switch (state)
++ {
++ case 1:
++ break;
++ case 2: /*sys led flashing green */
++ tnetd73xx_gpio_out(4, FALSE);
++ tnetd73xx_gpio_out(5, TRUE);
++ tnetd73xx_gpio_out(8, TRUE);
++ break;
++ case 3: /*sys led solid green */
++ tnetd73xx_gpio_out(4, TRUE);
++ tnetd73xx_gpio_out(5, TRUE);
++ tnetd73xx_gpio_out(8, TRUE);
++
++ break;
++ case 4: /*sys fail red */
++ tnetd73xx_gpio_out(4, TRUE);
++ tnetd73xx_gpio_out(5, FALSE);
++ tnetd73xx_gpio_out(8, FALSE);
++ break;
++ default:
++ break;
++ }
++ break;
++ case 3: /*wan led */
++ wan_mod_state = state;
++ switch (state)
++ {
++ case 1: /*no wan interface*/
++ if (pWanTimer)
++ {
++ del_timer(pWanTimer);
++ kfree(pWanTimer);
++ pWanTimer = NULL;
++ }
++ tnetd73xx_gpio_out(2, FALSE);
++ tnetd73xx_gpio_out(3, FALSE);
++ break;
++ case 2: /*wan connected */
++ if (pWanTimer)
++ {
++ del_timer(pWanTimer);
++ kfree(pWanTimer);
++ pWanTimer = NULL;
++ }
++ tnetd73xx_gpio_out(2, TRUE);
++ tnetd73xx_gpio_out(3, FALSE);
++ break;
++ case 3: /*rx/tx activity */
++ if (pWanTimer != NULL)
++ break;
++
++ pWanTimer = kmalloc(sizeof(struct timer_list), GFP_KERNEL);
++ init_timer(pWanTimer);
++
++ pWanTimer->function = wan_led_func;
++ pWanTimer->data = 0;
++ pWanTimer->expires = jiffies + FLICK_TIME;
++ tnetd73xx_gpio_out(2, FALSE);
++ tnetd73xx_gpio_out(3, FALSE);
++ wan_txrx_state = 0;
++ add_timer(pWanTimer);
++
++ break;
++ case 4: /*no ipaddress */
++ if (pWanTimer)
++ {
++ del_timer(pWanTimer);
++ kfree(pWanTimer);
++ pWanTimer = NULL;
++ }
++ tnetd73xx_gpio_out(2, FALSE);
++ tnetd73xx_gpio_out(3, TRUE);
++ break;
++ default:
++ if (pWanTimer)
++ {
++ del_timer(pWanTimer);
++ kfree(pWanTimer);
++ pWanTimer = NULL;
++ }
++ break;
++ }
++ break;
++ //wwzh for wireless
++ #if 0
++ case 4: /*wlan led */
++ wlan_mod_state = state;
++ switch (state)
++ {
++ case 1: /* wlan off */
++ if (pWlanTimer)
++ {
++ del_timer(pWlanTimer);
++ kfree(pWlanTimer);
++ pWlanTimer = NULL;
++ }
++ tnetd73xx_gpio_out(12, FALSE);
++ tnetd73xx_gpio_out(13, FALSE);
++ break;
++ case 2: /* wlan ready */
++ if (pWlanTimer)
++ {
++ del_timer(pWlanTimer);
++ kfree(pWlanTimer);
++ pWlanTimer = NULL;
++ }
++ tnetd73xx_gpio_out(12, TRUE);
++ tnetd73xx_gpio_out(13, FALSE);
++ break;
++ case 3: /* wlan rx/tx activity */
++ if (pWlanTimer != NULL)
++ break;
++
++ pWlanTimer = kmalloc(sizeof(struct timer_list), GFP_KERNEL);
++ init_timer(pWlanTimer);
++
++ pWlanTimer->function = wlan_led_func;
++ pWlanTimer->data = 0;
++ pWlanTimer->expires = jiffies + FLICK_TIME;
++ tnetd73xx_gpio_out(12, FALSE);
++ tnetd73xx_gpio_out(13, FALSE);
++ wlan_txrx_state = 0;
++ add_timer(pWlanTimer);
++
++ break;
++ default:
++ if (pWlanTimer)
++ {
++ del_timer(pWlanTimer);
++ kfree(pWlanTimer);
++ pWlanTimer = NULL;
++ }
++
++ break;
++ }
++ break;
++ #endif //for wireless
++ default:
++ break;
++ }
++ spin_unlock_irqrestore(&config_lock, flags);
++}
++static ssize_t proc_read_led_fops(struct file *filp,
++ char *buf,size_t count , loff_t *offp)
++{
++ char *pdata = NULL;
++ int i = 0, j = 0, len = 0, totallen = 0;
++ char line[255];
++
++ if (*offp != 0)
++ return 0;
++ pdata = buf;
++ len = sprintf(line, "USER MODULE INFORMATION:\n");
++ copy_to_user(pdata, line, len);
++ pdata += len;
++ totallen += len;
++ len = 0;
++
++ //*******add Module 1 , this Module is ADSL ********/
++ for (i = 0; i < MAX_MOD_ID; i++)
++ {
++ if (modArr[i] != NULL)
++ {
++ len = sprintf(line, " Module ID = %d\n", i);
++ copy_to_user(pdata, line, len);
++ pdata += len;
++ totallen += len;
++ len = 0;
++ for(j = 0; j < MAX_STATE_ID; j++)
++ {
++ if (modArr[i]->states[j] != NULL)
++ {
++ len = sprintf(line, "State =%d, Led = %d,", j, modArr[i]->states[j]->led);
++ copy_to_user(pdata, line, len);
++ pdata += len;
++ totallen += len;
++ len = 0;
++ switch(modArr[i]->states[j]->mode)
++ {
++ case 1:
++ len = sprintf(line, "Mode = OFF\n");
++ break;
++ case 2:
++ len = sprintf(line, "Mode = BLINK_ON, On Time(ms) = %d\n", (unsigned int)modArr[i]->states[j]->param);
++ break;
++ case 3:
++ len = sprintf(line, "Mode = BLINK_OFF, Off Time(ms) = %d\n", (unsigned int)modArr[i]->states[j]->param);
++ break;
++ case 4:
++ len = sprintf(line, "Mode = On\n");
++ break;
++ case 5:
++ len = sprintf(line, "Mode = FLASH, Time Period(ms) = %d\n", (unsigned int)modArr[i]->states[j]->param);
++ break;
++ default:
++ break;
++ }
++ copy_to_user(pdata, line, len);
++ pdata += len;
++ totallen += len;
++ len = 0;
++ }
++ }
++ }
++
++ }
++
++ len = sprintf(line, "Module ID = 2(system led)\n");
++ copy_to_user(pdata, line, len);
++ pdata += len;
++ totallen += len;
++ len = 0;
++ switch(sys_mod_state)
++ {
++ case 1:
++ len = sprintf(line, "State = OFF\n");
++ break;
++ case 2:
++ len = sprintf(line, "State = Booting\n");
++ break;
++ case 3:
++ len = sprintf(line, "State = System Ready\n");
++ break;
++ case 4:
++ len = sprintf(line, "State = System Failure\n");
++ break;
++ default:
++ break;
++ }
++ copy_to_user(pdata, line, len);
++ pdata += len;
++ totallen += len;
++ len = 0;
++
++ len = sprintf(line, "Module ID = 3(WAN led)\n");
++ copy_to_user(pdata, line, len);
++ pdata += len;
++ totallen += len;
++ len = 0;
++ switch(wan_mod_state)
++ {
++ case 1:
++ len = sprintf(line, "State = OFF\n");
++ break;
++ case 2:
++ len = sprintf(line, "State = Wan Connected\n");
++ break;
++ case 3:
++ len = sprintf(line, "State = Wan Tx/Rx Activity\n");
++ break;
++ case 4:
++ len = sprintf(line, "State = Wan Connect Failure\n");
++ break;
++ default:
++ break;
++ }
++ copy_to_user(pdata, line, len);
++ pdata += len;
++ totallen += len;
++ len = 0;
++
++//wwzh for wireless
++#if 0
++ len = sprintf(line, "Module ID = 4(WLAN led)\n");
++ copy_to_user(pdata, line, len);
++ pdata += len;
++ totallen += len;
++ len = 0;
++ switch(wlan_mod_state)
++ {
++ case 1:
++ len = sprintf(line, "State = OFF\n");
++ break;
++ case 2:
++ len = sprintf(line, "State = wlan Ready\n");
++ break;
++ case 3:
++ len = sprintf(line, "State = wlan rx/tx activity\n");
++ break;
++ default:
++ break;
++ }
++ copy_to_user(pdata, line, len);
++ pdata += len;
++ totallen += len;
++ len = 0;
++#endif //for wireless
++
++ *offp = totallen;
++ return totallen;
++}
++static ssize_t proc_write_led_fops(struct file *filp,const char *buffer,
++ size_t count , loff_t *offp)
++{
++ char *pdata = NULL, *ptemp = NULL;
++ char line[10], temp[10];
++ int i = 0;
++ int mod = 0xffff, state = 0xffff;
++ int flag = 0;
++
++ /* Check if this write is for configuring ADSL */
++ if( *(int *)(buffer) == 0xFFEEDDCC )
++ {
++ printk("<1>proc write:Calling Configuration\n");
++ config_led((unsigned long)(buffer + sizeof(int)) );
++ return count;
++ }
++
++ if (count > 10)
++ {
++ printk("<1> proc write: Input too long, max length = 10\n");
++ return count;
++ }
++ memset(temp, 0x00, 10);
++ memset(line, 0x00, 10);
++ copy_from_user(line, buffer, count);
++ line[count] = 0x00;
++ pdata = line;
++ ptemp = temp;
++
++ while (flag == 0)
++ {
++ if (i > 10)
++ break;
++ if (((*pdata) >= '0') && ((*pdata) <= '9'))
++ {
++ *ptemp = *pdata;
++ ptemp++;
++ }
++ else if ((*pdata) == ',')
++ {
++ *ptemp = 0x00;
++ flag = 1;
++ }
++ pdata++;
++ i++;
++ }
++ if (flag == 1)
++ mod = led_atoi(temp);
++ else
++ return count;
++
++ ptemp = temp;
++ *ptemp = 0x00;
++ flag = 0;
++
++ while(flag == 0)
++ {
++ if (i > 10)
++ break;
++ if (((*pdata) >= '0') && ((*pdata) <= '9'))
++ {
++ *ptemp = *pdata;
++ ptemp++;
++ }
++ else if ((*pdata) == 0x00)
++ {
++ *ptemp = 0x00;
++ flag = 1;
++ }
++ pdata++;
++ i++;
++ }
++ if (flag == 1)
++ state = led_atoi(temp);
++ else
++ return count;
++ if ((mod == 0xFFFF) || (state == 0xFFFF))
++ return count;
++ else
++ {
++ if (mod != 4)
++ led_active(mod, state);
++ else
++ led_operation(mod, state);
++ }
++ return 1;
++}
++#endif
++/************end *******************/
++static int config_led(unsigned long y)