Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: m-labs/flickernoise
base: 66e5947
...
head fork: m-labs/flickernoise
compare: 002aa33
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on Mar 03, 2012
@wpwrak wpwrak usb load: show how many bytes were loaded
Not having this seemingly redundant information caused quite the
ghost hunt when we loaded only the first 4 kB, chopping off some
code at the end.
58b27b0
@wpwrak wpwrak usb debug: emit a newline only before returning to the shell
Before, we ended the line each time usb_debug_flush returned, causing
"usb debug wait" to potentially produce very choppy output.
73b5506
@wpwrak wpwrak Merge branch 'master' of github.com:milkymist/flickernoise 002aa33
Showing with 19 additions and 8 deletions.
  1. +15 −3 src/shellext.c
  2. +4 −5 src/usbfirmware.c
View
18 src/shellext.c
@@ -251,10 +251,10 @@ static int main_pfpu(int argc, char **argv)
static uint8_t debug_consume = 0;
static volatile int keypress_wait;
+static int nl = 1;
static void usb_debug_flush(void)
{
- int nl = 1;
char c;
while(debug_consume != COMLOC_DEBUG_PRODUCE) {
@@ -263,8 +263,14 @@ static void usb_debug_flush(void)
nl = c == '\n';
debug_consume++;
}
- if(!nl)
+}
+
+static void end_line(void)
+{
+ if(!nl) {
putchar('\n');
+ nl = 1;
+ }
}
static rtems_task keypress_task(rtems_task_argument argument)
@@ -283,6 +289,7 @@ static int usb_debug(int argc, char **argv)
if(argc == 1) {
usb_debug_flush();
+ end_line();
return 0;
}
@@ -301,16 +308,21 @@ static int usb_debug(int argc, char **argv)
rtems_task_wake_after(1);
}
while(keypress_wait);
+ end_line();
return 0;
}
static int usb_load(int argc, char **argv)
{
- if(!load_usb_firmware_file(argv[1])) {
+ int size;
+
+ size = load_usb_firmware_file(argv[1]);
+ if(size < 0) {
fprintf(stderr, "load failed\n");
return 2;
}
+ printf("loaded %d byte%s\n", size, size == 1 ? "" : "s");
debug_consume = 0;
return 0;
}
View
9 src/usbfirmware.c
@@ -63,11 +63,10 @@ int load_usb_firmware_file(const char *name)
file = fopen(name, "r");
if(!file)
- return 0;
+ return -1;
dsc.length = fread(buf, 1, sizeof(buf), file);
fclose(file);
- if(dsc.length <= 0)
- return 0;
- do_load_usb_firmware(&dsc);
- return 1;
+ if(dsc.length >= 0)
+ do_load_usb_firmware(&dsc);
+ return dsc.length;
}

No commit comments for this range

Something went wrong with that request. Please try again.