[zaptel-commits] file: branch file/zaptel-firmware r1894 - in /team/file/zaptel-firmware: ./ w...

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Mon Jan 22 14:27:04 MST 2007


Author: file
Date: Mon Jan 22 15:27:04 2007
New Revision: 1894

URL: http://svn.digium.com/view/zaptel?view=rev&rev=1894
Log:
Merged revisions 1878,1887,1889,1892 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.4

................
r1878 | kpfleming | 2007-01-22 14:25:21 -0500 (Mon, 22 Jan 2007) | 10 lines

Merged revisions 1877 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.2

........
r1877 | kpfleming | 2007-01-22 12:58:34 -0600 (Mon, 22 Jan 2007) | 2 lines

update to PR47 Octasic API kit, and use new GetCapacityPins API call to only attempt downloading the correct firmware for the modules we find

........

................
r1887 | kpfleming | 2007-01-22 15:59:03 -0500 (Mon, 22 Jan 2007) | 10 lines

Merged revisions 1886 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.2

........
r1886 | kpfleming | 2007-01-22 14:58:30 -0600 (Mon, 22 Jan 2007) | 2 lines

might be good if i committed the working version of this code...

........

................
r1889 | qwell | 2007-01-22 16:04:19 -0500 (Mon, 22 Jan 2007) | 4 lines

Fix typo in Makefile

Issue 8885, patch by James

................
r1892 | kpfleming | 2007-01-22 16:13:37 -0500 (Mon, 22 Jan 2007) | 10 lines

Merged revisions 1891 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.2

........
r1891 | kpfleming | 2007-01-22 15:12:35 -0600 (Mon, 22 Jan 2007) | 2 lines

make the non-hotplug firmware case actually compile again

........

................

Modified:
    team/file/zaptel-firmware/   (props changed)
    team/file/zaptel-firmware/Makefile
    team/file/zaptel-firmware/wct4xxp/base.c
    team/file/zaptel-firmware/wct4xxp/vpm450m.c
    team/file/zaptel-firmware/wct4xxp/vpm450m.h

Propchange: team/file/zaptel-firmware/
------------------------------------------------------------------------------
    automerge = forshizzle

Propchange: team/file/zaptel-firmware/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/file/zaptel-firmware/
------------------------------------------------------------------------------
--- svn:externals (original)
+++ svn:externals Mon Jan 22 15:27:04 2007
@@ -1,2 +1,2 @@
 menuselect https://origsvn.digium.com/svn/menuselect/branches/1.0
-oct612x http://svn.digium.com/svn/octasic_api/oct612x/tags/PR43-01/software
+oct612x http://svn.digium.com/svn/octasic_api/oct612x/tags/PR47-00/software

Propchange: team/file/zaptel-firmware/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Jan 22 15:27:04 2007
@@ -1,1 +1,1 @@
-/branches/1.4:1-1856
+/branches/1.4:1-1893

Modified: team/file/zaptel-firmware/Makefile
URL: http://svn.digium.com/view/zaptel/team/file/zaptel-firmware/Makefile?view=diff&rev=1894&r1=1893&r2=1894
==============================================================================
--- team/file/zaptel-firmware/Makefile (original)
+++ team/file/zaptel-firmware/Makefile Mon Jan 22 15:27:04 2007
@@ -159,7 +159,7 @@
 endif
 
 # Set this to override hotplug firmware loading and revert to classic header
-#HOTPLUG_FIRMWARE=no
+HOTPLUG_FIRMWARE=no
 ifeq ($(HOTPLUG_FIRMWARE),yes)
 CFLAGS+=-DHOTPLUG_FIRMWARE
 endif	
@@ -328,7 +328,7 @@
 		echo "**************************************************"; \
 		exit 1; \
 	fi
-	[ -f misdn-b410p.tar.bz ] || $(DOWNLOAD) ftp://ftp.digium.com/pub/zaptel/b410p/misdn-b410p.tar.gz
+	[ -f misdn-b410p.tar.gz ] || $(DOWNLOAD) ftp://ftp.digium.com/pub/zaptel/b410p/misdn-b410p.tar.gz
 	tar -zxf misdn-b410p.tar.gz
 	$(MAKE) -C misdn install
 	[ -f mISDNuser.tar.gz ] || $(DOWNLOAD) ftp://ftp.digium.com/pub/zaptel/b410p/mISDNuser.tar.gz

