1 diff -urN linux.old/drivers/char/avalanche_led/gpio.c linux.dev/drivers/char/avalanche_led/gpio.c
2 --- linux.old/drivers/char/avalanche_led/gpio.c 1970-01-01 01:00:00.000000000 +0100
3 +++ linux.dev/drivers/char/avalanche_led/gpio.c 2005-07-12 03:13:02.696541072 +0200
5 +#include <linux/kernel.h>
6 +#include <asm/uaccess.h>
7 +#include <linux/spinlock.h>
8 +#include <linux/proc_fs.h>
10 +#include <linux/timer.h>
11 +#include <linux/module.h>
13 +#include <asm/ar7/tnetd73xx_err.h>
14 +#include <asm/ar7/tnetd73xx_misc.h>
15 +#include <asm/ar7/ledapp.h>
20 +#if defined CONFIG_AR7WRD || defined CONFIG_AR7RD
22 +#define AR7_RESET_FILE "led_mod/ar7reset"
23 +#define AR7_VERSION_FILE "led_mod/hardware_version"
24 +#define AR7_RESET_GPIO 11
25 +#define RESET_POLL_TIME 1
26 +#define RESET_HOLD_TIME 4
29 +static struct proc_dir_entry *reset_file;
30 +static int res_state = 0;
32 +static struct timer_list *pTimer = NULL;
33 +static ssize_t proc_read_reset_fops(struct file *filp,
34 + char *buf,size_t count , loff_t *offp);
36 +static ssize_t proc_read_hwversion_fops(struct file *filp,
37 + char *buf,size_t count , loff_t *offp);
39 +struct file_operations reset_fops = {
40 + read: proc_read_reset_fops
42 +struct file_operations hardware_version_fops = {
43 + read: proc_read_hwversion_fops
47 +static spinlock_t device_lock;
50 +static void gpio_led_on( unsigned long param )
54 + spin_lock_irqsave(&device_lock, flags);
56 + tnetd73xx_gpio_out(param,FALSE);
57 + spin_unlock_irqrestore(&device_lock, flags);
60 +static void gpio_led_off ( unsigned long param )
62 + unsigned int flags = 0x00;
64 + spin_lock_irqsave(&device_lock, flags);
66 + tnetd73xx_gpio_out(param,TRUE);
67 + spin_unlock_irqrestore(&device_lock, flags);
70 +static void gpio_led_init( unsigned long param)
72 + tnetd73xx_gpio_ctrl(param,GPIO_PIN,GPIO_OUTPUT_PIN);
75 +static void board_gpio_reset(void)
77 + /* Initialize the link mask */
78 + device_lock = SPIN_LOCK_UNLOCKED;
82 +#if defined CONFIG_AR7WRD || defined CONFIG_AR7RD
84 +static ssize_t proc_read_hwversion_fops(struct file *filp, char *buf,
85 + size_t count, loff_t *offp)
92 + len = sprintf(line, "%d%d.%d%d%d%d\n", tnetd73xx_gpio_in(20),
93 + tnetd73xx_gpio_in(21), tnetd73xx_gpio_in(22),
94 + tnetd73xx_gpio_in(23), tnetd73xx_gpio_in(24),
95 + tnetd73xx_gpio_in(25));
97 + copy_to_user(buf, line, len);
102 +static ssize_t proc_read_reset_fops(struct file *filp,
103 + char *buf,size_t count , loff_t *offp)
105 + char * pdata = NULL;
112 + len = sprintf(line,"%d\n", res_state );
115 + copy_to_user(buf,line,len );
120 +static void reset_timer_func(unsigned long data)
124 + count = (tnetd73xx_gpio_in(AR7_RESET_GPIO) == 0) ? count + 1: 0;
125 + if( count >= RESET_HOLD_TIME/RESET_POLL_TIME )
127 + if (tnetd73xx_gpio_in(AR7_RESET_GPIO) == 0)
131 + pTimer->expires = jiffies + HZ*RESET_POLL_TIME;
132 + add_timer (pTimer);
136 +static void hardware_version_init(void)
138 + static struct proc_dir_entry *hardware_version_file;
139 + hardware_version_file = create_proc_entry(AR7_VERSION_FILE, 0777, NULL);
140 + if(hardware_version_file == NULL)
143 + hardware_version_file->owner = THIS_MODULE;
144 + hardware_version_file->proc_fops = &hardware_version_fops;
146 + tnetd73xx_gpio_ctrl(20,GPIO_PIN,GPIO_INPUT_PIN);
147 + tnetd73xx_gpio_ctrl(21,GPIO_PIN,GPIO_INPUT_PIN);
148 + tnetd73xx_gpio_ctrl(22,GPIO_PIN,GPIO_INPUT_PIN);
149 + tnetd73xx_gpio_ctrl(23,GPIO_PIN,GPIO_INPUT_PIN);
150 + tnetd73xx_gpio_ctrl(24,GPIO_PIN,GPIO_INPUT_PIN);
151 + tnetd73xx_gpio_ctrl(25,GPIO_PIN,GPIO_INPUT_PIN);
156 +static void reset_init(void)
158 + /* Create board reset proc file */
159 + reset_file = create_proc_entry( AR7_RESET_FILE, 0777, NULL);
160 + if( reset_file == NULL)
162 + reset_file->owner = THIS_MODULE;
163 + reset_file->proc_fops = &reset_fops;
165 + /* Initialise GPIO 11 for input */
166 + tnetd73xx_gpio_ctrl(AR7_RESET_GPIO,GPIO_PIN,GPIO_INPUT_PIN);
168 + /* Create a timer which fires every seconds */
169 + pTimer = kmalloc(sizeof(struct timer_list),GFP_KERNEL);
170 + init_timer( pTimer );
171 + pTimer->function = reset_timer_func;
173 + /* Start the timer */
174 + reset_timer_func(0);
178 + remove_proc_entry("AR7_RESET_FILE",NULL);
182 +/*************wwzh****************/
184 +extern unsigned int sys_mod_state;
185 +extern unsigned int wan_mod_state;
186 +extern unsigned int wlan_mod_state;
187 +void sys_led_init(void)
189 + tnetd73xx_gpio_ctrl(4, GPIO_PIN, GPIO_OUTPUT_PIN);
190 + tnetd73xx_gpio_ctrl(5, GPIO_PIN, GPIO_OUTPUT_PIN);
191 + tnetd73xx_gpio_ctrl(8, GPIO_PIN, GPIO_OUTPUT_PIN);
193 + tnetd73xx_gpio_out(4, FALSE);
194 + tnetd73xx_gpio_out(5, TRUE);
195 + tnetd73xx_gpio_out(8, TRUE);
201 +void wan_led_init(void)
204 + tnetd73xx_gpio_ctrl(2, GPIO_PIN, GPIO_OUTPUT_PIN);
205 + tnetd73xx_gpio_ctrl(3, GPIO_PIN, GPIO_OUTPUT_PIN);
207 + tnetd73xx_gpio_out(2, FALSE);
208 + tnetd73xx_gpio_out(3, FALSE);
214 +void wlan_led_init(void)
216 + //unsigned long i = 0;
217 + tnetd73xx_gpio_ctrl(12, GPIO_PIN, GPIO_OUTPUT_PIN);
218 + tnetd73xx_gpio_ctrl(13, GPIO_PIN, GPIO_OUTPUT_PIN);
220 + tnetd73xx_gpio_out(12, FALSE);
221 + tnetd73xx_gpio_out(13, TRUE);
222 + //for (i = 0; i < 0x20000000; i++);
223 + wlan_mod_state = 1;
228 +/*************end ****************/
230 +void board_gpio_init(void)
233 + board_gpio_reset();
234 +/**************wwzh*************/
238 + //junzhao 2004.3.15
239 + hardware_version_init();
243 + /* Register Device MAX_LED_ID + 1 for reset to factory default */
245 + temp[0].init = reset_init;
246 + temp[0].onfunc = 0;
247 + temp[0].offfunc = 0;
248 + register_led_drv( MAX_LED_ID + 1 , &temp[0]);
249 +//wwzh for wireless led
251 + /* Register led 12 WiFi 6 */
253 + temp[1].init = gpio_led_init;
254 + temp[1].onfunc = gpio_led_on;
255 + temp[1].offfunc = gpio_led_off;
256 + register_led_drv( 12 , &temp[1]);
261 +/**************end ************/
262 +#if defined(CONFIG_AR5D01)
263 + /* Register led 1 GPIO0 */
264 + temp[0].param = GPIO_0;
265 + temp[0].init = gpio_led_init;
266 + temp[0].onfunc = gpio_led_on;
267 + temp[0].offfunc = gpio_led_off;
268 + register_led_drv( 1 , &temp[0]);
270 + /* Register led 2 EINT1 */
271 + temp[1].param = EINT_1;
272 + temp[1].init = gpio_led_init;
273 + temp[1].onfunc = gpio_led_on;
274 + temp[1].offfunc = gpio_led_off;
275 + register_led_drv( 2 , &temp[1]);
277 + /* Register led 5 EINT1 */
278 + temp[2].param = GPIO_1;
279 + temp[2].init = gpio_led_init;
280 + temp[2].onfunc = gpio_led_on;
281 + temp[2].offfunc = gpio_led_off;
282 + register_led_drv( 5 , &temp[2]);
285 +#if defined(CONFIG_AR5W01)
286 + /* Register led 5 GPIO_1 */
287 + temp[0].param = GPIO_1;
288 + temp[0].init = gpio_led_init;
289 + temp[0].onfunc = gpio_led_on;
290 + temp[0].offfunc = gpio_led_off;
291 + register_led_drv( 5 , &temp[0]);
293 + /* Register led 7 GPIO_0 */
294 + temp[1].param = GPIO_0;
295 + temp[1].init = gpio_led_init;
296 + temp[1].onfunc = gpio_led_on;
297 + temp[1].offfunc = gpio_led_off;
298 + register_led_drv( 7 , &temp[1]);
301 +//wwzh #if defined(CONFIG_AR7RD)
302 +#if defined CONFIG_AR7WRD || defined CONFIG_AR7RD
303 + /* Register led 5 Green PPPOE GPIO 13 */
304 + temp[0].param = 13;
305 + temp[0].init = gpio_led_init;
306 + temp[0].onfunc = gpio_led_on;
307 + temp[0].offfunc = gpio_led_off;
308 + register_led_drv( 5 , &temp[0]);
310 + /* Register led 7 Green USB GPIO 12 */
311 + temp[1].param = 12;
312 + temp[1].init = gpio_led_init;
313 + temp[1].onfunc = gpio_led_on;
314 + temp[1].offfunc = gpio_led_off;
315 + register_led_drv( 7 , &temp[1]);
317 + /* Register Device MAX_LED_ID + 1 for reset to factory default */
319 + temp[2].init = reset_init;
320 + temp[2].onfunc = 0;
321 + temp[2].offfunc = 0;
322 + register_led_drv( MAX_LED_ID + 1 , &temp[2]);
324 + /* Register led 8 RED DSL GPIO 10 */
325 + temp[3].param = 10;
326 + temp[3].init = gpio_led_init;
327 + temp[3].onfunc = gpio_led_on;
328 + temp[3].offfunc = gpio_led_off;
329 + register_led_drv( 8 , &temp[3]);
331 + /* Register led 9 RED PPPoE down GPIO 9 */
333 + temp[4].init = gpio_led_init;
334 + temp[4].onfunc = gpio_led_on;
335 + temp[4].offfunc = gpio_led_off;
336 + register_led_drv( 9 , &temp[4]);
338 + /* Register led 10 DSL down GPIO 8 */
340 + temp[5].init = gpio_led_init;
341 + temp[5].onfunc = gpio_led_on;
342 + temp[5].offfunc = gpio_led_off;
343 + register_led_drv( 10 , &temp[5]);
345 + /* Register led 11 Power GPIO 7 */
347 + temp[6].init = gpio_led_init;
348 + temp[6].onfunc = gpio_led_on;
349 + temp[6].offfunc = gpio_led_off;
350 + register_led_drv( 11 , &temp[6]);
352 + /* Register led 12 WiFi 6 */
354 + temp[7].init = gpio_led_init;
355 + temp[7].onfunc = gpio_led_on;
356 + temp[7].offfunc = gpio_led_off;
357 + register_led_drv( 12 , &temp[7]);
359 + /* Register led 13 ELINK(AA1313) GPIO 15 */
360 + temp[8].param = 15;
361 + temp[8].init = gpio_led_init;
362 + temp[8].onfunc = gpio_led_on;
363 + temp[8].offfunc = gpio_led_off;
364 + register_led_drv( 13 , &temp[8]);
366 + /* Register led 14 EACT(Y13) GPIO 16 */
367 + temp[9].param = 16;
368 + temp[9].init = gpio_led_init;
369 + temp[9].onfunc = gpio_led_on;
370 + temp[9].offfunc = gpio_led_off;
371 + register_led_drv( 14 , &temp[9]);
374 +/**************wwzh**************/
376 +/**************end **************/
387 diff -urN linux.old/drivers/char/avalanche_led/ledmod.c linux.dev/drivers/char/avalanche_led/ledmod.c
388 --- linux.old/drivers/char/avalanche_led/ledmod.c 1970-01-01 01:00:00.000000000 +0100
389 +++ linux.dev/drivers/char/avalanche_led/ledmod.c 2005-07-12 03:12:40.675888720 +0200
391 +#include <linux/config.h>
392 +#include <linux/init.h>
393 +#include <linux/kernel.h>
394 +#include <linux/proc_fs.h>
395 +#include <asm/uaccess.h>
396 +#include <linux/fs.h>
397 +#include <linux/timer.h>
398 +#include <linux/delay.h>
399 +#include <linux/spinlock.h>
400 +#include <asm/ar7/avalanche_regs.h>
401 +#include <asm/ar7/ledapp.h>
402 +#include <linux/module.h>
409 +#define LED_BLINK_UP 5
410 +#define LED_BLINK_DOWN 6
412 +extern void avalanche_leds_init(void);
414 +/***********wwzh**************/
415 +unsigned int sys_mod_state;
416 +unsigned int wan_mod_state;
417 +unsigned int wlan_mod_state;
419 +struct timer_list *pWanTimer = NULL;
420 +struct timer_list *pWlanTimer = NULL;
421 +/***********end **************/
423 +typedef struct state_entry{
424 + unsigned char mode;
426 + void (*handler)(struct state_entry *pState);
427 + unsigned long param;
430 +typedef struct mod_entry{
431 + state_entry_t *states[MAX_STATE_ID];
434 +static mod_entry_t *modArr[MAX_MOD_ID];
435 +static struct proc_dir_entry *led_proc_dir,*led_file;
437 +/* index of the array is the led number HARDWARE SPECIFIC*/
438 +typedef struct led_data{
441 + struct timer_list *pTimer;
442 + unsigned char timer_running;
443 + unsigned long param;
446 +led_data_t led_arr[MAX_LED_ID + 1];
447 +/*!!! The last device is actually being used for ar7 reset to factory default */
450 +static spinlock_t config_lock;
452 +static void board_led_link_up( state_entry_t *pState );
453 +static void board_led_link_down( state_entry_t *pState );
454 +static void board_led_activity_on( state_entry_t *pState );
455 +static void board_led_activity_off( state_entry_t *pState );
456 +static void led_timer_func(unsigned long data);
458 +extern void board_gpio_init(void);
459 +extern void uart_led_init(void);
461 +static ssize_t proc_read_led_fops(struct file *filp,
462 + char *buf,size_t count , loff_t *offp);
463 +static ssize_t proc_write_led_fops(struct file *filp,const char *buffer,
464 + size_t count , loff_t *offp);
465 +static int config_led( unsigned long y);
467 +struct file_operations led_fops = {
468 + read: proc_read_led_fops,
469 + write: proc_write_led_fops,
472 +static int led_atoi( char *name)
480 + val = val*10+(*name - '0');
488 +static int free_memory(void)
492 + for( i = 0; i < MAX_MOD_ID ; i++)
494 + if( modArr[i] != NULL )
496 + for( j = 0; j < MAX_STATE_ID ; j++ )
498 + if( modArr[i]->states[j] != NULL )
499 + kfree( modArr[i]->states[j]);
508 +static int led_on( state_entry_t *pState )
510 + if( led_arr[pState->led].led == NULL)
512 + led_arr[pState->led].led->onfunc( led_arr[pState->led].led->param);
516 +static int led_off( state_entry_t *pState )
518 + if( led_arr[pState->led].led == NULL)
520 + led_arr[pState->led].led->offfunc( led_arr[pState->led].led->param);
524 +static void board_led_link_up( state_entry_t *pState )
526 + led_arr[pState->led].state = LED_ON;
527 + if( led_arr[pState->led].timer_running == 0 )
532 +static void board_led_link_down( state_entry_t *pState )
534 + led_arr[pState->led].state = LED_OFF;
535 + if( led_arr[pState->led].timer_running == 0 )
540 +static void add_led_timer(state_entry_t *pState)
542 + led_arr[pState->led].pTimer->expires = jiffies + HZ*(pState->param)/1000;
543 + led_arr[pState->led].param = pState->param;
544 + led_arr[pState->led].pTimer->data = pState;
545 + add_timer (led_arr[pState->led].pTimer);
548 +static void board_led_activity_on(state_entry_t *pState)
550 + if(led_arr[pState->led].timer_running == 0)
553 + add_led_timer(pState);
554 + led_arr[pState->led].timer_running = 1;
555 + led_arr[pState->led].state = LED_BLINK_UP;
557 + else if( led_arr[pState->led].timer_running > 0xF0)
559 + led_arr[pState->led].state = LED_BLINK_UP;
560 + led_arr[pState->led].pTimer->expires = jiffies + HZ*(pState->param)/1000;
561 + led_arr[pState->led].param = pState->param;
562 + led_arr[pState->led].pTimer->data = pState;
567 +static void board_led_activity_off(state_entry_t *pState)
569 + if(led_arr[pState->led].timer_running == 0)
572 + add_led_timer(pState);
573 + led_arr[pState->led].timer_running = 1;
574 + led_arr[pState->led].state = LED_BLINK_UP;
576 + else if( led_arr[pState->led].timer_running > 0xF0)
578 + led_arr[pState->led].state = LED_BLINK_UP;
579 + led_arr[pState->led].pTimer->expires = jiffies + HZ*(pState->param)/1000;
580 + led_arr[pState->led].param = pState->param;
581 + led_arr[pState->led].pTimer->data = pState;
586 +static void board_led_link_flash(state_entry_t *pState)
590 + if(led_arr[pState->led].timer_running == 0)
591 + add_led_timer(pState);
593 + led_arr[pState->led].param = pState->param;
594 + led_arr[pState->led].timer_running = 0xFF;
595 + led_arr[pState->led].state = LED_FLASH;
599 +static void led_timer_func(unsigned long data)
601 + state_entry_t *pState = NULL;
602 + mod_entry_t *pMod = NULL;
603 + unsigned int flags;
605 + spin_lock_irqsave(&config_lock, flags);
607 + pState = (state_entry_t *)data;
609 + if( led_arr[pState->led].state == LED_BLINK_DOWN )
611 + led_arr[pState->led].timer_running = 0;
612 + if( pState->mode == 2 )
613 + led_arr[pState->led].state = LED_OFF;
615 + led_arr[pState->led].state = LED_ON;
617 + else if( led_arr[pState->led].state == LED_BLINK_UP )
619 + led_arr[pState->led].pTimer->expires = jiffies + HZ*(led_arr[pState->led].param)/1000;
620 + led_arr[pState->led].pTimer->data = pState;
621 + add_timer (led_arr[pState->led].pTimer);
622 + if( pState->mode == 2 )
625 + led_arr[pState->led].state = LED_BLINK_DOWN;
630 + led_arr[pState->led].state = LED_BLINK_DOWN;
632 + led_arr[pState->led].timer_running = 1;
634 + else if( led_arr[pState->led].state == LED_FLASH )
636 + led_arr[pState->led].pTimer->expires = jiffies + HZ*(led_arr[pState->led].param)/1000;
637 + led_arr[pState->led].pTimer->data = pState;
638 + add_timer (led_arr[pState->led].pTimer);
640 + if( led_arr[pState->led].timer_running == 0xFF )
643 + led_arr[pState->led].timer_running--;
648 + led_arr[pState->led].timer_running++;
650 + spin_unlock_irqrestore(&config_lock, flags);
653 + else if(led_arr[pState->led].state == LED_OFF)
656 + led_arr[pState->led].timer_running = 0;
658 + else if( led_arr[pState->led].state == LED_ON )
661 + led_arr[pState->led].timer_running = 0;
663 + spin_unlock_irqrestore(&config_lock, flags);
666 +/************wwzh*****************/
668 +/************end *****************/
669 +static ssize_t proc_read_led_fops(struct file *filp,
670 + char *buf,size_t count , loff_t *offp)
672 + char * pdata = NULL;
673 + int i = 0, j = 0, len = 0, totallen = 0;
680 + len += sprintf(line,"LEDS Registered for use are:");
681 + for( i = 0; i< MAX_LED_ID; i++)
682 + if( led_arr[i].led != NULL )
683 + len += sprintf(&line[len]," %d ", i );
684 + line[len++] = '\n';
686 + copy_to_user(pdata, line,len );
690 + len = sprintf(line,"USER MODULE INFORMATION:\n");
691 + copy_to_user(pdata, line,len );
695 + for( i = 0; i< MAX_MOD_ID; i++)
697 + if( modArr[i] != NULL )
699 + len = sprintf(line," Module ID = %d \n" , i);
700 + copy_to_user(pdata, line,len );
704 + for( j = 0; j < MAX_STATE_ID; j++)
706 + if( modArr[i]->states[j] != NULL)
708 + len = sprintf(line ,
709 + " State = %d , Led = %d," , j , modArr[i]->states[j]->led);
710 + copy_to_user(pdata, line,len );
715 + switch( modArr[i]->states[j]->mode )
718 + len = sprintf(line ," Mode = OFF\n");
721 + len = sprintf(line ," Mode = BLINK_ON , On Time(ms) = %d\n" ,
722 + (unsigned int)modArr[i]->states[j]->param);
725 + len = sprintf(line ," Mode = BLINK_OFF , Off Time(ms) = %d\n" ,
726 + (unsigned int)modArr[i]->states[j]->param);
729 + len = sprintf(line ," Mode = ON \n");
732 + len = sprintf(line ," Mode = FLASH , Time Period(ms) = %d\n" ,
733 + (unsigned int)modArr[i]->states[j]->param);
739 + copy_to_user(pdata, line,len );
748 + /* Return with configuration information for LEDs */
752 +static ssize_t proc_write_led_fops(struct file *filp,const char *buffer,
753 + size_t count , loff_t *offp)
755 + char *pdata = NULL, *ptemp = NULL;
756 + char line[10],temp[10];
758 + int mod = 0xFFFF , state = 0xFFFF;
761 + /* Check if this write is for configuring stuff */
762 + if( *(int *)(buffer) == 0xFFEEDDCC )
764 + printk("<1>proc write:Calling Configuration\n");
765 + config_led((unsigned long)(buffer + sizeof(int)) );
771 + printk("<1>proc write:Input too long,max length = %d\n",10);
774 + memset( temp, 0x00 , 10);
775 + memset( line, 0x00 , 10);
776 + copy_from_user(line,buffer,count);
777 + line[count] = 0x00;
784 + if( ((*pdata) >= '0' ) && ((*pdata) <= '9') )
789 + else if( (*pdata) == ',' )
798 + mod = led_atoi( temp);
809 + if( ((*pdata) >= '0' ) && ((*pdata) <= '9') )
814 + else if( (*pdata) == 0x00 )
823 + state = led_atoi( temp);
826 + if( (mod == 0xFFFF) || (state == 0xFFFF))
829 + led_operation( mod , state );
833 +/************wwzh*******************/
838 +#define FLICK_TIME (HZ*100/1000)
839 +static unsigned int wan_txrx_state = 0;
840 +static unsigned int wlan_txrx_state = 0;
842 +void led_operation( int mod , int state)
845 + unsigned int flags;
847 + spin_lock_irqsave(&config_lock, flags);
849 + if( (mod >= MAX_MOD_ID) || ( state >= MAX_STATE_ID) )
851 + spin_unlock_irqrestore(&config_lock, flags);
854 + if ( modArr[mod] == NULL )
856 + spin_unlock_irqrestore(&config_lock, flags);
859 + if( modArr[mod]->states[state] == NULL )
861 + spin_unlock_irqrestore(&config_lock, flags);
864 + /* Call the function handler */
865 + modArr[mod]->states[state]->handler(modArr[mod]->states[state]);
867 + spin_unlock_irqrestore(&config_lock, flags);
870 +static void wan_led_func(unsigned long data)
872 + if (wan_txrx_state == 0)
874 + tnetd73xx_gpio_out(2, TRUE);
875 + tnetd73xx_gpio_out(3, FALSE);
876 + wan_txrx_state = 1;
880 + tnetd73xx_gpio_out(2, FALSE);
881 + tnetd73xx_gpio_out(3, FALSE);
882 + wan_txrx_state = 0;
884 + pWanTimer->expires = jiffies + FLICK_TIME;
885 + add_timer(pWanTimer);
889 +static void wlan_led_func(unsigned long data)
891 + if (wlan_txrx_state == 0)
893 + tnetd73xx_gpio_out(12, TRUE);
894 + tnetd73xx_gpio_out(13, FALSE);
895 + wlan_txrx_state = 1;
899 + tnetd73xx_gpio_out(12, FALSE);
900 + tnetd73xx_gpio_out(13, FALSE);
901 + wlan_txrx_state = 0;
904 + pWlanTimer->expires = jiffies + FLICK_TIME;
905 + add_timer(pWlanTimer);
909 +void led_active(int mod, int state)
911 + unsigned int flags = 0;
913 +//printk("mod = %d state = %d\n", mod, state);
914 + spin_lock_irqsave(&config_lock, flags);
915 + if ((mod >= 5) || (state >= 5))
917 + spin_unlock_irqrestore(&config_lock, flags);
923 + case 2: /*system led */
924 + sys_mod_state = state;
929 + case 2: /*sys led flashing green */
930 + tnetd73xx_gpio_out(4, FALSE);
931 + tnetd73xx_gpio_out(5, TRUE);
932 + tnetd73xx_gpio_out(8, TRUE);
934 + case 3: /*sys led solid green */
935 + tnetd73xx_gpio_out(4, TRUE);
936 + tnetd73xx_gpio_out(5, TRUE);
937 + tnetd73xx_gpio_out(8, TRUE);
940 + case 4: /*sys fail red */
941 + tnetd73xx_gpio_out(4, TRUE);
942 + tnetd73xx_gpio_out(5, FALSE);
943 + tnetd73xx_gpio_out(8, FALSE);
949 + case 3: /*wan led */
950 + wan_mod_state = state;
953 + case 1: /*no wan interface*/
956 + del_timer(pWanTimer);
960 + tnetd73xx_gpio_out(2, FALSE);
961 + tnetd73xx_gpio_out(3, FALSE);
963 + case 2: /*wan connected */
966 + del_timer(pWanTimer);
970 + tnetd73xx_gpio_out(2, TRUE);
971 + tnetd73xx_gpio_out(3, FALSE);
973 + case 3: /*rx/tx activity */
974 + if (pWanTimer != NULL)
977 + pWanTimer = kmalloc(sizeof(struct timer_list), GFP_KERNEL);
978 + init_timer(pWanTimer);
980 + pWanTimer->function = wan_led_func;
981 + pWanTimer->data = 0;
982 + pWanTimer->expires = jiffies + FLICK_TIME;
983 + tnetd73xx_gpio_out(2, FALSE);
984 + tnetd73xx_gpio_out(3, FALSE);
985 + wan_txrx_state = 0;
986 + add_timer(pWanTimer);
989 + case 4: /*no ipaddress */
992 + del_timer(pWanTimer);
996 + tnetd73xx_gpio_out(2, FALSE);
997 + tnetd73xx_gpio_out(3, TRUE);
1002 + del_timer(pWanTimer);
1009 + //wwzh for wireless
1011 + case 4: /*wlan led */
1012 + wlan_mod_state = state;
1015 + case 1: /* wlan off */
1018 + del_timer(pWlanTimer);
1019 + kfree(pWlanTimer);
1020 + pWlanTimer = NULL;
1022 + tnetd73xx_gpio_out(12, FALSE);
1023 + tnetd73xx_gpio_out(13, FALSE);
1025 + case 2: /* wlan ready */
1028 + del_timer(pWlanTimer);
1029 + kfree(pWlanTimer);
1030 + pWlanTimer = NULL;
1032 + tnetd73xx_gpio_out(12, TRUE);
1033 + tnetd73xx_gpio_out(13, FALSE);
1035 + case 3: /* wlan rx/tx activity */
1036 + if (pWlanTimer != NULL)
1039 + pWlanTimer = kmalloc(sizeof(struct timer_list), GFP_KERNEL);
1040 + init_timer(pWlanTimer);
1042 + pWlanTimer->function = wlan_led_func;
1043 + pWlanTimer->data = 0;
1044 + pWlanTimer->expires = jiffies + FLICK_TIME;
1045 + tnetd73xx_gpio_out(12, FALSE);
1046 + tnetd73xx_gpio_out(13, FALSE);
1047 + wlan_txrx_state = 0;
1048 + add_timer(pWlanTimer);
1054 + del_timer(pWlanTimer);
1055 + kfree(pWlanTimer);
1056 + pWlanTimer = NULL;
1062 + #endif //for wireless
1066 + spin_unlock_irqrestore(&config_lock, flags);
1068 +static ssize_t proc_read_led_fops(struct file *filp,
1069 + char *buf,size_t count , loff_t *offp)
1071 + char *pdata = NULL;
1072 + int i = 0, j = 0, len = 0, totallen = 0;
1078 + len = sprintf(line, "USER MODULE INFORMATION:\n");
1079 + copy_to_user(pdata, line, len);
1084 + //*******add Module 1 , this Module is ADSL ********/
1085 + for (i = 0; i < MAX_MOD_ID; i++)
1087 + if (modArr[i] != NULL)
1089 + len = sprintf(line, " Module ID = %d\n", i);
1090 + copy_to_user(pdata, line, len);
1094 + for(j = 0; j < MAX_STATE_ID; j++)
1096 + if (modArr[i]->states[j] != NULL)
1098 + len = sprintf(line, "State =%d, Led = %d,", j, modArr[i]->states[j]->led);
1099 + copy_to_user(pdata, line, len);
1103 + switch(modArr[i]->states[j]->mode)
1106 + len = sprintf(line, "Mode = OFF\n");
1109 + len = sprintf(line, "Mode = BLINK_ON, On Time(ms) = %d\n", (unsigned int)modArr[i]->states[j]->param);
1112 + len = sprintf(line, "Mode = BLINK_OFF, Off Time(ms) = %d\n", (unsigned int)modArr[i]->states[j]->param);
1115 + len = sprintf(line, "Mode = On\n");
1118 + len = sprintf(line, "Mode = FLASH, Time Period(ms) = %d\n", (unsigned int)modArr[i]->states[j]->param);
1123 + copy_to_user(pdata, line, len);
1133 + len = sprintf(line, "Module ID = 2(system led)\n");
1134 + copy_to_user(pdata, line, len);
1138 + switch(sys_mod_state)
1141 + len = sprintf(line, "State = OFF\n");
1144 + len = sprintf(line, "State = Booting\n");
1147 + len = sprintf(line, "State = System Ready\n");
1150 + len = sprintf(line, "State = System Failure\n");
1155 + copy_to_user(pdata, line, len);
1160 + len = sprintf(line, "Module ID = 3(WAN led)\n");
1161 + copy_to_user(pdata, line, len);
1165 + switch(wan_mod_state)
1168 + len = sprintf(line, "State = OFF\n");
1171 + len = sprintf(line, "State = Wan Connected\n");
1174 + len = sprintf(line, "State = Wan Tx/Rx Activity\n");
1177 + len = sprintf(line, "State = Wan Connect Failure\n");
1182 + copy_to_user(pdata, line, len);
1187 +//wwzh for wireless
1189 + len = sprintf(line, "Module ID = 4(WLAN led)\n");
1190 + copy_to_user(pdata, line, len);
1194 + switch(wlan_mod_state)
1197 + len = sprintf(line, "State = OFF\n");
1200 + len = sprintf(line, "State = wlan Ready\n");
1203 + len = sprintf(line, "State = wlan rx/tx activity\n");
1208 + copy_to_user(pdata, line, len);
1212 +#endif //for wireless
1217 +static ssize_t proc_write_led_fops(struct file *filp,const char *buffer,
1218 + size_t count , loff_t *offp)
1220 + char *pdata = NULL, *ptemp = NULL;
1221 + char line[10], temp[10];
1223 + int mod = 0xffff, state = 0xffff;
1226 + /* Check if this write is for configuring ADSL */
1227 + if( *(int *)(buffer) == 0xFFEEDDCC )
1229 + printk("<1>proc write:Calling Configuration\n");
1230 + config_led((unsigned long)(buffer + sizeof(int)) );
1236 + printk("<1> proc write: Input too long, max length = 10\n");
1239 + memset(temp, 0x00, 10);
1240 + memset(line, 0x00, 10);
1241 + copy_from_user(line, buffer, count);
1242 + line[count] = 0x00;
1250 + if (((*pdata) >= '0') && ((*pdata) <= '9'))
1255 + else if ((*pdata) == ',')
1264 + mod = led_atoi(temp);
1276 + if (((*pdata) >= '0') && ((*pdata) <= '9'))
1281 + else if ((*pdata) == 0x00)
1290 + state = led_atoi(temp);
1293 + if ((mod == 0xFFFF) || (state == 0xFFFF))
1298 + led_active(mod, state);
1300 + led_operation(mod, state);
1305 +/************end *******************/
1306 +static int config_led(unsigned long y)
1308 + config_elem_t *pcfg = NULL;
1309 + char *pdata = NULL;
1311 + int length = 0 , number = 0;
1312 + unsigned int flags;
1314 + spin_lock_irqsave(&config_lock, flags);
1316 + /* ioctl to configure */
1317 + length = *((int*)y);
1318 + pdata = (char *)y + sizeof(int);
1319 + number = (length - sizeof(int))/sizeof(config_elem_t);
1320 + pcfg = (config_elem_t *)(pdata);
1322 + /* Check if an earlier configuration exists IF yes free it up */
1325 + for ( i = 0 ; i < number ; i++ )
1327 + /* If no structure has been allocated for the module do so */
1328 + if ( modArr[pcfg->name] == NULL )
1330 + printk("<1>module = %d\n",pcfg->name);
1331 + if( pcfg->name >= MAX_MOD_ID)
1333 + printk("<1>Exiting Configuration: Module ID too large %d\n",pcfg->name);
1335 + spin_unlock_irqrestore(&config_lock, flags);
1338 + modArr[pcfg->name] = kmalloc(sizeof(mod_entry_t),GFP_KERNEL);
1339 + if(modArr[pcfg->name] == NULL)
1341 + printk("<1>Exiting Configuration: Error in allocating memory\n");
1343 + spin_unlock_irqrestore(&config_lock, flags);
1346 + memset( modArr[pcfg->name], 0x00, sizeof(mod_entry_t));
1349 + /* if no structure is allocated previously for this state
1350 + allocate a structure, if it's already there fill it up */
1351 + if( modArr[pcfg->name]->states[pcfg->state] == NULL)
1353 + printk("<1>STATE = %d\n",pcfg->state);
1354 + if( pcfg->state >= MAX_STATE_ID)
1356 + printk("<1>Exiting Configuration: State ID too large\n");
1358 + spin_unlock_irqrestore(&config_lock, flags);
1361 + modArr[pcfg->name]->states[pcfg->state] =
1362 + kmalloc(sizeof(state_entry_t),GFP_KERNEL);
1363 + if( modArr[pcfg->name]->states[pcfg->state] == NULL)
1366 + spin_unlock_irqrestore(&config_lock, flags);
1369 + memset( modArr[pcfg->name]->states[pcfg->state], 0x00, sizeof(state_entry_t));
1371 + /* Fill up the fields of the state */
1372 + if( pcfg->led >= MAX_LED_ID)
1374 + printk("<1>led = %d\n",pcfg->led);
1376 + spin_unlock_irqrestore(&config_lock, flags);
1379 + modArr[pcfg->name]->states[pcfg->state]->led = pcfg->led;
1380 + modArr[pcfg->name]->states[pcfg->state]->mode = pcfg->mode;
1381 + modArr[pcfg->name]->states[pcfg->state]->param = pcfg->param;
1382 + switch(pcfg->mode)
1385 + modArr[pcfg->name]->states[pcfg->state]->handler = board_led_link_down;
1390 + if( pcfg->mode == 2 )
1391 + modArr[pcfg->name]->states[pcfg->state]->handler = board_led_activity_on;
1392 + else if( pcfg->mode == 3)
1393 + modArr[pcfg->name]->states[pcfg->state]->handler = board_led_activity_off;
1395 + modArr[pcfg->name]->states[pcfg->state]->handler = board_led_link_flash;
1398 + modArr[pcfg->name]->states[pcfg->state]->handler = board_led_link_up;
1401 + printk("<1>Exiting Configuration: Unknown LED Mode\n");
1403 + spin_unlock_irqrestore(&config_lock, flags);
1408 + spin_unlock_irqrestore(&config_lock, flags);
1413 +int __init led_init(void)
1416 + /* Clear our memory */
1417 + memset(modArr,0x00,sizeof(mod_entry_t *)*MAX_MOD_ID);
1418 + memset(led_arr,0x00,sizeof(led_data_t *)*MAX_LED_ID);
1420 + /* Create spin lock for config data structure */
1421 + config_lock=SPIN_LOCK_UNLOCKED;
1423 + /* Create directory */
1424 + led_proc_dir = proc_mkdir("led", NULL);
1425 + if( led_proc_dir == NULL )
1428 + /* Create adsl file */
1429 + led_file = create_proc_entry("led", 0777, led_proc_dir);
1430 + if( led_file == NULL)
1432 + led_file->owner = THIS_MODULE;
1433 + led_file->proc_fops = &led_fops;
1435 + memset( modArr , 0x00 , sizeof(mod_entry_t *) * MAX_MOD_ID);
1436 + /* Reset the GPIO pins */
1437 + board_gpio_init();
1439 + /* Register the UART controlled LEDS */
1441 + /* Create the usb proc file */
1442 + avalanche_leds_init();
1446 + remove_proc_entry("led",led_proc_dir);
1454 + remove_proc_entry("led", led_proc_dir);
1457 +module_init(led_init);
1458 +module_exit(led_exit);
1460 +void register_led_drv( int device , led_reg_t *pInfo)
1462 + unsigned int flags;
1463 + struct timer_list *pTimer = NULL;
1465 + spin_lock_irqsave(&config_lock, flags);
1467 + led_arr[device].led = pInfo;
1468 + if( led_arr[device].led->init != 0x00)
1469 + led_arr[device].led->init(led_arr[device].led->param);
1470 + if( led_arr[device].led->offfunc != 0x00)
1471 + led_arr[device].led->offfunc(led_arr[device].led->param);
1473 + /* Create a timer for blinking */
1474 + pTimer = kmalloc(sizeof(struct timer_list),GFP_KERNEL);
1475 + init_timer( pTimer );
1476 + pTimer->function = led_timer_func;
1478 + led_arr[device].pTimer = pTimer;
1479 + led_arr[device].timer_running = 0;
1481 + spin_unlock_irqrestore(&config_lock, flags);
1486 +void deregister_led_drv( int device)
1488 + unsigned int flags;
1490 + spin_lock_irqsave(&config_lock, flags);
1491 + led_arr[device].led = NULL;
1493 + if( led_arr[device].pTimer != NULL)
1495 + del_timer(led_arr[device].pTimer);
1496 + kfree(led_arr[device].pTimer);
1498 + spin_unlock_irqrestore(&config_lock, flags);
1503 +EXPORT_SYMBOL_NOVERS(led_operation);
1504 +EXPORT_SYMBOL_NOVERS(register_led_drv);
1505 +EXPORT_SYMBOL_NOVERS(deregister_led_drv);
1507 diff -urN linux.old/drivers/char/avalanche_led/leds.c linux.dev/drivers/char/avalanche_led/leds.c
1508 --- linux.old/drivers/char/avalanche_led/leds.c 1970-01-01 01:00:00.000000000 +0100
1509 +++ linux.dev/drivers/char/avalanche_led/leds.c 2005-07-12 03:08:48.265220512 +0200
1511 +#include <linux/config.h>
1512 +#include <linux/init.h>
1513 +#include <linux/delay.h>
1514 +#include <asm/ar7/avalanche_regs.h>
1515 +#include <linux/spinlock.h>
1516 +#include <linux/timer.h>
1517 +#include <linux/sched.h>
1518 +#include <linux/module.h>
1519 +#include <linux/proc_fs.h>
1520 +#include <asm/uaccess.h>
1521 +#include <linux/fs.h>
1523 +#include <asm/ar7/ledapp.h>
1525 +#if defined(CONFIG_AR5D01) || defined(CONFIG_AR5W01) || defined(CONFIG_AR7)
1527 +#define ETH_MASK 0x01
1528 +#define USB_MASK 0x02
1530 +static struct proc_dir_entry *usb_file;
1531 +static ssize_t proc_read_usb_fops(struct file *filp,
1532 + char *buf,size_t count , loff_t *offp);
1533 +struct file_operations usb_fops = {read: proc_read_usb_fops};
1535 +typedef struct mod_states{
1542 +mod_states_t state_arr[] = {
1543 + { MOD_ETH,DEF_ETH_ACTIVITY,DEF_ETH_LINK_UP,DEF_ETH_IDLE },
1544 + { MOD_USB,DEF_USB_ACTIVITY,DEF_USB_LINK_UP,DEF_USB_IDLE },
1545 + { MOD_LAN,DEF_LAN_ACTIVITY,DEF_LAN_LINK_UP,DEF_LAN_IDLE }
1548 +unsigned char device_links = 0; /* Bitmask with the devices that are up */
1551 +void avalanche_led_activity_pulse(unsigned long device)
1553 + /* If device link is not up return */
1554 + if( !(device_links & (unsigned char)(1 << device)))
1556 +#ifdef MULTIPLEX_LED
1557 + led_operation( state_arr[2].module, state_arr[2].activity);
1559 + led_operation( state_arr[device].module, state_arr[device].activity);
1563 +void avalanche_led_link_up( unsigned long device )
1566 + /* If already UP ignore */
1567 + if( device_links & (unsigned char)(1 << device))
1569 + /* Turn on the bit for the device */
1570 + device_links |= (unsigned char)(1 << device);
1571 +#ifdef MULTIPLEX_LED
1572 + led_operation( state_arr[2].module, state_arr[2].linkup);
1574 + led_operation( state_arr[device].module, state_arr[device].linkup);
1578 +void avalanche_led_link_down ( unsigned long device )
1581 + /* If already DOWN ignore */
1582 + if( !(device_links & (unsigned char)(1 << device)))
1585 + /* Turn off the bit for the device */
1586 + device_links &= ~(unsigned char)(1 << device);
1587 +#ifdef MULTIPLEX_LED
1588 + /* If no links, then shut the LED off */
1590 + led_operation( state_arr[2].module, state_arr[2].idle);
1592 + led_operation( state_arr[device].module, state_arr[device].idle);
1596 +static ssize_t proc_read_usb_fops(struct file *filp,
1597 + char *buf,size_t count , loff_t *offp)
1599 + char * pdata = NULL;
1604 + if( device_links & USB_MASK)
1605 + sprintf(line,"%s\n","1");
1607 + sprintf(line,"%s\n","0");
1608 + copy_to_user(pdata,line,2);
1614 +void avalanche_leds_init(void)
1616 + /* Create usb link proc file */
1617 + usb_file = create_proc_entry("avalanche/usb_link", 0444, NULL);
1618 + if( usb_file == NULL)
1620 + usb_file->owner = THIS_MODULE;
1621 + usb_file->proc_fops = &usb_fops;
1625 +EXPORT_SYMBOL(avalanche_led_activity_pulse);
1626 +EXPORT_SYMBOL(avalanche_led_link_up);
1627 +EXPORT_SYMBOL(avalanche_led_link_down);
1630 +/* We make a dummy init routine for the platforms that do not support this led
1634 +void avalanche_leds_init(void)
1644 diff -urN linux.old/drivers/char/avalanche_led/Makefile linux.dev/drivers/char/avalanche_led/Makefile
1645 --- linux.old/drivers/char/avalanche_led/Makefile 1970-01-01 01:00:00.000000000 +0100
1646 +++ linux.dev/drivers/char/avalanche_led/Makefile 2005-07-12 03:08:48.265220512 +0200
1648 +# File: drivers/char/avalanche_led/Makefile
1650 +# Makefile for the Linux LED device driver.
1654 +O_TARGET := avalanche_led.o
1655 +obj-m := avalanche_led.o
1656 +list-multi := avalanche_led.o
1658 +EXTRA_CFLAGS := -I$(TOPDIR)/include/asm/ar7
1660 +export-objs := ledmod.o leds.o
1662 +avalanche_led-objs := ledmod.o gpio.o uartled.o leds.o
1664 +include $(TOPDIR)/Rules.make
1666 +avalanche_led.o: $(avalanche_led-objs)
1667 + $(LD) -r -o $@ $(avalanche_led-objs)
1670 + rm -f core *.o *.a *.s
1671 diff -urN linux.old/drivers/char/avalanche_led/uartled.c linux.dev/drivers/char/avalanche_led/uartled.c
1672 --- linux.old/drivers/char/avalanche_led/uartled.c 1970-01-01 01:00:00.000000000 +0100
1673 +++ linux.dev/drivers/char/avalanche_led/uartled.c 2005-07-12 03:08:48.266220360 +0200
1675 +#include <linux/kernel.h>
1676 +#include <asm/uaccess.h>
1677 +#include <linux/spinlock.h>
1678 +#include <asm/ar7/avalanche_regs.h>
1679 +#include <asm/ar7/ledapp.h>
1681 +#define UART_LED_REG (*(volatile unsigned int *)(UARTA_BASE + 0x10))
1683 +static spinlock_t device_lock;
1684 +led_reg_t temp1[2];
1686 +static void uart_led_on(unsigned long param)
1688 + unsigned long flags;
1690 + spin_lock_irqsave(&device_lock,flags);
1691 + UART_LED_REG &= 0xFFFD;
1692 + spin_unlock_irqrestore(&device_lock, flags);
1695 +static void uart_led_off ( unsigned long param )
1697 + unsigned int flags = 0x00;
1698 + spin_lock_irqsave(&device_lock, flags);
1699 + UART_LED_REG |= 0x02;
1700 + spin_unlock_irqrestore(&device_lock, flags);
1703 +void uart_led_init(void)
1706 +#if defined(CONFIG_AR5D01)
1707 + /* Register led 6 UART Pin 1 */
1708 + temp1[0].param = 0;
1709 + temp1[0].init = NULL;
1710 + temp1[0].onfunc = uart_led_on;
1711 + temp1[0].offfunc = uart_led_off;
1712 + register_led_drv( 6 , &temp1[0]);
1715 +#if defined(CONFIG_AR5W01)
1716 + /* Register led 8 UART Pin 1 */
1717 + temp1[0].param = 0;
1718 + temp1[0].init = NULL;
1719 + temp1[0].onfunc = uart_led_on;
1720 + temp1[0].offfunc = uart_led_off;
1721 + register_led_drv( 8 , &temp1[0]);
1724 + /* Initialize the link mask */
1725 + device_lock = SPIN_LOCK_UNLOCKED;
1730 diff -urN linux.old/drivers/char/Config.in linux.dev/drivers/char/Config.in
1731 --- linux.old/drivers/char/Config.in 2005-07-10 20:53:55.650624032 +0200
1732 +++ linux.dev/drivers/char/Config.in 2005-07-12 03:07:20.861507896 +0200
1733 @@ -133,6 +133,10 @@
1737 +if [ "$CONFIG_AR7" = "y" ]; then
1738 + bool 'Enable LED support' CONFIG_MIPS_AVALANCHE_LED
1741 if [ "$CONFIG_EXPERIMENTAL" = "y" -a "$CONFIG_ZORRO" = "y" ]; then
1742 tristate 'Commodore A2232 serial support (EXPERIMENTAL)' CONFIG_A2232
1744 diff -urN linux.old/drivers/char/Makefile linux.dev/drivers/char/Makefile
1745 --- linux.old/drivers/char/Makefile 2005-07-10 20:53:55.651623880 +0200
1746 +++ linux.dev/drivers/char/Makefile 2005-07-12 03:07:20.861507896 +0200
1747 @@ -190,6 +190,19 @@
1748 obj-$(CONFIG_PCI) += keyboard.o $(KEYMAP)
1752 +# Texas Intruments LED driver
1754 +ifeq ($(CONFIG_MIPS_AVALANCHE_LED),y)
1755 +obj-$(CONFIG_MIPS_AVALANCHE_LED) += avalanche_led/avalanche_led.o
1756 +subdir-$(CONFIG_MIPS_AVALANCHE_LED) += avalanche_led
1759 +ifeq ($(CONFIG_MIPS_AVALANCHE_LED),m)
1760 +obj-$(CONFIG_MIPS_AVALANCHE_LED) += avalanche_led/avalanche_led.o
1761 +subdir-$(CONFIG_MIPS_AVALANCHE_LED) += avalanche_led
1764 obj-$(CONFIG_HIL) += hp_keyb.o
1765 obj-$(CONFIG_MAGIC_SYSRQ) += sysrq.o
1766 obj-$(CONFIG_ATARI_DSP56K) += dsp56k.o
1767 diff -urN linux.old/include/asm-mips/ar7/ledapp.h linux.dev/include/asm-mips/ar7/ledapp.h
1768 --- linux.old/include/asm-mips/ar7/ledapp.h 1970-01-01 01:00:00.000000000 +0100
1769 +++ linux.dev/include/asm-mips/ar7/ledapp.h 2005-07-12 03:08:48.266220360 +0200
1771 +#ifndef __LED_APP__
1772 +#define __LED_APP__
1774 +#define CONF_FILE "/etc/led.conf"
1775 +#define LED_PROC_FILE "/proc/led_mod/led"
1777 +#define CONFIG_LED_MODULE
1779 +#define MAX_MOD_ID 25
1780 +#define MAX_STATE_ID 25
1781 +#define MAX_LED_ID 25
1784 +#define DEF_ADSL_IDLE 1
1785 +#define DEF_ADSL_TRAINING 2
1786 +#define DEF_ADSL_SYNC 3
1787 +#define DEF_ADSL_ACTIVITY 4
1790 +#define DEF_WAN_IDLE 1
1791 +#define DEF_WAN_NEGOTIATE 2
1792 +#define DEF_WAN_SESSION 3
1795 +#define DEF_LAN_IDLE 1
1796 +#define DEF_LAN_LINK_UP 2
1797 +#define DEF_LAN_ACTIVITY 3
1800 +#define DEF_WLAN_IDLE 1
1801 +#define DEF_WLAN_LINK_UP 2
1802 +#define DEF_WLAN_ACTIVITY 3
1805 +#define DEF_USB_IDLE 1
1806 +#define DEF_USB_LINK_UP 2
1807 +#define DEF_USB_ACTIVITY 3
1810 +#define DEF_ETH_IDLE 1
1811 +#define DEF_ETH_LINK_UP 2
1812 +#define DEF_ETH_ACTIVITY 3
1814 +typedef struct config_elem{
1815 + unsigned char name;
1816 + unsigned char state;
1817 + unsigned char mode;
1818 + unsigned char led;
1822 +typedef struct led_reg{
1823 + unsigned int param;
1824 + void (*init)(unsigned long param);
1825 + void (*onfunc)(unsigned long param);
1826 + void (*offfunc)(unsigned long param);