[svn-commits] mattf: trunk r1555 - /trunk/wct4xxp/
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Sat Nov 4 23:40:45 MST 2006
Author: mattf
Date: Sun Nov 5 00:40:44 2006
New Revision: 1555
URL: http://svn.digium.com/view/zaptel?rev=1555&view=rev
Log:
Add support for VPMOCT64 module
Added:
trunk/wct4xxp/OCT6114-64D.ima (with props)
Modified:
trunk/wct4xxp/Kbuild
trunk/wct4xxp/Makefile
trunk/wct4xxp/base.c
trunk/wct4xxp/vpm450m.c
trunk/wct4xxp/vpm450m.h
Modified: trunk/wct4xxp/Kbuild
URL: http://svn.digium.com/view/zaptel/trunk/wct4xxp/Kbuild?rev=1555&r1=1554&r2=1555&view=diff
==============================================================================
--- trunk/wct4xxp/Kbuild (original)
+++ trunk/wct4xxp/Kbuild Sun Nov 5 00:40:44 2006
@@ -12,10 +12,13 @@
$(obj)/base.o: $(src)/vpm450m.h $(src)/wct4xxp.h
$(obj)/base.o: $(src)/../zaptel.h
-$(obj)/vpm450m.o: $(obj)/vpm450m_fw.h $(src)/vpm450m.h
+$(obj)/vpm450m.o: $(obj)/vpmoct128_fw.h $(obj)/vpmoct064_fw.h $(src)/vpm450m.h
$(obj)/vpm450m.o: $(src)/../oct612x/include/oct6100api/oct6100_api.h
-$(obj)/vpm450m_fw.h: $(src)/OCT6114-128D.ima $(obj)/fw2h
+$(obj)/vpmoct128_fw.h: $(src)/OCT6114-128D.ima $(obj)/fw2h
$(obj)/fw2h $< $@
-clean-files := vpm450m_fw.h
+$(obj)/vpmoct064_fw.h: $(src)/OCT6114-64D.ima $(obj)/fw2h
+ $(obj)/fw2h $< $@
+
+clean-files := vpmoct128_fw.h vpmoct064_fw.h
Modified: trunk/wct4xxp/Makefile
URL: http://svn.digium.com/view/zaptel/trunk/wct4xxp/Makefile?rev=1555&r1=1554&r2=1555&view=diff
==============================================================================
--- trunk/wct4xxp/Makefile (original)
+++ trunk/wct4xxp/Makefile Sun Nov 5 00:40:44 2006
@@ -14,7 +14,7 @@
base.o: ../zaptel.h vpm450m.h wct4xxp.h
-vpm450m.o: vpm450m.h vpm450m_fw.h ../oct612x/include/oct6100api/oct6100_api.h
+vpm450m.o: vpm450m.h vpmoct128_fw.h vpmoct064_fw.h ../oct612x/include/oct6100api/oct6100_api.h
wct4xxp.o: base.o vpm450m.o $(OCTASIC_OBJS)
$(LD) -r -o $@ $^
@@ -22,12 +22,16 @@
fw2h: fw2h.c
$(HOSTCC) -o $@ $^
-vpm450m_fw.h: OCT6114-128D.ima fw2h
+vpmoct128_fw.h: OCT6114-128D.ima fw2h
+ ./fw2h $< $@
+
+vpmoct064_fw.h: OCT6114-64D.ima fw2h
./fw2h $< $@
clean:
rm -f *.o fw2h
- rm -f vpm450m_fw.h
+ rm -f vpmoct128_fw.h
+ rm -f vpmoct064_fw.h
rm -f $(OCTASIC_OBJS)
endif
Added: trunk/wct4xxp/OCT6114-64D.ima
URL: http://svn.digium.com/view/zaptel/trunk/wct4xxp/OCT6114-64D.ima?rev=1555&view=auto
==============================================================================
Binary file - no diff available.
Propchange: trunk/wct4xxp/OCT6114-64D.ima
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: trunk/wct4xxp/base.c
URL: http://svn.digium.com/view/zaptel/trunk/wct4xxp/base.c?rev=1555&r1=1554&r2=1555&view=diff
==============================================================================
--- trunk/wct4xxp/base.c (original)
+++ trunk/wct4xxp/base.c Sun Nov 5 00:40:44 2006
@@ -3102,6 +3102,8 @@
unsigned int check1, check2;
int laws[4] = { 0, };
int x;
+ int try;
+ int passedinit = 0;
#ifdef HOTPLUG_FIRMWARE
const struct firmware *firmware;
#endif
@@ -3122,31 +3124,46 @@
printk("VPM450: Not Present\n");
return;
}
+ /* First try to load the VPMOCT128 then fallback to VPMOCT064 */
+ for (try=0; try<2; try++) {
#ifdef HOTPLUG_FIRMWARE
- if (request_firmware(&firmware, "OCT6114-128D.ima", &wc->dev->dev) != 0 || !firmware) {
- printk("VPM450M: Firmware not found to be loaded\n");
- return;
- }
- printk("VPM450: Firmware of size %zd found\n", firmware->size);
+ if (!try) { /* vpmoct128 */
+ if (request_firmware(&firmware, "OCT6114-128D.ima", &wc->dev->dev) != 0 || !firmware) {
+ printk("VPM450M: firmware OCT6114-128D.ima not found to be loaded\n");
+ continue;
+ }
+ } else { /* vpmoct064 */
+ if (request_firmware(&firmware, "OCT6114-64D.ima", &wc->dev->dev) != 0 || !firmware) {
+ printk("VPM450M: firmware OCT6114-64D not found to be loaded\n");
+ return;
+ }
+ }
+ printk("VPM450: Firmware of size %zd found try=%d\n", firmware->size, try+1);
#else
- printk("VPM450: Using classic method of loading firmware\n");
-#endif
- /* Setup alaw vs ulaw rules */
- for (x=0;x<wc->numspans;x++) {
- if (wc->tspans[x]->span.channels > 24)
- laws[x] = 1;
- }
+ printk("VPM450: Using classic method of loading firmware try=%d\n", try+1);
+#endif
+ /* Setup alaw vs ulaw rules */
+ for (x=0;x<wc->numspans;x++) {
+ if (wc->tspans[x]->span.channels > 24)
+ laws[x] = 1;
+ }
#ifdef HOTPLUG_FIRMWARE
- if (!(wc->vpm450m = init_vpm450m(wc, laws, firmware))) {
+ if ((wc->vpm450m = init_vpm450m(wc, laws, wc->numspans, firmware))) {
+ passedinit=1;
+ break;
+ }
+ release_firmware(firmware);
#else
- if (!(wc->vpm450m = init_vpm450m(wc, laws))) {
-#endif
+ if ((wc->vpm450m = init_vpm450m(wc, laws, wc->numspans))) {
+ passedinit=1;
+ break;
+ }
+#endif
+ }
+ if (!passedinit) {
printk("VPM450: Failed to initialize\n");
return;
}
-#ifdef HOTPLUG_FIRMWARE
- release_firmware(firmware);
-#endif
if (vpmdtmfsupport == -1) {
printk("VPM450: hardware DTMF disabled.\n");
vpmdtmfsupport = 0;
Modified: trunk/wct4xxp/vpm450m.c
URL: http://svn.digium.com/view/zaptel/trunk/wct4xxp/vpm450m.c?rev=1555&r1=1554&r2=1555&view=diff
==============================================================================
--- trunk/wct4xxp/vpm450m.c (original)
+++ trunk/wct4xxp/vpm450m.c Sun Nov 5 00:40:44 2006
@@ -13,7 +13,8 @@
#ifdef HOTPLUG_FIRMWARE
#include <linux/firmware.h>
#else
-#include "vpm450m_fw.h"
+#include "vpmoct128_fw.h"
+#include "vpmoct064_fw.h"
#endif
#include "oct6100api/oct6100_api.h"
@@ -162,6 +163,7 @@
UINT32 aulEchoChanHndl[ 128 ];
int chanflags[128];
int ecmode[128];
+ int numchans;
};
#define FLAG_DTMF (1 << 0)
@@ -372,9 +374,9 @@
}
#ifdef HOTPLUG_FIRMWARE
-struct vpm450m *init_vpm450m(void *wc, int *isalaw, const struct firmware *firmware)
+struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans, const struct firmware *firmware)
#else
-struct vpm450m *init_vpm450m(void *wc, int *isalaw)
+struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans)
#endif
{
tOCT6100_CHIP_OPEN ChipOpen;
@@ -390,6 +392,9 @@
memset(vpm450m, 0, sizeof(struct vpm450m));
for (x=0;x<128;x++)
vpm450m->ecmode[x] = -1;
+
+ vpm450m->numchans = numspans * 32;
+ printk("VPM450: echo cancellation for %d channels\n", vpm450m->numchans);
Oct6100ChipOpenDef(&ChipOpen);
@@ -402,12 +407,17 @@
ChipOpen.pbyImageFile = firmware->data;
ChipOpen.ulImageSize = firmware->size;
#else
- ChipOpen.pbyImageFile = vpm450m_fw;
- ChipOpen.ulImageSize = sizeof(vpm450m_fw);
+ if (vpm450m->numchans > 64) {
+ ChipOpen.pbyImageFile = vpmoct128_fw;
+ ChipOpen.ulImageSize = sizeof(vpmoct128_fw);
+ } else {
+ ChipOpen.pbyImageFile = vpmoct064_fw;
+ ChipOpen.ulImageSize = sizeof(vpmoct064_fw);
+ }
#endif
ChipOpen.fEnableMemClkOut = TRUE;
ChipOpen.ulMemClkFreq = cOCT6100_MCLK_FREQ_133_MHZ;
- ChipOpen.ulMaxChannels = 128;
+ ChipOpen.ulMaxChannels = vpm450m->numchans;
ChipOpen.ulMemoryType = cOCT6100_MEM_TYPE_DDR;
ChipOpen.ulMemoryChipSize = cOCT6100_MEMORY_CHIP_SIZE_32MB;
ChipOpen.ulNumMemoryChips = 1;
@@ -442,46 +452,51 @@
return NULL;
}
for (x=0;x<128;x++) {
- /* span timeslots are interleaved 12341234...
- * therefore, the lower 2 bits tell us which span this timeslot/channel
- */
- if (isalaw[x & 0x03])
- law = cOCT6100_PCM_A_LAW;
- else
- law = cOCT6100_PCM_U_LAW;
- Oct6100ChannelOpenDef(&ChannelOpen);
- ChannelOpen.pulChannelHndl = &vpm450m->aulEchoChanHndl[x];
- ChannelOpen.ulUserChanId = x;
- ChannelOpen.TdmConfig.ulRinPcmLaw = law;
- ChannelOpen.TdmConfig.ulRinStream = 0;
- ChannelOpen.TdmConfig.ulRinTimeslot = x;
- ChannelOpen.TdmConfig.ulSinPcmLaw = law;
- ChannelOpen.TdmConfig.ulSinStream = 1;
- ChannelOpen.TdmConfig.ulSinTimeslot = x;
- ChannelOpen.TdmConfig.ulSoutPcmLaw = law;
- ChannelOpen.TdmConfig.ulSoutStream = 2;
- ChannelOpen.TdmConfig.ulSoutTimeslot = x;
- ChannelOpen.TdmConfig.ulRoutPcmLaw = law;
- ChannelOpen.TdmConfig.ulRoutStream = 3;
- ChannelOpen.TdmConfig.ulRoutTimeslot = x;
- ChannelOpen.VqeConfig.fEnableNlp = TRUE;
- ChannelOpen.VqeConfig.fRinDcOffsetRemoval = TRUE;
- ChannelOpen.VqeConfig.fSinDcOffsetRemoval = TRUE;
-
- ChannelOpen.fEnableToneDisabler = TRUE;
- ChannelOpen.ulEchoOperationMode = cOCT6100_ECHO_OP_MODE_DIGITAL;
-
- ulResult = Oct6100ChannelOpen(vpm450m->pApiInstance, &ChannelOpen);
- if (ulResult != GENERIC_OK) {
- printk("Failed to open channel %d!\n", x);
- }
- for (y=0;y<sizeof(tones) / sizeof(tones[0]); y++) {
- tOCT6100_TONE_DETECTION_ENABLE enable;
- Oct6100ToneDetectionEnableDef(&enable);
- enable.ulChannelHndl = vpm450m->aulEchoChanHndl[x];
- enable.ulToneNumber = tones[y];
- if (Oct6100ToneDetectionEnable(vpm450m->pApiInstance, &enable) != GENERIC_OK)
- printk("Failed to enable tone detection on channel %d for tone %d!\n", x, y);
+ /* execute this loop always on 4 span cards but
+ * on 2 span cards only execute for the channels related to our spans */
+ if (( numspans > 2) || ((x & 0x03) <2)) {
+ /* span timeslots are interleaved 12341234...
+ * therefore, the lower 2 bits tell us which span this
+ * timeslot/channel
+ */
+ if (isalaw[x & 0x03])
+ law = cOCT6100_PCM_A_LAW;
+ else
+ law = cOCT6100_PCM_U_LAW;
+ Oct6100ChannelOpenDef(&ChannelOpen);
+ ChannelOpen.pulChannelHndl = &vpm450m->aulEchoChanHndl[x];
+ ChannelOpen.ulUserChanId = x;
+ ChannelOpen.TdmConfig.ulRinPcmLaw = law;
+ ChannelOpen.TdmConfig.ulRinStream = 0;
+ ChannelOpen.TdmConfig.ulRinTimeslot = x;
+ ChannelOpen.TdmConfig.ulSinPcmLaw = law;
+ ChannelOpen.TdmConfig.ulSinStream = 1;
+ ChannelOpen.TdmConfig.ulSinTimeslot = x;
+ ChannelOpen.TdmConfig.ulSoutPcmLaw = law;
+ ChannelOpen.TdmConfig.ulSoutStream = 2;
+ ChannelOpen.TdmConfig.ulSoutTimeslot = x;
+ ChannelOpen.TdmConfig.ulRoutPcmLaw = law;
+ ChannelOpen.TdmConfig.ulRoutStream = 3;
+ ChannelOpen.TdmConfig.ulRoutTimeslot = x;
+ ChannelOpen.VqeConfig.fEnableNlp = TRUE;
+ ChannelOpen.VqeConfig.fRinDcOffsetRemoval = TRUE;
+ ChannelOpen.VqeConfig.fSinDcOffsetRemoval = TRUE;
+
+ ChannelOpen.fEnableToneDisabler = TRUE;
+ ChannelOpen.ulEchoOperationMode = cOCT6100_ECHO_OP_MODE_DIGITAL;
+
+ ulResult = Oct6100ChannelOpen(vpm450m->pApiInstance, &ChannelOpen);
+ if (ulResult != GENERIC_OK) {
+ printk("Failed to open channel %d!\n", x);
+ }
+ for (y=0;y<sizeof(tones) / sizeof(tones[0]); y++) {
+ tOCT6100_TONE_DETECTION_ENABLE enable;
+ Oct6100ToneDetectionEnableDef(&enable);
+ enable.ulChannelHndl = vpm450m->aulEchoChanHndl[x];
+ enable.ulToneNumber = tones[y];
+ if (Oct6100ToneDetectionEnable(vpm450m->pApiInstance, &enable) != GENERIC_OK)
+ printk("Failed to enable tone detection on channel %d for tone %d!\n", x, y);
+ }
}
}
return vpm450m;
Modified: trunk/wct4xxp/vpm450m.h
URL: http://svn.digium.com/view/zaptel/trunk/wct4xxp/vpm450m.h?rev=1555&r1=1554&r2=1555&view=diff
==============================================================================
--- trunk/wct4xxp/vpm450m.h (original)
+++ trunk/wct4xxp/vpm450m.h Sun Nov 5 00:40:44 2006
@@ -21,9 +21,9 @@
/* From vpm450m2 */
#ifdef HOTPLUG_FIRMWARE
-extern struct vpm450m *init_vpm450m(void *wc, int *isalaw, const struct firmware *firmware);
+extern struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans, const struct firmware *firmware);
#else
-extern struct vpm450m *init_vpm450m(void *wc, int *isalaw);
+extern struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans);
#endif
extern void vpm450m_setec(struct vpm450m *instance, int channel, int eclen);
extern void vpm450m_setdtmf(struct vpm450m *instance, int channel, int dtmfdetect, int dtmfmute);
More information about the svn-commits
mailing list