mirror of https://github.com/m-labs/artiq.git
runtime: support boards without DDS
This commit is contained in:
parent
8fab789e39
commit
f1d8848bb1
|
@ -18,6 +18,7 @@ static void rtio_output_blind(int channel, int addr, int data)
|
|||
rtio_o_we_write(1);
|
||||
}
|
||||
|
||||
#if ((defined RTIO_DDS_COUNT) && (RTIO_DDS_COUNT > 0))
|
||||
static void dds_write(int bus_channel, int addr, int data)
|
||||
{
|
||||
rtio_output_blind(bus_channel, addr, data);
|
||||
|
@ -39,6 +40,7 @@ static int dds_read(int bus_channel, int addr)
|
|||
rtio_i_re_write(1);
|
||||
return r;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void send_ready(void)
|
||||
{
|
||||
|
@ -73,6 +75,7 @@ void bridge_main(void)
|
|||
mailbox_acknowledge();
|
||||
break;
|
||||
}
|
||||
#if ((defined RTIO_DDS_COUNT) && (RTIO_DDS_COUNT > 0))
|
||||
case MESSAGE_TYPE_BRG_DDS_SEL: {
|
||||
struct msg_brg_dds_sel *msg;
|
||||
|
||||
|
@ -119,6 +122,7 @@ void bridge_main(void)
|
|||
mailbox_acknowledge();
|
||||
break;
|
||||
}
|
||||
#endif /* RTIO_DDS_COUNT */
|
||||
default:
|
||||
mailbox_acknowledge();
|
||||
break;
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
#include <generated/csr.h>
|
||||
|
||||
#if ((defined RTIO_DDS_COUNT) && (RTIO_DDS_COUNT > 0))
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "artiq_personality.h"
|
||||
|
@ -221,3 +224,5 @@ void dds_set(long long int timestamp, int bus_channel, int channel,
|
|||
ftw, pow, phase_mode, amplitude);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* RTIO_DDS_COUNT */
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#include <generated/csr.h>
|
||||
#include <generated/mem.h>
|
||||
|
||||
#if ((defined RTIO_DDS_COUNT) && (RTIO_DDS_COUNT > 0))
|
||||
|
||||
/* Maximum number of commands in a batch */
|
||||
#define DDS_MAX_BATCH 16
|
||||
|
||||
|
@ -60,4 +62,6 @@ void dds_batch_exit(void);
|
|||
void dds_set(long long int timestamp, int bus_channel, int channel,
|
||||
unsigned int ftw, unsigned int pow, int phase_mode, unsigned int amplitude);
|
||||
|
||||
#endif /* RTIO_DDS_COUNT */
|
||||
|
||||
#endif /* __DDS_H */
|
||||
|
|
|
@ -118,10 +118,12 @@ static const struct symbol runtime_exports[] = {
|
|||
{"rtio_input_timestamp", &rtio_input_timestamp},
|
||||
{"rtio_input_data", &rtio_input_data},
|
||||
|
||||
#if ((defined RTIO_DDS_COUNT) && (RTIO_DDS_COUNT > 0))
|
||||
{"dds_init", &dds_init},
|
||||
{"dds_batch_enter", &dds_batch_enter},
|
||||
{"dds_batch_exit", &dds_batch_exit},
|
||||
{"dds_set", &dds_set},
|
||||
#endif
|
||||
|
||||
{"i2c_init", &i2c_init},
|
||||
{"i2c_start", &i2c_start},
|
||||
|
|
|
@ -38,13 +38,15 @@ struct monitor_reply {
|
|||
long long int ttl_overrides;
|
||||
unsigned short int dds_rtio_first_channel;
|
||||
unsigned short int dds_channels_per_bus;
|
||||
#if ((defined RTIO_DDS_COUNT) && (RTIO_DDS_COUNT > 0))
|
||||
unsigned int dds_ftws[CONFIG_RTIO_DDS_COUNT*CONFIG_DDS_CHANNELS_PER_BUS];
|
||||
#endif
|
||||
} __attribute__((packed));
|
||||
|
||||
static void moninj_monitor(const ip_addr_t *addr, u16_t port)
|
||||
{
|
||||
struct monitor_reply reply;
|
||||
int i, j;
|
||||
int i;
|
||||
struct pbuf *reply_p;
|
||||
|
||||
reply.ttl_levels = 0;
|
||||
|
@ -66,6 +68,9 @@ static void moninj_monitor(const ip_addr_t *addr, u16_t port)
|
|||
reply.ttl_overrides |= 1LL << i;
|
||||
}
|
||||
|
||||
#if ((defined RTIO_DDS_COUNT) && (RTIO_DDS_COUNT > 0))
|
||||
int j;
|
||||
|
||||
reply.dds_rtio_first_channel = CONFIG_RTIO_FIRST_DDS_CHANNEL;
|
||||
reply.dds_channels_per_bus = CONFIG_DDS_CHANNELS_PER_BUS;
|
||||
for(j=0;j<CONFIG_RTIO_DDS_COUNT;j++) {
|
||||
|
@ -76,6 +81,10 @@ static void moninj_monitor(const ip_addr_t *addr, u16_t port)
|
|||
reply.dds_ftws[CONFIG_DDS_CHANNELS_PER_BUS*j+i] = rtio_moninj_mon_value_read();
|
||||
}
|
||||
}
|
||||
#else
|
||||
reply.dds_rtio_first_channel = 0;
|
||||
reply.dds_channels_per_bus = 0;
|
||||
#endif
|
||||
|
||||
reply_p = pbuf_alloc(PBUF_TRANSPORT, sizeof(struct monitor_reply), PBUF_RAM);
|
||||
if(!reply_p) {
|
||||
|
|
|
@ -108,6 +108,8 @@ static void ttlo(char *n, char *value)
|
|||
brg_ttlo(n2, value2);
|
||||
}
|
||||
|
||||
#if ((defined RTIO_DDS_COUNT) && (RTIO_DDS_COUNT > 0))
|
||||
|
||||
static int bus_channel = CONFIG_RTIO_FIRST_DDS_CHANNEL;
|
||||
|
||||
static void ddsbus(char *n)
|
||||
|
@ -360,6 +362,7 @@ static void ddstest(char *n, char *channel)
|
|||
do_ddstest_one(j);
|
||||
}
|
||||
}
|
||||
#endif /* RTIO_DDS_COUNT */
|
||||
|
||||
#if (defined CSR_SPIFLASH_BASE && defined CONFIG_SPIFLASH_PAGE_SIZE)
|
||||
static void fsread(char *key)
|
||||
|
@ -659,6 +662,7 @@ static void do_command(char *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));
|
||||
|
||||
#if ((defined RTIO_DDS_COUNT) && (RTIO_DDS_COUNT > 0))
|
||||
else if(strcmp(token, "ddsbus") == 0) ddsbus(get_token(&c));
|
||||
else if(strcmp(token, "ddssel") == 0) ddssel(get_token(&c));
|
||||
else if(strcmp(token, "ddsw") == 0) ddsw(get_token(&c), get_token(&c));
|
||||
|
@ -668,6 +672,7 @@ static void do_command(char *c)
|
|||
else if(strcmp(token, "ddsfud") == 0) ddsfud();
|
||||
else if(strcmp(token, "ddsftw") == 0) ddsftw(get_token(&c), get_token(&c));
|
||||
else if(strcmp(token, "ddstest") == 0) ddstest(get_token(&c), get_token(&c));
|
||||
#endif
|
||||
|
||||
#if (defined CSR_SPIFLASH_BASE && defined CONFIG_SPIFLASH_PAGE_SIZE)
|
||||
else if(strcmp(token, "fserase") == 0) fs_erase();
|
||||
|
|
Loading…
Reference in New Issue