Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a61d701d47eb
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 050db0b0f5e0
Choose a head ref
  • 2 commits
  • 5 files changed
  • 1 contributor

Commits on May 2, 2015

  1. Copy the full SHA
    8fe5c7a View commit details
  2. Copy the full SHA
    050db0b View commit details
Showing with 66 additions and 11 deletions.
  1. +10 −2 soc/runtime/bridge.c
  2. +2 −0 soc/runtime/kloader.c
  3. +8 −1 soc/runtime/main.c
  4. +3 −1 soc/runtime/messages.h
  5. +43 −7 soc/runtime/test_mode.c
12 changes: 10 additions & 2 deletions soc/runtime/bridge.c
Original file line number Diff line number Diff line change
@@ -20,12 +20,20 @@ void bridge_main(void)
while(1) {
umsg = mailbox_wait_and_receive();
switch(umsg->type) {
case MESSAGE_TYPE_BRG_TTL_OUT: {
case MESSAGE_TYPE_BRG_TTL_OE: {
struct msg_brg_ttl_out *msg;

msg = (struct msg_brg_ttl_out *)umsg;
rtio_init();
rtio_set_oe(rtio_get_counter() + 8000, msg->channel, msg->value);
mailbox_acknowledge();
break;
}
case MESSAGE_TYPE_BRG_TTL_O: {
struct msg_brg_ttl_out *msg;

msg = (struct msg_brg_ttl_out *)umsg;
rtio_init();
rtio_set_oe(rtio_get_counter() + 8000, msg->channel, 1);
rtio_set_o(rtio_get_counter() + 8000, msg->channel, msg->value);
mailbox_acknowledge();
break;
2 changes: 2 additions & 0 deletions soc/runtime/kloader.c
Original file line number Diff line number Diff line change
@@ -100,6 +100,7 @@ void kloader_start_idle_kernel(void)
log("BUG: attempted to start kernel CPU while already running (idle kernel)");
return;
}
#if (defined CSR_SPIFLASH_BASE && defined SPIFLASH_PAGE_SIZE)
len = fs_read("idle_kernel", buffer, sizeof(buffer), NULL);
if(len <= 0)
return;
@@ -113,6 +114,7 @@ void kloader_start_idle_kernel(void)
return;
}
start_kernel_cpu((void *)k);
#endif
}

void kloader_stop_kernel(void)
9 changes: 8 additions & 1 deletion soc/runtime/main.c
Original file line number Diff line number Diff line change
@@ -61,11 +61,14 @@ static int hex2nib(int c)
static void init_macadr(void)
{
static const unsigned char default_macadr[6] = {0x10, 0xe2, 0xd5, 0x32, 0x50, 0x00};
#if (defined CSR_SPIFLASH_BASE && defined SPIFLASH_PAGE_SIZE)
char b[32];
char fs_macadr[6];
int i, r, s;
#endif

memcpy(macadr, default_macadr, 6);
#if (defined CSR_SPIFLASH_BASE && defined SPIFLASH_PAGE_SIZE)
r = fs_read("mac", b, sizeof(b) - 1, NULL);
if(r <= 0)
return;
@@ -81,21 +84,25 @@ static void init_macadr(void)
if(b[3*i + 2] != ':')
return;
memcpy(macadr, fs_macadr, 6);
#endif
}

static void fsip_or_default(struct ip4_addr *d, char *key, int i1, int i2, int i3, int i4)
{
int r;
#if (defined CSR_SPIFLASH_BASE && defined SPIFLASH_PAGE_SIZE)
char cp[32];
#endif

IP4_ADDR(d, i1, i2, i3, i4);

#if (defined CSR_SPIFLASH_BASE && defined SPIFLASH_PAGE_SIZE)
r = fs_read(key, cp, sizeof(cp) - 1, NULL);
if(r <= 0)
return;
cp[r] = 0;
if(!ip4addr_aton(cp, d))
return;
#endif
}

static void network_init(void)
4 changes: 3 additions & 1 deletion soc/runtime/messages.h
Original file line number Diff line number Diff line change
@@ -14,7 +14,8 @@ enum {
MESSAGE_TYPE_LOG,

MESSAGE_TYPE_BRG_READY,
MESSAGE_TYPE_BRG_TTL_OUT,
MESSAGE_TYPE_BRG_TTL_O,
MESSAGE_TYPE_BRG_TTL_OE,
MESSAGE_TYPE_BRG_DDS_SEL,
MESSAGE_TYPE_BRG_DDS_RESET,
MESSAGE_TYPE_BRG_DDS_READ_REQUEST,
@@ -71,6 +72,7 @@ struct msg_log {
/* bridge messages */

struct msg_brg_ttl_out {
/* used for OE and O */
int type;
int channel;
int value;
50 changes: 43 additions & 7 deletions soc/runtime/test_mode.c
Original file line number Diff line number Diff line change
@@ -35,11 +35,21 @@ static void amp_bridge_init(void)
}
}

static void p_ttlout(int n, int value)
static void p_ttloe(int n, int value)
{
struct msg_brg_ttl_out msg;

msg.type = MESSAGE_TYPE_BRG_TTL_OUT;
msg.type = MESSAGE_TYPE_BRG_TTL_OE;
msg.channel = n;
msg.value = value;
mailbox_send_and_wait(&msg);
}

static void p_ttlo(int n, int value)
{
struct msg_brg_ttl_out msg;

msg.type = MESSAGE_TYPE_BRG_TTL_O;
msg.channel = n;
msg.value = value;
mailbox_send_and_wait(&msg);
@@ -142,13 +152,37 @@ static void clksrc(char *value)
rtiocrg_clock_sel_write(value2);
}

static void ttlout(char *n, char *value)
static void ttloe(char *n, char *value)
{
char *c;
unsigned int n2, value2;

if((*n == 0)||(*value == 0)) {
printf("ttloe <n> <value>\n");
return;
}

n2 = strtoul(n, &c, 0);
if(*c != 0) {
printf("incorrect channel\n");
return;
}
value2 = strtoul(value, &c, 0);
if(*c != 0) {
printf("incorrect value\n");
return;
}

p_ttloe(n2, value2);
}

static void ttlo(char *n, char *value)
{
char *c;
unsigned int n2, value2;

if((*n == 0)||(*value == 0)) {
printf("ttlout <n> <value>\n");
printf("ttlo <n> <value>\n");
return;
}

@@ -163,7 +197,7 @@ static void ttlout(char *n, char *value)
return;
}

p_ttlout(n2, value2);
p_ttlo(n2, value2);
}

static void ddssel(char *n)
@@ -341,7 +375,8 @@ static void help(void)
puts("Available commands:");
puts("help - this message");
puts("clksrc <n> - select RTIO clock source");
puts("ttlout <n> <v> - output TTL");
puts("ttloe <n> <v> - set TTL output enable");
puts("ttlo <n> <v> - set TTL output value");
puts("ddssel <n> - select a DDS");
puts("ddsinit - reset, config, FUD DDS");
puts("ddsreset - reset DDS");
@@ -418,7 +453,8 @@ static void do_command(char *c)

else if(strcmp(token, "clksrc") == 0) clksrc(get_token(&c));

else if(strcmp(token, "ttlout") == 0) ttlout(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, "ddssel") == 0) ddssel(get_token(&c));
else if(strcmp(token, "ddsw") == 0) ddsw(get_token(&c), get_token(&c));