Modified: team/file/zaptel-firmware/wct4xxp/base.c
URL: http://svn.digium.com/view/zaptel/team/file/zaptel-firmware/wct4xxp/base.c?view=diff&rev=1894&r1=1893&r2=1894
==============================================================================
--- team/file/zaptel-firmware/wct4xxp/base.c (original)
+++ team/file/zaptel-firmware/wct4xxp/base.c Mon Jan 22 15:27:04 2007
@@ -42,10 +42,8 @@
 #endif
 #ifdef LINUX26
 #include <linux/moduleparam.h>
-#ifdef HOTPLUG_FIRMWARE
-#include <linux/firmware.h>
-#endif
-#endif
+#endif
+
 #include "wct4xxp.h"
 #include "vpm450m.h"
 
@@ -3100,7 +3098,15 @@
 	unsigned int check1, check2;
 	int laws[4] = { 0, };
 	int x;
-	int passedinit = 0;
+	unsigned int vpm_capacity;
+	struct firmware embedded_firmware;
+	const struct firmware *firmware = &embedded_firmware;
+#if !defined(HOTPLUG_FIRMWARE)
+	extern const u32 _binary_zaptel_fw_octasic_064_bin_size;
+	extern const u32 _binary_zaptel_fw_octasic_128_bin_size;
+	extern u8 _binary_zaptel_fw_octasic_064_bin_start;
+	extern u8 _binary_zaptel_fw_octasic_128_bin_start;
+#endif
 
 	if (!vpmsupport) {
 		printk("VPM450: Support Disabled\n");
@@ -3126,46 +3132,37 @@
 			laws[x] = 1;
 	}
 
