runtime: support boards without RTIO CRG

This commit is contained in:
Sebastien Bourdeauducq 2016-07-27 19:18:14 +08:00
parent a89f96e24b
commit 7928ee4a6e
2 changed files with 11 additions and 1 deletions

View File

@ -33,7 +33,7 @@ void rtiocrg_init(void)
int rtiocrg_check(void)
{
#ifdef CSR_RTIO_CRG_PLL_RESET_ADDR
#if ((defined CSR_RTIO_CRG_BASE) && (defined CSR_RTIO_CRG_PLL_RESET_ADDR))
return rtio_crg_pll_locked_read();
#else
return 1;
@ -44,6 +44,7 @@ int rtiocrg_switch_clock(int clk)
{
int current_clk;
#ifdef CSR_RTIO_CRG_BASE
current_clk = rtio_crg_clock_sel_read();
if(clk == current_clk) {
#ifdef CSR_RTIO_CRG_PLL_RESET_ADDR
@ -64,4 +65,7 @@ int rtiocrg_switch_clock(int clk)
return 0;
#endif
return 1;
#else /* CSR_RTIO_CRG_BASE */
return 1;
#endif
}

View File

@ -39,6 +39,7 @@ static void leds(char *value)
}
#endif
#ifdef CSR_RTIO_CRG_BASE
static void clksrc(char *value)
{
char *c;
@ -57,6 +58,7 @@ static void clksrc(char *value)
rtio_crg_clock_sel_write(value2);
}
#endif
static void ttloe(char *n, char *value)
{
@ -563,7 +565,9 @@ static void help(void)
{
puts("Available commands:");
puts("help - this message");
#ifdef CSR_RTIO_CRG_BASE
puts("clksrc <n> - select RTIO clock source");
#endif
puts("ttloe <n> <v> - set TTL output enable");
puts("ttlo <n> <v> - set TTL output value");
puts("ddsbus <n> - select the DDS bus RTIO channel");
@ -648,7 +652,9 @@ static void do_command(char *c)
else if(strcmp(token, "leds") == 0) leds(get_token(&c));
#endif
#ifdef CSR_RTIO_CRG_BASE
else if(strcmp(token, "clksrc") == 0) clksrc(get_token(&c));
#endif
else if(strcmp(token, "ttloe") == 0) ttloe(get_token(&c), get_token(&c));
else if(strcmp(token, "ttlo") == 0) ttlo(get_token(&c), get_token(&c));