void led_error (void *arg) { uint16_t al_status,al_status_code; enum led_flash led_state = OFF; for (;;) { /* Led states according to ETG1300 IndicatorLabelingSpecification */ al_status = ESCvar.ALstatus & 0x001f; al_status_code = ESCvar.ALerror; /* Note: Flicker is defined blow aswell * Capture APPLICATION errors that happend during boot */ if ((al_status & ESCboot) && (local_boot_state == BOOT_FAILED)) { led_state = FLICKER; } /* The AL status code == No error or NO AL status Error Indication * of not entered the requested starte */ else if (al_status_code == 0x00 || !(al_status & 0x10)) { led_state = OFF; } /* 0x002D No Sync Error * 0x0032 PLL error */ else if (al_status_code == 0x2D || al_status_code == 0x32 ) { led_state = SINGLE_FLASH; } /* 0x001B SyncManager watchdog */ else if (al_status_code == 0x1B ) { led_state = DOUBLE_FLASH; } /* Booting error, Init state reached but Error Indicator bit is set * to 1 in Al Status * Application BOOT information, fail or not */ else if (al_status & (ESCinit | ESCerror)) { led_state = FLICKER; } /* Invalid Configuration, General configuration change * We'll end here at last if we got errors in ALstatus */ else { led_state = BLINK; } led_handler (led_state,GPIO_LED_RED); } }
static int led_proc_handler(ctl_table *ctl, int write, struct file *filp, void *buffer, size_t *lenp) { int ret; /*add min and max value check*/ ret = proc_dointvec_minmax(ctl, write, filp, buffer, lenp); if (write && (ctl->ctl_name == DEV_KEYLED)) { led_handler(); //show on the led } return ret; }
void led_run (void *arg) { uint16_t al_status; enum led_flash led_state = OFF; for (;;) { /* Led states according to ETG1300 IndicatorLabelingSpecification * RUN led task only used if not ESC pin is connected. */ al_status = ESCvar.ALstatus & 0x1f; if (al_status & ESCop) { led_state = ON; } else if (al_status & ESCinit) { led_state = OFF; } else if (al_status & ESCpreop) { led_state = BLINK; } else if (al_status & ESCsafeop) { led_state = SINGLE_FLASH; } else if (al_status & ESCboot) { led_state = FLICKER; } else { led_state = OFF; } led_handler (led_state, GPIO_LED_RED); } }