-#ifndef HOTPLUG_FIRMWARE
-	if ((wc->vpm450m = init_vpm450m(wc, laws, wc->numspans)))
-		passedinit = 1;
+	switch ((vpm_capacity = get_vpm450m_capacity(wc))) {
+	case 64:
+#if defined(HOTPLUG_FIRMWARE)
+		if ((request_firmware(&firmware, zaptel_fw_octasic_064, &wc->dev->dev) != 0) ||
+		    !firmware) {
+			printk("VPM450: firmware %s not available from userspace\n", zaptel_fw_octasic_064);
+			return;
+		}
 #else
-	{
-		const struct firmware *firmware;
-		
-		/* if this is a 4-span card, just try using the 128-channel firmware;
-		   otherwise, try both, because a 2-span card could potentially have
-		   a 128-channel Octasic module
-		*/
-		if (wc->numspans < 3) {
-			if ((request_firmware(&firmware, zaptel_fw_octasic_064, &wc->dev->dev) != 0) ||
-			    !firmware) {
-				printk("VPM450: firmware %s not available from userspace\n", zaptel_fw_octasic_064);
-				return;
-			} else {
-				if ((wc->vpm450m = init_vpm450m(wc, laws, wc->numspans, firmware)))
-					passedinit=1;
-
-				release_firmware(firmware);
-			}
-		}
-
-		if (!passedinit) {
-			if ((request_firmware(&firmware, zaptel_fw_octasic_128, &wc->dev->dev) != 0) ||
-			    !firmware) {
-				printk("VPM450: firmware %s not available from userspace\n", zaptel_fw_octasic_128);
-				return;
-			} else {
-				if ((wc->vpm450m = init_vpm450m(wc, laws, wc->numspans, firmware)))
-					passedinit=1;
-
-				release_firmware(firmware);
-			}
-		}
-	}
-#endif
-
-	if (!passedinit) {
+		embedded_firmware.data = &_binary_zaptel_fw_octasic_064_bin_start;
+		embedded_firmware.size = _binary_zaptel_fw_octasic_064_bin_size;
+#endif
+		break;
+	case 128:
+#if defined(HOTPLUG_FIRMWARE)
+		if ((request_firmware(&firmware, zaptel_fw_octasic_128, &wc->dev->dev) != 0) ||
+		    !firmware) {
+			printk("VPM450: firmware %s not available from userspace\n", zaptel_fw_octasic_128);
+			return;
+		}
+#else
+		embedded_firmware.data = &_binary_zaptel_fw_octasic_128_bin_start;
+		embedded_firmware.size = _binary_zaptel_fw_octasic_128_bin_size;
+#endif
+		break;
+	default:
+		printk("Unsupported channel capacity found on VPM module (%d).\n", vpm_capacity);
+		return;
+	}
+
+	if (!(wc->vpm450m = init_vpm450m(wc, laws, wc->numspans, firmware))) {
 		printk("VPM450: Failed to initialize\n");
 		return;
 	}

Modified: team/file/zaptel-firmware/wct4xxp/vpm450m.c
URL: http://svn.digium.com/view/zaptel/team/file/zaptel-firmware/wct4xxp/vpm450m.c?view=diff&rev=1894&r1=1893&r2=1894
==============================================================================
--- team/file/zaptel-firmware/wct4xxp/vpm450m.c (original)
+++ team/file/zaptel-firmware/wct4xxp/vpm450m.c Mon Jan 22 15:27:04 2007
@@ -10,12 +10,9 @@
 #include <linux/vmalloc.h>
 #include <linux/string.h>
 #include <linux/time.h>
-#ifdef HOTPLUG_FIRMWARE
-#include <linux/firmware.h>
-#endif
-
+
+#include "vpm450m.h"
 #include "oct6100api/oct6100_api.h"
-#include "vpm450m.h"
 
 /* API for Octasic access */
 UINT32 Oct6100UserGetTime(tPOCT6100_GET_TIME f_pTime)
@@ -284,11 +281,8 @@
 	
 	Oct6100InterruptServiceRoutineDef(&InterruptFlags);
 	Oct6100InterruptServiceRoutine(vpm450m->pApiInstance, &InterruptFlags);
-	if (InterruptFlags.fToneEventsPending) {
-		printk("VPM450M: Tone events pending!\n");
-		return 1;
-	}
-	return 0;
+
+	return InterruptFlags.fToneEventsPending ? 1 : 0;
 }
 
 int vpm450m_getdtmf(struct vpm450m *vpm450m, int *channel, int *tone, int *start)
@@ -370,11 +364,28 @@
 	return 0;
 }
 
-#ifdef HOTPLUG_FIRMWARE
+unsigned int get_vpm450m_capacity(void *wc)
+{
+	UINT32 ulResult;
+
+	tOCT6100_API_GET_CAPACITY_PINS CapacityPins;
+
+	Oct6100ApiGetCapacityPinsDef(&CapacityPins);
+	CapacityPins.pProcessContext = wc;
+	CapacityPins.ulMemoryType = cOCT6100_MEM_TYPE_DDR;
+	CapacityPins.fEnableMemClkOut = TRUE;
+	CapacityPins.ulMemClkFreq = cOCT6100_MCLK_FREQ_133_MHZ;
+
+	ulResult = Oct6100ApiGetCapacityPins(&CapacityPins);
+	if (ulResult != cOCT6100_ERR_OK) {
+		printk("Failed to get chip capacity, code %08x!\n", ulResult);
+		return 0;
+	}
+
+	return CapacityPins.ulCapacityValue;
+}
+
 struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans, const struct firmware *firmware)
