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: 9b62e7e77bce
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: 53055a045d09
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Apr 28, 2015

  1. Copy the full SHA
    9fceae7 View commit details
  2. Copy the full SHA
    53055a0 View commit details
Showing with 43 additions and 22 deletions.
  1. +1 −1 soc/runtime/flash_storage.h
  2. +6 −8 soc/runtime/session.c
  3. +36 −13 soc/runtime/test_mode.c
2 changes: 1 addition & 1 deletion soc/runtime/flash_storage.h
Original file line number Diff line number Diff line change
@@ -5,8 +5,8 @@
#ifndef __FLASH_STORAGE_H
#define __FLASH_STORAGE_H

void fs_erase(void);
void fs_write(char *key, void *buffer, unsigned int buflen);
unsigned int fs_read(char *key, void *buffer, unsigned int buflen, unsigned int *remain);
void fs_erase(void);

#endif /* __FLASH_STORAGE_H */
14 changes: 6 additions & 8 deletions soc/runtime/session.c
Original file line number Diff line number Diff line change
@@ -64,8 +64,6 @@ enum {
void session_start(void)
{
buffer_in_index = 0;
buffer_out_index_data = 0;
buffer_out_index_mem = 0;
memset(&buffer_out[4], 0, 4);
kloader_stop_kernel();
user_kernel_state = USER_KERNEL_NONE;
@@ -437,8 +435,11 @@ void session_poll(void **data, int *len)
l = get_out_packet_len();
}

*len = l - buffer_out_index_data;
*data = &buffer_out[buffer_out_index_data];
if(l > 0) {
*len = l - buffer_out_index_data;
*data = &buffer_out[buffer_out_index_data];
} else
*len = 0;
}

void session_ack_data(int len)
@@ -449,9 +450,6 @@ void session_ack_data(int len)
void session_ack_mem(int len)
{
buffer_out_index_mem += len;
if(buffer_out_index_mem >= get_out_packet_len()) {
if(buffer_out_index_mem >= get_out_packet_len())
memset(&buffer_out[4], 0, 4);
buffer_out_index_data = 0;
buffer_out_index_mem = 0;
}
}
49 changes: 36 additions & 13 deletions soc/runtime/test_mode.c
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@
#include "mailbox.h"
#include "messages.h"
#include "dds.h"
#include "flash_storage.h"
#include "test_mode.h"

/* bridge access functions */
@@ -323,22 +324,38 @@ static void ddstest(char *n)
}
}

#if (defined CSR_SPIFLASH_BASE && defined SPIFLASH_PAGE_SIZE)
static void fsread(char *key)
{
char buf[256];
int r;

r = fs_read(key, buf, sizeof(buf)-1, NULL);
buf[r] = 0;
puts(buf);
}
#endif

static void help(void)
{
puts("ARTIQ DDS/TTL Tester");
puts("Available commands:");
puts("help - this message");
puts("clksrc <n> - select RTIO clock source");
puts("ttlout <n> <v> - output TTL");
puts("ddssel <n> - select a DDS");
puts("ddsinit - reset, config, FUD DDS");
puts("ddsreset - reset DDS");
puts("ddsw <a> <d> - write to DDS register");
puts("ddsr <a> - read DDS register");
puts("ddsfud - pulse FUD");
puts("ddsftw <n> <d> - write FTW");
puts("ddstest <n> - perform test sequence on DDS");
puts("leds <n> - set LEDs");
puts("help - this message");
puts("clksrc <n> - select RTIO clock source");
puts("ttlout <n> <v> - output TTL");
puts("ddssel <n> - select a DDS");
puts("ddsinit - reset, config, FUD DDS");
puts("ddsreset - reset DDS");
puts("ddsw <a> <d> - write to DDS register");
puts("ddsr <a> - read DDS register");
puts("ddsfud - pulse FUD");
puts("ddsftw <n> <d> - write FTW");
puts("ddstest <n> - perform test sequence on DDS");
puts("leds <n> - set LEDs");
#if (defined CSR_SPIFLASH_BASE && defined SPIFLASH_PAGE_SIZE)
puts("fserase - erase flash storage");
puts("fswrite <k> <v> - write to flash storage");
puts("fsread <k> - read flash storage");
#endif
}

static void readstr(char *s, int size)
@@ -412,6 +429,12 @@ static void do_command(char *c)
else if(strcmp(token, "ddsftw") == 0) ddsftw(get_token(&c), get_token(&c));
else if(strcmp(token, "ddstest") == 0) ddstest(get_token(&c));

#if (defined CSR_SPIFLASH_BASE && defined SPIFLASH_PAGE_SIZE)
else if(strcmp(token, "fserase") == 0) fs_erase();
else if(strcmp(token, "fswrite") == 0) fs_write(get_token(&c), c, strlen(c));
else if(strcmp(token, "fsread") == 0) fsread(get_token(&c));
#endif

else if(strcmp(token, "") != 0)
printf("Command not found\n");
}