firmware: add some FPGA sanity checks; fix led_panic behavior
This commit is contained in:
parent
4904dfe464
commit
3ecf4954a0
12
src/fpga.c
12
src/fpga.c
@ -102,6 +102,10 @@ void fpga_pgm(uint8_t* filename) {
|
|||||||
i=0;
|
i=0;
|
||||||
timeout = getticks() + 100;
|
timeout = getticks() + 100;
|
||||||
fpga_set_prog_b(0);
|
fpga_set_prog_b(0);
|
||||||
|
if(BITBAND(PROGBREG->FIOPIN, PROGBBIT)) {
|
||||||
|
printf("PROGB is stuck high!\n");
|
||||||
|
led_panic();
|
||||||
|
}
|
||||||
uart_putc('P');
|
uart_putc('P');
|
||||||
fpga_set_prog_b(1);
|
fpga_set_prog_b(1);
|
||||||
while(!fpga_get_initb()){
|
while(!fpga_get_initb()){
|
||||||
@ -110,6 +114,10 @@ void fpga_pgm(uint8_t* filename) {
|
|||||||
led_panic();
|
led_panic();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
if(fpga_get_done()) {
|
||||||
|
printf("DONE is stuck high!\n");
|
||||||
|
led_panic();
|
||||||
|
}
|
||||||
LPC_GPIO2->FIOMASK1 = ~(BV(0));
|
LPC_GPIO2->FIOMASK1 = ~(BV(0));
|
||||||
uart_putc('p');
|
uart_putc('p');
|
||||||
|
|
||||||
@ -160,6 +168,10 @@ void fpga_rompgm() {
|
|||||||
led_panic();
|
led_panic();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
if(fpga_get_done()) {
|
||||||
|
printf("DONE is stuck high!\n");
|
||||||
|
led_panic();
|
||||||
|
}
|
||||||
LPC_GPIO2->FIOMASK1 = ~(BV(0));
|
LPC_GPIO2->FIOMASK1 = ~(BV(0));
|
||||||
uart_putc('p');
|
uart_putc('p');
|
||||||
|
|
||||||
|
|||||||
15
src/led.c
15
src/led.c
@ -86,13 +86,16 @@ void toggle_write_led() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void led_panic() {
|
void led_panic() {
|
||||||
|
led_std();
|
||||||
while(1) {
|
while(1) {
|
||||||
LPC_GPIO2->FIODIR |= BV(4) | BV(5);
|
rdyled(1);
|
||||||
LPC_GPIO1->FIODIR |= BV(23);
|
readled(1);
|
||||||
delay_ms(350);
|
writeled(1);
|
||||||
LPC_GPIO2->FIODIR &= ~(BV(4) | BV(5));
|
delay_ms(100);
|
||||||
LPC_GPIO1->FIODIR &= ~BV(23);
|
rdyled(0);
|
||||||
delay_ms(350);
|
readled(0);
|
||||||
|
writeled(0);
|
||||||
|
delay_ms(100);
|
||||||
cli_entrycheck();
|
cli_entrycheck();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user