-#else
-struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans)
-#endif
 {
 	tOCT6100_CHIP_OPEN ChipOpen;
 	tOCT6100_GET_INSTANCE_SIZE InstanceSize;
@@ -383,9 +394,9 @@
 	struct vpm450m *vpm450m;
 	int x,y,law;
 	
-	vpm450m = kmalloc(sizeof(struct vpm450m), GFP_KERNEL);
-	if (!vpm450m)
+	if (!(vpm450m = kmalloc(sizeof(struct vpm450m), GFP_KERNEL)))
 		return NULL;
+
 	memset(vpm450m, 0, sizeof(struct vpm450m));
 	for (x=0;x<128;x++)
 		vpm450m->ecmode[x] = -1;
@@ -401,25 +412,8 @@
 
 	ChipOpen.pProcessContext = wc;
 
-#ifdef HOTPLUG_FIRMWARE
 	ChipOpen.pbyImageFile = firmware->data;
 	ChipOpen.ulImageSize = firmware->size;
-#else
-	if (vpm450m->numchans > 64) {
-		extern const unsigned char _binary_zaptel_fw_octasic_128_bin_start[];
-		extern const unsigned int _binary_zaptel_fw_octasic_128_bin_size;
-
-		ChipOpen.pbyImageFile = _binary_zaptel_fw_octasic_128_bin_start;
-		ChipOpen.ulImageSize = _binary_zaptel_fw_octasic_128_bin_size;
-	} else {
-		extern const unsigned char _binary_zaptel_fw_octasic_064_bin_start[];
-		extern const unsigned int _binary_zaptel_fw_octasic_064_bin_size;
-
-		ChipOpen.pbyImageFile = _binary_zaptel_fw_octasic_064_bin_start;
-		ChipOpen.ulImageSize = _binary_zaptel_fw_octasic_064_bin_size;
-	}
-#endif	
-
 	ChipOpen.fEnableMemClkOut = TRUE;
 	ChipOpen.ulMemClkFreq = cOCT6100_MCLK_FREQ_133_MHZ;
 	ChipOpen.ulMaxChannels = vpm450m->numchans;
@@ -448,9 +442,7 @@
 		return NULL;
 	}
 
-	printk("Before chip open!\n");
 	ulResult = Oct6100ChipOpen(vpm450m->pApiInstance, &ChipOpen);
-	printk("After chip open!\n");
 	if (ulResult != cOCT6100_ERR_OK) {
 		printk("Failed to open chip, code %08x!\n", ulResult);
 		kfree(vpm450m);
@@ -504,6 +496,7 @@
 			}
 		}
 	}
+
 	return vpm450m;
 }
 
@@ -511,6 +504,7 @@
 {
 	UINT32 ulResult;
 	tOCT6100_CHIP_CLOSE ChipClose;
+
 	Oct6100ChipCloseDef(&ChipClose);
 	ulResult = Oct6100ChipClose(vpm450m->pApiInstance, &ChipClose);
 	if (ulResult != cOCT6100_ERR_OK) {

Modified: team/file/zaptel-firmware/wct4xxp/vpm450m.h
URL: http://svn.digium.com/view/zaptel/team/file/zaptel-firmware/wct4xxp/vpm450m.h?view=diff&rev=1894&r1=1893&r2=1894
==============================================================================
--- team/file/zaptel-firmware/wct4xxp/vpm450m.h (original)
+++ team/file/zaptel-firmware/wct4xxp/vpm450m.h Mon Jan 22 15:27:04 2007
@@ -24,23 +24,24 @@
 #ifndef _VPM450M_H
 #define _VPM450M_H
 
+#ifdef LINUX26
+#include <linux/firmware.h>
+#else
+struct firmware {
+	size_t size;
+	u8 *data;
+};
+#endif
+
 struct vpm450m;
-
-#ifdef HOTPLUG_FIRMWARE
-struct firmware;
-#endif
 
 /* From driver */
 unsigned int oct_get_reg(void *data, unsigned int reg);
 void oct_set_reg(void *data, unsigned int reg, unsigned int val);
 
 /* From vpm450m */
-#ifdef HOTPLUG_FIRMWARE
 struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans, const struct firmware *firmware);
-#else
-struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans);
-#endif
-
+unsigned int get_vpm450m_capacity(void *wc);
 void vpm450m_setec(struct vpm450m *instance, int channel, int eclen);
 void vpm450m_setdtmf(struct vpm450m *instance, int channel, int dtmfdetect, int dtmfmute);
 int vpm450m_checkirq(struct vpm450m *vpm450m);



More information about the zaptel-commits mailing list