Skip to contentSkip to conversation

usx2yloader 0.3

PATCH Karsten Wiese 2 participants 2 messages Sep 18, 2003 – Sep 23, 2003 Kbuild

lore
Share & tools
lore
#0 lore raw

Hallo Takashi,

here is a patch which sports complete us428 initialisation via hotplug, an INSTALL and a README.
I took the phase 1 firmware files from usb-midi-firmware project. Also fixed are some compile warnings.
Maybe the Makefile.am is not completely correct as
I hardcoded the directory /etc/hotplug/usb. But maybe also this is the standard place to put such hotplug files?
Well....here it works.
Please put the stuffs to CVS.
The driver from CVS also works here.

Thanks,
Karsten

Index: Makefile.am
===================================================================
RCS file: /cvsroot/alsa/alsa-tools/usx2yloader/Makefile.am,v retrieving revision 1.1

Makefile.am +5 -0
diff -u -r1.1 Makefile.am
@@ -11,6 +11,11 @@
 
 EXTRA_DIST = depcomp
 
+hotplug_files = tascam_fw.usermap tascam_fw tascam_fpga
+hotplugdir = /etc/hotplug/usb
+hotplug_SCRIPTS = $(hotplug_files)
+
+
 alsa-dist: distdir
 	@rm -rf ../distdir/usx2yloader
 	@mkdir -p ../distdir/usx2yloader

Index: configure.in
===================================================================
RCS file: /cvsroot/alsa/alsa-tools/usx2yloader/configure.in,v retrieving revision 1.1

configure.in +1 -1
diff -u -r1.1 configure.in
@@ -1,5 +1,5 @@
 AC_INIT(usx2yloader.c)
-AM_INIT_AUTOMAKE(usx2yloader, 0.2)
+AM_INIT_AUTOMAKE(usx2yloader, 0.3)
 AC_PROG_CC
 AC_PROG_INSTALL
 AC_HEADER_STDC

Index: usx2yloader.c
===================================================================
RCS file: /cvsroot/alsa/alsa-tools/usx2yloader/usx2yloader.c,v retrieving revision 1.1

usx2yloader.c +10 -15
diff -u -r1.1 usx2yloader.c
@@ -63,15 +63,17 @@
 
 
 /*
- * read a xilinx bitstream file
+ * read a xilinx bitstream file.
+ * NOTE: This interprets somehow differently from the vxloaders read_xilinx_image()!
+ * I took this from rbtload.c of the project usb-midi-fw.sf.net.
  */
 static int read_xilinx_image(snd_hwdep_dsp_image_t *img, const char *fname)
 {
 	FILE *fp;
 	char buf[256];
-	int data, c, idx, length;
+	int data = 0, c = 0, idx = 0, length = 0;
 	char *p;
-	char *imgbuf;
+	char *imgbuf = 0;
 
 	if ((fp = fopen(fname, "r")) == NULL) {
 		fprintf(stderr, PROGNAME ": cannot open %s\n", fname);
@@ -79,10 +81,6 @@
 	}
 	snd_hwdep_dsp_image_set_name(img, fname);
 
-	c = 0;
-	data = 0;
-	idx = 0;
-	length = 0;
 	while (fgets(buf, sizeof(buf), fp)) {
 		if (strncmp(buf, "Bits:", 5) == 0) {
 			for (p = buf + 5; *p && isspace(*p); p++);
@@ -140,15 +138,13 @@
 			}
 		}
 	}
-	if (c)
-		imgbuf[idx++] = data;
-	if (idx != length) {
-		fprintf(stderr,
-			PROGNAME ": length doesn't match: %d != %d\n", idx,
-			length);
+	if (idx != length || 0 == imgbuf) {
+		fprintf(stderr, PROGNAME ": length doesn't match: %d != %d\n", idx, length);
 		fclose(fp);
 		return -EINVAL;
 	}
+	if (c)
+		imgbuf[idx++] = data;
 	snd_hwdep_dsp_image_set_length(img, length);
 	snd_hwdep_dsp_image_set_image(img, imgbuf);
 	fclose(fp);
@@ -223,7 +219,6 @@
 	len = strlen(temp);
 
 	while (fgets(buf, sizeof(buf), fp)) {
-		int prepad;
 		if (strncmp(buf, temp, len))
 			continue;
 
@@ -303,7 +298,7 @@
 {
 	snd_hwdep_t *hw;
 	const char *id;
-	int err, is_pcmcia;
+	int err;
 	unsigned int idx, dsps, loaded;
 	snd_hwdep_dsp_status_t *stat;
 

Index: firmware/Makefile.am
===================================================================
RCS file: /cvsroot/alsa/alsa-tools/usx2yloader/firmware/Makefile.am,v retrieving revision 1.1

Makefile.am +1 -2
diff -u -r1.1 Makefile.am
@@ -1,5 +1,4 @@
-cfg_files = us428.conf us428.prepad us428.rbt
-
+cfg_files = us428.conf us428.prepad us428.rbt tascam_loader.ihx us428fw.ihx
 EXTRA_DIST = $(cfg_files)
 
 firmwaredir = $(datadir)/alsa/firmware
#1 lore raw

Hi Karsten,

At Thu, 18 Sep 2003 22:57:40 +0200,

Quoted 5 lines · Karsten Wiese

Hallo Takashi,

here is a patch which sports complete us428 initialisation via hotplug, an INSTALL and a README.

thanks, i'll commit them.

Quoted 5 lines

I took the phase 1 firmware files from usb-midi-firmware project. Also fixed are some compile warnings.
Maybe the Makefile.am is not completely correct as
I hardcoded the directory /etc/hotplug/usb. But maybe also this is the standard place to put such hotplug files?

i think so. in case it's not, we can add a configure option.

thanks!

Takashi

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf