forked from M-Labs/artiq
runtime: support boards without RTIO CRG
This commit is contained in:
parent
a89f96e24b
commit
7928ee4a6e
|
@ -33,7 +33,7 @@ void rtiocrg_init(void)
|
||||||
|
|
||||||
int rtiocrg_check(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();
|
return rtio_crg_pll_locked_read();
|
||||||
#else
|
#else
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -44,6 +44,7 @@ int rtiocrg_switch_clock(int clk)
|
||||||
{
|
{
|
||||||
int current_clk;
|
int current_clk;
|
||||||
|
|
||||||
|
#ifdef CSR_RTIO_CRG_BASE
|
||||||
current_clk = rtio_crg_clock_sel_read();
|
current_clk = rtio_crg_clock_sel_read();
|
||||||
if(clk == current_clk) {
|
if(clk == current_clk) {
|
||||||
#ifdef CSR_RTIO_CRG_PLL_RESET_ADDR
|
#ifdef CSR_RTIO_CRG_PLL_RESET_ADDR
|
||||||
|
@ -64,4 +65,7 @@ int rtiocrg_switch_clock(int clk)
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
|
#else /* CSR_RTIO_CRG_BASE */
|
||||||
|
return 1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ static void leds(char *value)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CSR_RTIO_CRG_BASE
|
||||||
static void clksrc(char *value)
|
static void clksrc(char *value)
|
||||||
{
|
{
|
||||||
char *c;
|
char *c;
|
||||||
|
@ -57,6 +58,7 @@ static void clksrc(char *value)
|
||||||
|
|
||||||
rtio_crg_clock_sel_write(value2);
|
rtio_crg_clock_sel_write(value2);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void ttloe(char *n, char *value)
|
static void ttloe(char *n, char *value)
|
||||||
{
|
{
|
||||||
|
@ -563,7 +565,9 @@ static void help(void)
|
||||||
{
|
{
|
||||||
puts("Available commands:");
|
puts("Available commands:");
|
||||||
puts("help - this message");
|
puts("help - this message");
|
||||||
|
#ifdef CSR_RTIO_CRG_BASE
|
||||||
puts("clksrc <n> - select RTIO clock source");
|
puts("clksrc <n> - select RTIO clock source");
|
||||||
|
#endif
|
||||||
puts("ttloe <n> <v> - set TTL output enable");
|
puts("ttloe <n> <v> - set TTL output enable");
|
||||||
puts("ttlo <n> <v> - set TTL output value");
|
puts("ttlo <n> <v> - set TTL output value");
|
||||||
puts("ddsbus <n> - select the DDS bus RTIO channel");
|
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));
|
else if(strcmp(token, "leds") == 0) leds(get_token(&c));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CSR_RTIO_CRG_BASE
|
||||||
else if(strcmp(token, "clksrc") == 0) clksrc(get_token(&c));
|
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, "ttloe") == 0) ttloe(get_token(&c), get_token(&c));
|
||||||
else if(strcmp(token, "ttlo") == 0) ttlo(get_token(&c), get_token(&c));
|
else if(strcmp(token, "ttlo") == 0) ttlo(get_token(&c), get_token(&c));
|
||||||
|
|
Loading…
Reference in New Issue