forked from M-Labs/artiq
1
0
Fork 0

runtime: support boards without LEDS

This commit is contained in:
Sebastien Bourdeauducq 2016-07-27 19:16:55 +08:00
parent 5fc3a52189
commit a89f96e24b
2 changed files with 10 additions and 0 deletions

View File

@ -231,10 +231,14 @@ static void blink_led(void)
long long int t; long long int t;
for(i=0;i<3;i++) { for(i=0;i<3;i++) {
#ifdef CSR_LEDS_BASE
leds_out_write(1); leds_out_write(1);
#endif
t = clock_get_ms(); t = clock_get_ms();
while(clock_get_ms() < t + 250); while(clock_get_ms() < t + 250);
#ifdef CSR_LEDS_BASE
leds_out_write(0); leds_out_write(0);
#endif
t = clock_get_ms(); t = clock_get_ms();
while(clock_get_ms() < t + 250); while(clock_get_ms() < t + 250);
} }

View File

@ -18,6 +18,7 @@
#include "clock.h" #include "clock.h"
#include "test_mode.h" #include "test_mode.h"
#ifdef CSR_LEDS_BASE
static void leds(char *value) static void leds(char *value)
{ {
char *c; char *c;
@ -36,6 +37,7 @@ static void leds(char *value)
leds_out_write(value2); leds_out_write(value2);
} }
#endif
static void clksrc(char *value) static void clksrc(char *value)
{ {
@ -573,7 +575,9 @@ static void help(void)
puts("ddsfud - pulse FUD"); puts("ddsfud - pulse FUD");
puts("ddsftw <n> <d> - write FTW"); puts("ddsftw <n> <d> - write FTW");
puts("ddstest <c> <n> - perform test sequence on DDS"); puts("ddstest <c> <n> - perform test sequence on DDS");
#ifdef CSR_LEDS_BASE
puts("leds <n> - set LEDs"); puts("leds <n> - set LEDs");
#endif
#if (defined CSR_SPIFLASH_BASE && defined CONFIG_SPIFLASH_PAGE_SIZE) #if (defined CSR_SPIFLASH_BASE && defined CONFIG_SPIFLASH_PAGE_SIZE)
puts("fserase - erase flash storage"); puts("fserase - erase flash storage");
puts("fswrite <k> <v> - write to flash storage"); puts("fswrite <k> <v> - write to flash storage");
@ -640,7 +644,9 @@ static void do_command(char *c)
token = get_token(&c); token = get_token(&c);
if(strcmp(token, "help") == 0) help(); if(strcmp(token, "help") == 0) help();
#ifdef CSR_LEDS_BASE
else if(strcmp(token, "leds") == 0) leds(get_token(&c)); else if(strcmp(token, "leds") == 0) leds(get_token(&c));
#endif
else if(strcmp(token, "clksrc") == 0) clksrc(get_token(&c)); else if(strcmp(token, "clksrc") == 0) clksrc(get_token(&c));