Skip to content

Commit

Permalink
.gitignore:
Browse files Browse the repository at this point in the history
    Ignoring generated .inc files.
Makefile:
    Updating paths
firmware/Makefile, firmware/convert.c:
    Generating the .inc files directly from the usbmon dump with sed and awk
    only which should work on all platforms. Removing convert.c as it's not
    needed anymore. Should make it easier to not get merge conflicts because
    of Lindent indented files etc.
  • Loading branch information
trygvis committed Dec 22, 2009
1 parent e3b1547 commit 5ae60b0
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 47 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
Makefile.local

/main
firmware/*.inc
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ all: main
run: main
./main

main: main.o slogic.o firmware.o usbutil.o
main: main.o slogic.o firmware/firmware.o usbutil.o

firmware.c:
$(MAKE) -C firmware
firmware/firmware.o:
$(MAKE) -C firmware firmware.o

clean:
$(MAKE) -C firmware clean
Expand All @@ -28,3 +28,4 @@ indent:
sinclude .deps
.deps: $(wildcard *.c) $(wildcard *.h)
$(CC) $(CFLAGS) $(CPPFLAGS) -MM *.c > .deps
$(MAKE) -C firmware .deps
27 changes: 19 additions & 8 deletions firmware/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
../firmware.h:firmware.h.in firm_cmds.inc firm_data.inc
m4 firmware.h.in > ../firmware.c
convert:convert.c
#firmware.o: firmware.c firmware.h firm_cmds.inc firm_data.inc

firm_cmds.inc:firmware.usbmon
cat firmware.usbmon | grep "s 40" | cut -d ' ' -f 8,9,10 | awk ' { print "0x" 0x$$1 ", 0x" $$2 ", 0x" $$3 ","} ' > firm_cmds.inc
firm_data.inc:convert
cat firmware.usbmon | grep "s 40" | cut -d ' ' -f 13- | sed "s, ,,g" | ./convert > firm_data.inc
firm_cmds.inc: firmware.usbmon
cat firmware.usbmon | \
grep "s 40" | \
cut -d ' ' -f 8,9,10 | \
awk ' { print "0x" 0x$$1 ", 0x" $$2 ", 0x" $$3 ","} ' \
> firm_cmds.inc

firm_data.inc: firmware.usbmon
cat firmware.usbmon | \
awk -F " " '$$5 == "s" && $$6 == 40 { if($$11 > 16) exit 1; printf $$13 $$14 $$15 $$16 }' | \
sed -n -e "s/\(................\)/\1_/g" -e "s/\([0-9a-f][0-9a-f]\)/0x\1, /gp" | \
tr "_" "\n" \
> firm_data.inc

sinclude .deps
.deps: $(wildcard *.c) $(wildcard *.h)
$(CC) $(CFLAGS) $(CPPFLAGS) -MM *.c > .deps

clean:
rm -f convert firm_cmds.inc firm_data.inc
rm -f $(wildcard *.inc) $(wildcard *.o)
29 changes: 0 additions & 29 deletions firmware/convert.c

This file was deleted.

9 changes: 3 additions & 6 deletions firmware/firmware.h.in → firmware/firmware.c
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
/* Firmware for the saleae logic analyzer */
/* Geneated in the firmware directory */

#define INDEX_CMD_REQUEST 0
#define INDEX_CMD_VALUE 1
#define INDEX_PAYLOAD_SIZE 2

unsigned int slogic_firm_cmds[] ={
include(`firm_cmds.inc')
#include "firm_cmds.inc"
};
unsigned char slogic_firm_data[]= {
include(`firm_data.inc')
#include "firm_data.inc"
};

int slogic_firm_cmds_size()
{
return sizeof(slogic_firm_cmds);
return sizeof(slogic_firm_cmds);
}
File renamed without changes.
1 change: 1 addition & 0 deletions slogic.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// vim: ts=8:noexpandtab
#include "slogic.h"
#include "usbutil.h"
#include "firmware/firmware.h"

#include <stdlib.h>
#include <unistd.h>
Expand Down
1 change: 0 additions & 1 deletion slogic.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#define __SLOGIC_H__

#include <libusb.h>
#include "firmware.h"

/* sleep time table */
#define DELAY_FOR_24000000 1
Expand Down

0 comments on commit 5ae60b0

Please sign in to comment.