[svn-commits] mattf: trunk r2533 - in /trunk: ./ wct4xxp/vpm450m.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Thu May 17 13:44:34 MST 2007


Author: mattf
Date: Thu May 17 15:44:34 2007
New Revision: 2533

URL: http://svn.digium.com/view/zaptel?view=rev&rev=2533
Log:
Merged revisions 2532 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.4

........
r2532 | mattf | 2007-05-17 15:35:57 -0500 (Thu, 17 May 2007) | 1 line

Reduce stack usage of VPM450M.  Fix for FC6 module load problems
........

Modified:
    trunk/   (props changed)
    trunk/wct4xxp/vpm450m.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/wct4xxp/vpm450m.c
URL: http://svn.digium.com/view/zaptel/trunk/wct4xxp/vpm450m.c?view=diff&rev=2533&r1=2532&r2=2533
==============================================================================
--- trunk/wct4xxp/vpm450m.c (original)
+++ trunk/wct4xxp/vpm450m.c Thu May 17 15:44:34 2007
@@ -401,9 +401,9 @@
 
 struct vpm450m *init_vpm450m(void *wc, int *isalaw, int numspans, const struct firmware *firmware)
 {
-	tOCT6100_CHIP_OPEN ChipOpen;
+	tOCT6100_CHIP_OPEN *ChipOpen;
 	tOCT6100_GET_INSTANCE_SIZE InstanceSize;
-	tOCT6100_CHANNEL_OPEN ChannelOpen;
+	tOCT6100_CHANNEL_OPEN *ChannelOpen;
 	UINT32 ulResult;
 	struct vpm450m *vpm450m;
 	int x,y,law;
@@ -412,39 +412,57 @@
 		return NULL;
 
 	memset(vpm450m, 0, sizeof(struct vpm450m));
+
+	if (!(ChipOpen = kmalloc(sizeof(tOCT6100_CHIP_OPEN), GFP_KERNEL))) {
+		kfree(vpm450m);
+		return NULL;
+	}
+
+	memset(ChipOpen, 0, sizeof(tOCT6100_CHIP_OPEN));
+
+	if (!(ChannelOpen = kmalloc(sizeof(tOCT6100_CHANNEL_OPEN), GFP_KERNEL))) {
+		kfree(vpm450m);
+		kfree(ChipOpen);
+		return NULL;
+	}
+
+	memset(ChannelOpen, 0, sizeof(tOCT6100_CHANNEL_OPEN));
+
 	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);
+	Oct6100ChipOpenDef(ChipOpen);
 
 	/* Setup Chip Open Parameters */
-	ChipOpen.ulUpclkFreq = cOCT6100_UPCLK_FREQ_33_33_MHZ;
+	ChipOpen->ulUpclkFreq = cOCT6100_UPCLK_FREQ_33_33_MHZ;
 	Oct6100GetInstanceSizeDef(&InstanceSize);
 
-	ChipOpen.pProcessContext = wc;
-
-	ChipOpen.pbyImageFile = firmware->data;
-	ChipOpen.ulImageSize = firmware->size;
-	ChipOpen.fEnableMemClkOut = TRUE;
-	ChipOpen.ulMemClkFreq = cOCT6100_MCLK_FREQ_133_MHZ;
-	ChipOpen.ulMaxChannels = vpm450m->numchans;
-	ChipOpen.ulMemoryType = cOCT6100_MEM_TYPE_DDR;
-	ChipOpen.ulMemoryChipSize = cOCT6100_MEMORY_CHIP_SIZE_32MB;
-	ChipOpen.ulNumMemoryChips = 1;
-	ChipOpen.ulMaxTdmStreams = 4;
-	ChipOpen.aulTdmStreamFreqs[0] = cOCT6100_TDM_STREAM_FREQ_8MHZ;
-	ChipOpen.ulTdmSampling = cOCT6100_TDM_SAMPLE_AT_FALLING_EDGE;
+	ChipOpen->pProcessContext = wc;
+
+	ChipOpen->pbyImageFile = firmware->data;
+	ChipOpen->ulImageSize = firmware->size;
+	ChipOpen->fEnableMemClkOut = TRUE;
+	ChipOpen->ulMemClkFreq = cOCT6100_MCLK_FREQ_133_MHZ;
+	ChipOpen->ulMaxChannels = vpm450m->numchans;
+	ChipOpen->ulMemoryType = cOCT6100_MEM_TYPE_DDR;
+	ChipOpen->ulMemoryChipSize = cOCT6100_MEMORY_CHIP_SIZE_32MB;
+	ChipOpen->ulNumMemoryChips = 1;
+	ChipOpen->ulMaxTdmStreams = 4;
+	ChipOpen->aulTdmStreamFreqs[0] = cOCT6100_TDM_STREAM_FREQ_8MHZ;
+	ChipOpen->ulTdmSampling = cOCT6100_TDM_SAMPLE_AT_FALLING_EDGE;
 #if 0
-	ChipOpen.fEnableAcousticEcho = TRUE;
+	ChipOpen->fEnableAcousticEcho = TRUE;
 #endif		
 
-	ulResult = Oct6100GetInstanceSize(&ChipOpen, &InstanceSize);
+	ulResult = Oct6100GetInstanceSize(ChipOpen, &InstanceSize);
 	if (ulResult != cOCT6100_ERR_OK) {
 		printk("Failed to get instance size, code %08x!\n", ulResult);
 		kfree(vpm450m);
+		kfree(ChipOpen);
+		kfree(ChannelOpen);
 		return NULL;
 	}
 	
@@ -453,13 +471,17 @@
 	if (!vpm450m->pApiInstance) {
 		printk("Out of memory (can't allocate %d bytes)!\n", InstanceSize.ulApiInstanceSize);
 		kfree(vpm450m);
+		kfree(ChipOpen);
+		kfree(ChannelOpen);
 		return NULL;
 	}
 
-	ulResult = Oct6100ChipOpen(vpm450m->pApiInstance, &ChipOpen);
+	ulResult = Oct6100ChipOpen(vpm450m->pApiInstance, ChipOpen);
 	if (ulResult != cOCT6100_ERR_OK) {
 		printk("Failed to open chip, code %08x!\n", ulResult);
 		kfree(vpm450m);
+		kfree(ChipOpen);
+		kfree(ChannelOpen);
 		return NULL;
 	}
 	for (x=0;x<128;x++) {
@@ -474,29 +496,29 @@
 				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;
+			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;
+			ChannelOpen->fEnableToneDisabler = TRUE;
+			ChannelOpen->ulEchoOperationMode = cOCT6100_ECHO_OP_MODE_DIGITAL;
 			
-			ulResult = Oct6100ChannelOpen(vpm450m->pApiInstance, &ChannelOpen);
+			ulResult = Oct6100ChannelOpen(vpm450m->pApiInstance, ChannelOpen);
 			if (ulResult != GENERIC_OK) {
 				printk("Failed to open channel %d!\n", x);
 			}
@@ -511,6 +533,8 @@
 		}
 	}
 
+	kfree(ChipOpen);
+	kfree(ChannelOpen);
 	return vpm450m;
 }
 



More information about the svn-commits mailing list