summaryrefslogtreecommitdiff
path: root/wct4xxp
diff options
context:
space:
mode:
authorkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-01-16 01:43:50 +0000
committerkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-01-16 01:43:50 +0000
commitde9128a1e6b5ef6d91146b5b7d984efb1778fc34 (patch)
treebcfcc94bf639aa3b7ad09efb74aefbd71a79e23c /wct4xxp
parent905c0014c3982c5a88a2b9d0a0f740d39b979be4 (diff)
Merged revisions 1820 via svnmerge from
https://origsvn.digium.com/svn/zaptel/branches/1.4 ................ r1820 | kpfleming | 2007-01-15 19:37:26 -0600 (Mon, 15 Jan 2007) | 11 lines Merged revisions 1818 via svnmerge from https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r1818 | kpfleming | 2007-01-15 19:28:54 -0600 (Mon, 15 Jan 2007) | 3 lines eliminate the fw2h tool, and instead use objcopy to directly make object files from the firmware binary files pass HOTPLUG_FIRMWARE down to the module build so that we can avoid various compiler warnings ........ ................ git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1822 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wct4xxp')
-rw-r--r--wct4xxp/Kbuild33
-rw-r--r--wct4xxp/Makefile23
-rw-r--r--wct4xxp/base.c9
-rw-r--r--wct4xxp/fw2h.c64
-rw-r--r--wct4xxp/vpm450m.c14
5 files changed, 35 insertions, 108 deletions
diff --git a/wct4xxp/Kbuild b/wct4xxp/Kbuild
index 0fc1d76..ea6148b 100644
--- a/wct4xxp/Kbuild
+++ b/wct4xxp/Kbuild
@@ -1,32 +1,23 @@
-# yes, this is redundant... the Kbuild system is changing to hostprogs-y,
-# but we need to be able to support older verions as well
-
-# If hotplug firmware loading is disabled, do our header based stuff
-ifeq ($(HOTPLUG_FIRMWARE),no)
-
-host-progs := fw2h
-hostprogs-y := fw2h
-
-FIRMWARE := $(obj)/vpmoct128_fw.h $(obj)/vpmoct064_fw.h
-
-$(obj)/vpmoct128_fw.h: $(src)/OCT6114-128D.ima $(obj)/fw2h
- $(obj)/fw2h $< $@
-
-$(obj)/vpmoct064_fw.h: $(src)/OCT6114-64D.ima $(obj)/fw2h
- $(obj)/fw2h $< $@
-
-endif
-
obj-m += wct4xxp.o
EXTRA_CFLAGS := -I$(src)/.. $(shell $(src)/../oct612x/octasic-helper cflags $(src)/../oct612x) -Wno-undef
wct4xxp-objs := base.o vpm450m.o $(shell $(src)/../oct612x/octasic-helper objects ../oct612x)
+ifneq ($(HOTPLUG_FIRMWARE),yes)
+wct4xxp-objs += firmware_oct6114-64d.o firmware_oct6114-128d.o
+endif
+
$(obj)/base.o: $(src)/vpm450m.h $(src)/wct4xxp.h
$(obj)/base.o: $(src)/../zaptel.h
-$(obj)/vpm450m.o: $(FIRMWARE) $(src)/vpm450m.h
+$(obj)/vpm450m.o: $(src)/vpm450m.h
$(obj)/vpm450m.o: $(src)/../oct612x/include/oct6100api/oct6100_api.h
-clean-files := vpmoct128_fw.h vpmoct064_fw.h
+$(obj)/firmware_oct6114-64d.o: $(src)/OCT6114-64D.ima $(obj)/base.o
+ @echo Making firmware object file for $(notdir $<)
+ @cd $(src) && ../build_tools/make_firmware_object $(notdir $<) $@ $(obj)/base.o
+
+$(obj)/firmware_oct6114-128d.o: $(src)/OCT6114-128D.ima $(obj)/base.o
+ @echo Making firmware object file for $(notdir $<)
+ @cd $(src) && ../build_tools/make_firmware_object $(notdir $<) $@ $(obj)/base.o
diff --git a/wct4xxp/Makefile b/wct4xxp/Makefile
index 503b396..7fe2869 100644
--- a/wct4xxp/Makefile
+++ b/wct4xxp/Makefile
@@ -14,24 +14,21 @@ all: wct4xxp.o
base.o: ../zaptel.h vpm450m.h wct4xxp.h
-vpm450m.o: vpm450m.h vpmoct128_fw.h vpmoct064_fw.h ../oct612x/include/oct6100api/oct6100_api.h
+vpm450m.o: vpm450m.h ../oct612x/include/oct6100api/oct6100_api.h
-wct4xxp.o: base.o vpm450m.o $(OCTASIC_OBJS)
- $(LD) -r -o $@ $^
-
-fw2h: fw2h.c
- $(HOSTCC) -o $@ $^
+firmware_oct6114-64d.o: OCT6114-64D.ima base.o
+ @echo Making firmware object file for $<
+ ../build_tools/make_firmware_object $< $@ base.o
-vpmoct128_fw.h: OCT6114-128D.ima fw2h
- ./fw2h $< $@
+firmware_oct6114-128d.o: OCT6114-128D.ima base.o
+ @echo Making firmware object file for $<
+ ../build_tools/make_firmware_object $< $@ base.o
-vpmoct064_fw.h: OCT6114-64D.ima fw2h
- ./fw2h $< $@
+wct4xxp.o: base.o vpm450m.o $(OCTASIC_OBJS) firmware_oct6114-64d.o firmware_oct6114-128d.o
+ $(LD) -r -o $@ $^
clean:
- rm -f *.o fw2h
- rm -f vpmoct128_fw.h
- rm -f vpmoct064_fw.h
+ rm -f *.o
rm -f $(OCTASIC_OBJS)
endif
diff --git a/wct4xxp/base.c b/wct4xxp/base.c
index 1ba83ae..6cbfbc5 100644
--- a/wct4xxp/base.c
+++ b/wct4xxp/base.c
@@ -50,6 +50,11 @@
#include "wct4xxp.h"
#include "vpm450m.h"
+#ifdef HOTPLUG_FIRMWARE
+static const char *oct064_firmware = "OCT6114-64D.ima";
+static const char *oct128_firmware = "OCT6114-128D.ima";
+#endif
+
/*
* Tasklets provide better system interactive response at the cost of the
* possibility of losing a frame of data at very infrequent intervals. If
@@ -62,10 +67,6 @@
/* #define ENABLE_TASKLETS */
-/* Firmware filenames, used for hotplug firmware loading */
-static const char *oct064_firmware = "OCT6114-64D.ima";
-static const char *oct128_firmware = "OCT6114-128D.ima";
-
/* Work queues are a way to better distribute load on SMP systems */
#ifdef LINUX26
/*
diff --git a/wct4xxp/fw2h.c b/wct4xxp/fw2h.c
deleted file mode 100644
index 61ff53a..0000000
--- a/wct4xxp/fw2h.c
+++ /dev/null
@@ -1,64 +0,0 @@
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-
-int main(int argc, char *argv[])
-{
- char *c = NULL, *fw_hdr_name = NULL;
- int fd, res, x;
- FILE *f = NULL;
- unsigned char buf[1024];
-
- /* Make sure we have the right amount of arguments */
- if (argc != 3) {
- fprintf(stderr, "Usage: fw2h <infile> <outfile>\n");
- exit(1);
- }
-
- /* Make sure we can open the firmware in file */
- if ((fd = open(argv[1], O_RDONLY)) < 0) {
- fprintf(stderr, "Unable to open '%s': %s\n", argv[1], strerror(errno));
- exit(1);
- }
-
- /* Make sure we can write out the firmware header file */
- if (!(f = fopen(argv[2], "w+"))) {
- fprintf(stderr, "Unable to open '%s' for writing: %s\n", argv[2], strerror(errno));
- exit(1);
- }
-
- /* Strip file extension */
- c = strrchr(argv[2], '.');
- if (c)
- *c = '\0';
-
- /* Now determine the firmware header name */
- c = strrchr(argv[2], '/');
- if (c)
- fw_hdr_name = ++c;
- else
- fw_hdr_name = argv[2];
-
- /* Write out the firmware as a header file */
- fprintf(f, "static unsigned char %s[] = {\t", fw_hdr_name);
- while ((res = read(fd, buf, sizeof(buf))) > 0) {
- for (x = 0; x < res; x++) {
- if (!(x % 16))
- fprintf(f, "\n\t");
- fprintf(f, "0x%02x, ", buf[x]);
- }
- }
- fprintf(f, "\n};\n");
-
- if (res < 0) {
- fprintf(stderr, "Error reading file: %s\n", strerror(errno));
- exit(1);
- }
-
- fclose(f);
- close(fd);
- exit(0);
-}
diff --git a/wct4xxp/vpm450m.c b/wct4xxp/vpm450m.c
index 8c3ac83..5eb40eb 100644
--- a/wct4xxp/vpm450m.c
+++ b/wct4xxp/vpm450m.c
@@ -13,8 +13,10 @@
#ifdef HOTPLUG_FIRMWARE
#include <linux/firmware.h>
#else
-#include "vpmoct128_fw.h"
-#include "vpmoct064_fw.h"
+extern unsigned char _binary_OCT6114_64D_ima_start;
+extern unsigned int _binary_OCT6114_64D_ima_size;
+extern unsigned char _binary_OCT6114_128D_ima_start;
+extern unsigned int _binary_OCT6114_128D_ima_size;
#endif
#include "oct6100api/oct6100_api.h"
@@ -409,11 +411,11 @@ struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans)
ChipOpen.ulImageSize = firmware->size;
#else
if (vpm450m->numchans > 64) {
- ChipOpen.pbyImageFile = vpmoct128_fw;
- ChipOpen.ulImageSize = sizeof(vpmoct128_fw);
+ ChipOpen.pbyImageFile = &_binary_OCT6114_128D_ima_start;
+ ChipOpen.ulImageSize = _binary_OCT6114_128D_ima_size;
} else {
- ChipOpen.pbyImageFile = vpmoct064_fw;
- ChipOpen.ulImageSize = sizeof(vpmoct064_fw);
+ ChipOpen.pbyImageFile = &_binary_OCT6114_64D_ima_start;
+ ChipOpen.ulImageSize = _binary_OCT6114_64D_ima_size;
}
#endif