[svn-commits] sruffell: linux/trunk r9750 - in /linux/trunk/drivers/dahdi: oct612x/include/...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Feb 10 10:22:53 CST 2011


Author: sruffell
Date: Thu Feb 10 10:22:49 2011
New Revision: 9750

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9750
Log:
wct4xxp: Reduce the memory footprint of the hardware echocanceler.

This saves ~300K of kernel memory for each quad or dual span VPM.  Due
to the fact that this change disables caching of the NLP words (among
other things), the time to disable the echocans appears to have
increased by ~1ms.

Before this change:
=======================================================================
0) ! 356.498 us  |  vpm450m_setecmode(); <--- disable
0) ! 387.762 us  |  vpm450m_setecmode(); <--- enable
0) ! 429.839 us  |  vpm450m_setecmode(); <--- disable

]# echo 1 > /proc/sys/vm/drop_caches && free -k
total       used       free     shared    buffers     cached
Mem:       2005352     228368    1776984          0        132
5540
-/+ buffers/cache:     222696    1782656
Swap:       983036          0     983036

After this change:
=======================================================================
0) ! 1109.515 us |  vpm450m_setecmode(); <--- disable
0) ! 339.017 us  |  vpm450m_setecmode(); <--- enable
0) ! 1431.460 us |  vpm450m_setecmode(); <--- disable

]# echo 1 > /proc/sys/vm/drop_caches && free -k
total       used       free     shared    buffers     cached
Mem:       2005352     228080    1777272          0        112
5484
-/+ buffers/cache:     222484    1782868
Swap:       983036          0     983036

Signed-off-by: Shaun Ruffell <sruffell at digium.com>

Modified:
    linux/trunk/drivers/dahdi/oct612x/include/oct6100api/oct6100_channel_inst.h
    linux/trunk/drivers/dahdi/oct612x/include/oct6100api/oct6100_chip_open_inst.h
    linux/trunk/drivers/dahdi/oct612x/include/oct6100api/oct6100_defines.h
    linux/trunk/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c
    linux/trunk/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c
    linux/trunk/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h
    linux/trunk/drivers/dahdi/wct4xxp/vpm450m.c

Modified: linux/trunk/drivers/dahdi/oct612x/include/oct6100api/oct6100_channel_inst.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/oct612x/include/oct6100api/oct6100_channel_inst.h?view=diff&rev=9750&r1=9749&r2=9750
==============================================================================
--- linux/trunk/drivers/dahdi/oct612x/include/oct6100api/oct6100_channel_inst.h (original)
+++ linux/trunk/drivers/dahdi/oct612x/include/oct6100api/oct6100_channel_inst.h Thu Feb 10 10:22:49 2011
@@ -43,10 +43,15 @@
 typedef struct _OCT6100_API_CHANNEL_TDM_
 {
 	/* Laws. */
-	UINT8	byRinPcmLaw;
-	UINT8	bySinPcmLaw;
-	UINT8	byRoutPcmLaw;
-	UINT8	bySoutPcmLaw;
+	UINT8	byRinPcmLaw : 1;
+	UINT8	bySinPcmLaw : 1;
+	UINT8	byRoutPcmLaw : 1;
+	UINT8	bySoutPcmLaw : 1;
+
+	UINT8	byRinNumTssts : 1;
+	UINT8	bySinNumTssts : 1;
+	UINT8	byRoutNumTssts : 1;
+	UINT8	bySoutNumTssts : 1;
 
 	/* RIN port. */
 	UINT16	usRinTimeslot;
@@ -72,86 +77,71 @@
 	UINT16	usSoutBrdcastTsstFirstEntry;
 	UINT16	usSoutBrdcastTsstNumEntry;
 
-	UINT8	byRinNumTssts;
-	UINT8	bySinNumTssts;
-	UINT8	byRoutNumTssts;
-	UINT8	bySoutNumTssts;
-
 } tOCT6100_API_CHANNEL_TDM, *tPOCT6100_API_CHANNEL_TDM;
 
 typedef struct _OCT6100_API_CHANNEL_VQE_
 {
-	UINT8	fEnableNlp;
-	UINT8	fEnableTailDisplacement;
+	UINT8	fEnableNlp : 1;
+	UINT8	fEnableTailDisplacement : 1;
+	UINT8	fSinDcOffsetRemoval : 1;
+	UINT8	fRinDcOffsetRemoval : 1;
+	UINT8	fRinLevelControl : 1;
+	UINT8	fSoutLevelControl : 1;
+	UINT8	fRinAutomaticLevelControl : 1;
+	UINT8	fSoutAutomaticLevelControl : 1;
+	UINT8	fRinHighLevelCompensation : 1;
+	UINT8	fSoutAdaptiveNoiseReduction : 1;
+	UINT8	fDtmfToneRemoval : 1;
+	UINT8	fAcousticEcho : 1;
+	UINT8	byComfortNoiseMode : 1;
+	UINT8	fSoutNaturalListenerEnhancement : 1;
+	UINT8	fRoutNoiseReduction : 1;
+	UINT8	fEnableMusicProtection : 1;
+	UINT8	fIdleCodeDetection : 1;
+	UINT8	byAnrVoiceNoiseSegregation : 1;
+	UINT8	byDoubleTalkBehavior : 1;
+	UINT8	fSoutNoiseBleaching : 1;
+	UINT8	fSoutConferencingNoiseReduction : 1;
+	UINT8	bySoutAutomaticListenerEnhancementGainDb : 1;
+	UINT8	byNonLinearityBehaviorA : 1;
+	UINT8	byNonLinearityBehaviorB : 1;
+	UINT8	bySoutNaturalListenerEnhancementGainDb : 1;
+
+	OCT_INT8	chRinAutomaticLevelControlTargetDb;
+	OCT_INT8	chSoutAutomaticLevelControlTargetDb;
+	
+	OCT_INT8	chRinHighLevelCompensationThresholdDb;
+	
+	OCT_INT8	chRinLevelControlGainDb;
+	OCT_INT8	chSoutLevelControlGainDb;
+
+	OCT_INT8	chDefaultErlDb;
+	OCT_INT8	chAecDefaultErlDb;
+
+	OCT_INT8	chRoutNoiseReductionLevelGainDb;
+	OCT_INT8	chAnrSnrEnhancementDb;
+
+	UINT16	usToneDisablerVqeActivationDelay;
+	UINT16	usAecTailLength;
+
 	UINT16	usTailDisplacement;
 	UINT16	usTailLength;
 
-	UINT8	fSinDcOffsetRemoval;
-	UINT8	fRinDcOffsetRemoval;
-	UINT8	fRinLevelControl;
-	UINT8	fSoutLevelControl;
-	
-	UINT8	fRinAutomaticLevelControl;
-	UINT8	fSoutAutomaticLevelControl;
-	OCT_INT8	chRinAutomaticLevelControlTargetDb;
-	OCT_INT8	chSoutAutomaticLevelControlTargetDb;
-	
-	UINT8	fRinHighLevelCompensation;
-	OCT_INT8	chRinHighLevelCompensationThresholdDb;
-	
-	UINT8	bySoutAutomaticListenerEnhancementGainDb;
-	UINT8	fSoutNaturalListenerEnhancement;
-
-	UINT8	fSoutAdaptiveNoiseReduction;
-	UINT8	fDtmfToneRemoval;
-	UINT8	fAcousticEcho;
-	UINT8	byComfortNoiseMode;
-
-	UINT8	byNonLinearityBehaviorA;
-	UINT8	byNonLinearityBehaviorB;
-	OCT_INT8	chRinLevelControlGainDb;
-	OCT_INT8	chSoutLevelControlGainDb;
-
-	OCT_INT8	chDefaultErlDb;
-	OCT_INT8	chAecDefaultErlDb;
-
-	UINT8	fRoutNoiseReduction;
-	OCT_INT8	chRoutNoiseReductionLevelGainDb;
-	OCT_INT8	chAnrSnrEnhancementDb;
-
-	UINT8	fEnableMusicProtection;
-	UINT8	fIdleCodeDetection;
-
-	UINT8	byAnrVoiceNoiseSegregation;
-	UINT8	bySoutNaturalListenerEnhancementGainDb;
-	
-	UINT16	usToneDisablerVqeActivationDelay;
-	UINT16	usAecTailLength;
-
-	UINT8	byDoubleTalkBehavior;
-	UINT8	fSoutNoiseBleaching;
-	
-
-
-	UINT8	fSoutConferencingNoiseReduction;
-
-
-
 } tOCT6100_API_CHANNEL_VQE, *tPOCT6100_API_CHANNEL_VQE;
 
 typedef struct _OCT6100_API_CHANNEL_CODEC_
 {
-	UINT8	byAdpcmNibblePosition;
-	UINT8	fEnableSilenceSuppression;
-
-	UINT8	byEncoderPort;
-	UINT8	byEncodingRate;
-
-	UINT8	byDecoderPort;
-	UINT8	byDecodingRate;
-	
-	UINT8	byPhase;
-	UINT8	byPhasingType;
+	UINT8	byAdpcmNibblePosition : 1;
+	UINT8	fEnableSilenceSuppression : 1;
+
+	UINT8	byEncoderPort : 1;
+	UINT8	byEncodingRate : 1;
+
+	UINT8	byDecoderPort : 1;
+	UINT8	byDecodingRate : 1;
+	
+	UINT8	byPhase : 1;
+	UINT8	byPhasingType : 1;
 
 } tOCT6100_API_CHANNEL_CODEC, *tPOCT6100_API_CHANNEL_CODEC;
 
@@ -161,16 +151,54 @@
 	/* Channel configuration. */
 
 	/* Flag specifying whether the entry is used or not. */
-	UINT8	fReserved;
+	UINT8	fReserved : 1;
 
 	/* Count used to manage entry handles allocated to user. */
-	UINT8	byEntryOpenCnt;
+	UINT8	byEntryOpenCnt : 1;
 
 	/* Is this a bidirectionnal channel? */
-	UINT8	fBiDirChannel;
+	UINT8	fBiDirChannel : 1;
 
 	/* Enable tone disabler? */
-	UINT8	fEnableToneDisabler;
+	UINT8	fEnableToneDisabler : 1;
+
+	/* Current echo operation mode. */
+	UINT8	byEchoOperationMode : 1;
+
+	UINT8	byToneDisablerStatus : 1;
+
+	UINT8	fMute : 1;
+	UINT8	fTap : 1;
+	UINT8	fBeingTapped : 1;
+	UINT8	fCopyEventCreated : 1;
+
+	UINT8	fSoutBufPlaying : 1;
+	UINT8	fRinBufPlaying : 1;
+
+	UINT8	fRinBufPlayoutNotifyOnStop : 1;
+	UINT8	fRinBufPlayoutRepeatUsed : 1;
+
+
+	UINT8	fSoutBufPlayoutNotifyOnStop : 1;
+	UINT8	fSoutBufPlayoutRepeatUsed : 1;
+
+	UINT8	fRinHardStop : 1;
+	UINT8	fSoutHardStop : 1;
+
+	UINT8	byRinPlayoutStopEventType : 1;
+	UINT8	bySoutPlayoutStopEventType : 1;
+
+	UINT8	fRinBufAdded : 1;
+	UINT8	fSoutBufAdded : 1;
+
+	UINT8	fBufPlayoutActive : 1;
+
+	/* Enable extended tone detection. */
+	UINT8	fEnableExtToneDetection : 1;
+
+	/* State of the codec structure associated to this channel. */
+	UINT8	fSinSoutCodecActive : 1;
+	UINT8	fRinRoutCodecActive : 1;
 
 	/* TSI chariot memory entry for the Rin/Rout stream. */
 	UINT16	usRinRoutTsiMemIndex;
@@ -202,9 +230,6 @@
 	/* Active mixer events count to test for last event. */
 	UINT16	usMixerEventCnt;
 
-	/* User channel ID, transparently passed to the user. */
-	UINT32	ulUserChanId;
-
 	/* Copy events. */
 	UINT16	usSinCopyEventIndex;
 	UINT16	usSoutCopyEventIndex;
@@ -219,15 +244,11 @@
 	/* VQE configuration. */
 	tOCT6100_API_CHANNEL_VQE	VqeConfig;
 
-	/* Current echo operation mode. */
-	UINT8	byEchoOperationMode;
-
 	/* Currently muted ports. */
 	UINT16	usMutedPorts;
 
 	/*=======================================================================*/
 
-	
 	/*=======================================================================*/
 	/* Statistics section. */
 
@@ -251,8 +272,6 @@
 	INT16	sRinAppliedGain;
 	INT16	sSoutAppliedGain;
 
-	UINT8	byToneDisablerStatus;
-
 	/*=======================================================================*/
 
 
@@ -260,11 +279,6 @@
 	/* Bridge information. */
 
 	UINT16	usBridgeIndex;
-
-	UINT8	fMute;
-	UINT8	fTap;
-	UINT8	fBeingTapped;
-	UINT8	fCopyEventCreated;
 
 	UINT16	usLoadEventIndex;
 	UINT16	usSubStoreEventIndex;
@@ -279,34 +293,12 @@
 	/*=======================================================================*/
 	/* Buffer playout information. */
 
-	UINT32	ulRinBufWritePtr;
-	UINT32	ulRinBufSkipPtr;
-	
-	UINT8	fSoutBufPlaying;
-	UINT8	fRinBufPlaying;
-	
-	UINT8	fRinBufPlayoutNotifyOnStop;
-	UINT8	fRinBufPlayoutRepeatUsed;
-
-	UINT32	ulSoutBufWritePtr;
-	UINT32	ulSoutBufSkipPtr;
-
-	UINT8	fSoutBufPlayoutNotifyOnStop;
-	UINT8	fSoutBufPlayoutRepeatUsed;
-
-	UINT8	fRinHardStop;
-	UINT8	fSoutHardStop;
-
-	UINT32	ulRinUserBufPlayoutEventId;
-	UINT32	ulSoutUserBufPlayoutEventId;
-	
-	UINT8	byRinPlayoutStopEventType;
-	UINT8	bySoutPlayoutStopEventType;
-	
-	UINT8	fRinBufAdded;
-	UINT8	fSoutBufAdded;
-	
-	UINT8	fBufPlayoutActive;
+	UINT16	ulRinBufWritePtr;
+	UINT16	ulRinBufSkipPtr;
+	UINT16	ulSoutBufWritePtr;
+	UINT16	ulSoutBufSkipPtr;
+
+	/* User channel ID, transparently passed to the user. */
 	
 	/*=======================================================================*/
 
@@ -323,52 +315,40 @@
 	/*=======================================================================*/
 	/* Extended tone detection info. */
 
-	/* Enable extended tone detection. */
-	UINT8	fEnableExtToneDetection;
 	
 	UINT16	usExtToneChanIndex;
 	UINT16	usExtToneMixerIndex;
 	UINT16	usExtToneTsiIndex;
 
+	/* Index of the phasing TSST */
+	UINT16	usPhasingTsstIndex;
+
 	/* Mode of operation of the channel based on the extended tone detection configuration. */
-	UINT32	ulExtToneChanMode;
+	UINT16	ulExtToneChanMode;
 
 	/*=======================================================================*/
 
 	/* Tone detection state. */
 	/* This array is configured as follow. */
 	/* Index 0 contain event 0 to 31 and Index 1 contains event 32 - 55 */
-	UINT32	aulToneConf[ 2 ];
-	UINT32	ulLastSSToneDetected;
-	UINT32	ulLastSSToneTimestamp;
-
-	/*=======================================================================*/
-
-
-	/*=======================================================================*/
-
-	/* Index of the phasing TSST */
-	UINT16	usPhasingTsstIndex;
-	
-	/* State of the codec structure associated to this channel. */
-	UINT8	fSinSoutCodecActive;
-	UINT8	fRinRoutCodecActive;
+	UINT16	ulLastSSToneDetected;
+	UINT16	ulLastSSToneTimestamp;
+
+
+	UINT16	ulRinUserBufPlayoutEventId;
+	UINT16	ulSoutUserBufPlayoutEventId;
+
+	UINT32	aulToneConf[2];
+	UINT32	ulUserChanId;
+	/*=======================================================================*/
+
+
+	/*=======================================================================*/
+
 
 	/* Codec configuration. */
 	tOCT6100_API_CHANNEL_CODEC	CodecConfig;
 
-	/*=======================================================================*/
-	
-
-
-
-
-
-
-	/* Nlp Conf Dword, index 0 contains the dword where the dword is located. and
-	   index 1 is the actual value of the dword.*/
-	UINT32	aulNlpConfDword[ cOCT6100_MAX_NLP_CONF_DWORD ][ 2 ];
-
 } tOCT6100_API_CHANNEL, *tPOCT6100_API_CHANNEL;
 
 typedef struct _OCT6100_API_BIDIR_CHANNEL_
@@ -377,12 +357,9 @@
 	UINT16	usSecondChanIndex;
 	
 	/* Flag specifying whether the entry is used or not. */
-	UINT8	fReserved;
-
+	UINT8	fReserved : 1;
 	/* Count used to manage entry handles allocated to user. */
-	UINT8	byEntryOpenCnt;
-
-
+	UINT8	byEntryOpenCnt : 1;
 
 } tOCT6100_API_BIDIR_CHANNEL, *tPOCT6100_API_BIDIR_CHANNEL;
 

Modified: linux/trunk/drivers/dahdi/oct612x/include/oct6100api/oct6100_chip_open_inst.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/oct612x/include/oct6100api/oct6100_chip_open_inst.h?view=diff&rev=9750&r1=9749&r2=9750
==============================================================================
--- linux/trunk/drivers/dahdi/oct612x/include/oct6100api/oct6100_chip_open_inst.h (original)
+++ linux/trunk/drivers/dahdi/oct612x/include/oct6100api/oct6100_chip_open_inst.h Thu Feb 10 10:22:49 2011
@@ -129,8 +129,6 @@
 	   allocate on the stack. The size of this array MUST NOT CHANGE (it's
 	   used everywhere). */
 	UINT16	ausSuperArray[ cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ];
-	UINT16	ausSuperArray1[ cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ];
-	UINT16	ausSuperArray2[ cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ];
 
 	/* Chip ID and revision.*/
 	UINT16	usChipId;

Modified: linux/trunk/drivers/dahdi/oct612x/include/oct6100api/oct6100_defines.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/oct612x/include/oct6100api/oct6100_defines.h?view=diff&rev=9750&r1=9749&r2=9750
==============================================================================
--- linux/trunk/drivers/dahdi/oct612x/include/oct6100api/oct6100_defines.h (original)
+++ linux/trunk/drivers/dahdi/oct612x/include/oct6100api/oct6100_defines.h Thu Feb 10 10:22:49 2011
@@ -56,7 +56,7 @@
 #define cOCT6100_INVALID_HANDLE				cOCT6100_FFFFFFFF
 #define cOCT6100_INVALID_TIMESLOT			cOCT6100_FFFFFFFF
 #define cOCT6100_INVALID_STREAM				cOCT6100_FFFFFFFF
-#define cOCT6100_INVALID_VALUE				cOCT6100_FFFFFFFF
+#define cOCT6100_INVALID_VALUE				-1
 #define cOCT6100_INVALID_STAT				cOCT6100_FFFFFFFF
 #define cOCT6100_INVALID_STAT_W				cOCT6100_FFFF
 #define cOCT6100_INVALID_PCM_LAW			cOCT6100_FF
@@ -249,7 +249,7 @@
 
 /* Chip open defines.*/
 #define cOCT6100_INTERNAL_TONE_ARRAY_SIZE	256		/* in words.*/
-#define cOCT6100_INTERNAL_SUPER_ARRAY_SIZE	1024	/* in words.*/
+#define cOCT6100_INTERNAL_SUPER_ARRAY_SIZE	128		/* in words.*/
 
 /* Internal memory mapping.*/
 
@@ -358,7 +358,7 @@
 #define cOCT6100_CHANNEL_ROOT_GLOBAL_CONF_OFFSET	0x0000
 
 #define cOCT6100_NUM_WORDS_PER_TONE_EVENT			32
-#define cOCT6100_NUM_PGSP_EVENT_OUT					2048
+#define cOCT6100_NUM_PGSP_EVENT_OUT					2048 /* CPTAG: Must not be modified, represents number of events stored in hardware. */
 #define cOCT6100_VALID_TONE_EVENT					0x8000
 #define cOCT6100_LOCAL_TIMESTAMP_INCREMENT			32	/* 4 ms increment. */
 #define cOCT6100_ABSOLUTE_MAX_NUM_PGSP_EVENT_OUT	65535
@@ -394,7 +394,7 @@
 #define cOCT6100_IMAGE_AF_CST_OFFSET			0x1000;
 
 /* Max defines.*/
-#define cOCT6100_MAX_ECHO_CHANNELS				672
+#define cOCT6100_MAX_ECHO_CHANNELS				128
 #define cOCT6100_MAX_TSI_CNCTS					1530
 #define cOCT6100_MAX_CALLER_ID_PLAYOUT_BUFFERS	( 3328 + 6 )
 #define cOCT6100_MAX_PLAYOUT_BUFFERS			( 1344 + cOCT6100_MAX_CALLER_ID_PLAYOUT_BUFFERS )
@@ -474,20 +474,23 @@
 /* TSST defines.*/
 #define cOCT6100_UNASSIGNED						cOCT6100_FFFD
 
-#define cOCT6100_MAX_TSSTS						4096
+#define cOCT6100_MAX_TSSTS						(cOCT6100_MAX_ECHO_CHANNELS*4)	/* cOCT6100_MAX_ECHO_CHANNELS channels, 4 TSSTs per channel. */
 #define cOCT6100_TWO_TSSTS_INDEX_MASK			0x8000
 #define cOCT6100_TSST_INDEX_MASK				0x7FFF
 #define cOCT6100_INPUT_TSST						0
 #define cOCT6100_OUTPUT_TSST					1
 
 /* Conference bridges defines.*/
-#define cOCT6100_MAX_MIXER_EVENTS						1344
+/* CPTAG:  No application needs for mixer events.  */
+/* 2 needed for head and tail nodes.  2 more needed to get through channel modify function. */
+/* Careful.  This value cannot be zero.  */
+#define cOCT6100_MAX_MIXER_EVENTS						4
 #define cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE	32
 #define cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED		672
 #define cOCT6100_CONF_NO_DOMINANT_SPEAKER_HNDL			cOCT6100_FFFFFFFE
 
 /* Conversion memory defines.*/
-#define cOCT6100_MAX_CONVERSION_MEMORY_BLOCKS	1344
+#define cOCT6100_MAX_CONVERSION_MEMORY_BLOCKS	(cOCT6100_MAX_ECHO_CHANNELS*2)	/* CPTAG: Max this out to the expected max number of channels * 2, was 1344 */
 
 /* Tone detection defines.*/
 #define cOCT6100_MAX_TONE_NUMBER				55
@@ -586,8 +589,6 @@
 #define cOCT6100_TONE_INFO_STOP_STRING			"[~ToneDetectorInfo]"
 #define cOCT6100_TONE_INFO_EVENT_STRING			"TONEEVENT=0x"
 
-#define cOCT6100_MAX_NLP_CONF_DWORD				20
-
 /* Tail displacement info.*/
 #define cOCT6100_MAX_TAIL_DISPLACEMENT			896
 

Modified: linux/trunk/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c?view=diff&rev=9750&r1=9749&r2=9750
==============================================================================
--- linux/trunk/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c (original)
+++ linux/trunk/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c Thu Feb 10 10:22:49 2011
@@ -5481,7 +5481,7 @@
 	if ( f_pChannelModify->fDisableToneDetection == TRUE )
 	{
 		/* Check if tone detection has been enabled on this channel. */
-		for ( ulToneConfIndex = 0; ulToneConfIndex < ( sizeof( pChanEntry->aulToneConf ) / sizeof(UINT32) ); ulToneConfIndex ++ )
+		for (ulToneConfIndex = 0; ulToneConfIndex < ARRAY_SIZE(pChanEntry->aulToneConf); ulToneConfIndex++)
 		{
 			/* Check if some tone has been activated on this channel. */
 			if ( pChanEntry->aulToneConf[ ulToneConfIndex ] != 0 )

Modified: linux/trunk/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c?view=diff&rev=9750&r1=9749&r2=9750
==============================================================================
--- linux/trunk/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c (original)
+++ linux/trunk/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c Thu Feb 10 10:22:49 2011
@@ -200,7 +200,7 @@
 	f_pChipOpen->fEnableAcousticEcho = FALSE;
 
 	/* Resource allocation parameters. */
-	f_pChipOpen->ulMaxChannels = 672;
+	f_pChipOpen->ulMaxChannels = 256;
 	f_pChipOpen->ulMaxTsiCncts = 0;
 	f_pChipOpen->ulMaxBiDirChannels = 0;
 	f_pChipOpen->ulMaxConfBridges = 0;
@@ -219,7 +219,7 @@
 	f_pChipOpen->fEnableFastH100Mode = FALSE;
 
 	/* Configure the soft tone event buffer. */
-	f_pChipOpen->ulSoftToneEventsBufSize = 2048;
+	f_pChipOpen->ulSoftToneEventsBufSize = 128;
 	f_pChipOpen->fEnableExtToneDetection = FALSE;
 	f_pChipOpen->fEnable2100StopEvent = FALSE;
 
@@ -240,7 +240,7 @@
 	f_pChipOpen->InterruptConfig.ulFatalMemoryTimeout = 100;
 	f_pChipOpen->InterruptConfig.ulErrorH100Timeout = 100;
 	f_pChipOpen->InterruptConfig.ulErrorOverflowToneEventsTimeout = 100;
-	f_pChipOpen->ulMaxRemoteDebugSessions = 1;
+	f_pChipOpen->ulMaxRemoteDebugSessions = 0;
 	f_pChipOpen->ulTdmSampling = cOCT6100_TDM_SAMPLE_AT_3_QUARTERS;
 	for ( i = 0; i < cOCT6100_TDM_STREAM_MAX_GROUPS; i++ )
 		f_pChipOpen->aulTdmStreamFreqs[ i ] = cOCT6100_TDM_STREAM_FREQ_8MHZ;
@@ -321,6 +321,7 @@
 	InstanceSizes = kmalloc(sizeof(tOCT6100_API_INSTANCE_SIZES), GFP_ATOMIC);
 	if (!InstanceSizes)
 		return cOCT6100_ERR_FATAL_0;
+
 	/* Calculate the amount of memory needed for the API instance structure. */
 	ulResult = Oct6100ApiCalculateInstanceSizes( f_pChipOpen, InstanceSizes );
 	if ( ulResult != cOCT6100_ERR_OK ) {
@@ -1180,7 +1181,7 @@
 
 	/*-----------------------------------------------------------------------------*/
 	/* Check soft buffer for tone events size. */
-	if ( f_pChipOpen->ulSoftToneEventsBufSize < cOCT6100_NUM_PGSP_EVENT_OUT ||
+	if (f_pChipOpen->ulSoftToneEventsBufSize < 64 ||
 		 f_pChipOpen->ulSoftToneEventsBufSize > cOCT6100_ABSOLUTE_MAX_NUM_PGSP_EVENT_OUT )
 		return cOCT6100_ERR_OPEN_SOFT_TONE_EVENT_SIZE;
 
@@ -1678,6 +1679,7 @@
 	/*-----------------------------------------------------------------------------*/
 	/* Calculate memory needed for the conference bridges. */
 	ulResult = Oct6100ApiGetConfBridgeSwSizes( f_pChipOpen, f_pInstSizes );
+	/* Calculate memory needed for list and allocation software serialization. */
 	if ( ulResult != cOCT6100_ERR_OK )
 		return ulResult;
 
@@ -1686,8 +1688,6 @@
 	ulResult = Oct6100ApiGetPlayoutBufferSwSizes( f_pChipOpen, f_pInstSizes );
 	if ( ulResult != cOCT6100_ERR_OK )
 		return ulResult;
-
-
 
 	/*-----------------------------------------------------------------------------*/
 	/* Memory needed by soft Rx Event buffers. */
@@ -1741,7 +1741,6 @@
 
 	ulApiInstProcessSpecific = sizeof( tOCT6100_INSTANCE_API );
 	mOCT6100_ROUND_MEMORY_SIZE( ulApiInstProcessSpecific, ulTempVar )
-
 	f_pInstSizes->ulApiInstTotal = 
 									f_pInstSizes->ulChannelList +
 									f_pInstSizes->ulChannelAlloc +

Modified: linux/trunk/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h?view=diff&rev=9750&r1=9749&r2=9750
==============================================================================
--- linux/trunk/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h (original)
+++ linux/trunk/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h Thu Feb 10 10:22:49 2011
@@ -231,67 +231,34 @@
 
 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
 #define mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInst, f_pChanEntry, f_ulAddress, f_pulConfigDword, f_ulResult )	\
-{																												\
-	UINT32	_ulFirstEmptyIndex = 0xFFFFFFFF;																	\
-	UINT32	_i;																									\
-																												\
-	f_ulResult = cOCT6100_ERR_FATAL_8E;																			\
-	(*f_pulConfigDword) = cOCT6100_INVALID_VALUE;																\
-																												\
-	/* Search for the Dword.*/																					\
-	for ( _i = 0; _i < cOCT6100_MAX_NLP_CONF_DWORD; _i++ )														\
-	{																											\
-		if ( ( _ulFirstEmptyIndex == 0xFFFFFFFF ) && ( f_pChanEntry->aulNlpConfDword[ _i ][ 0 ] == 0x0 ) )		\
-			_ulFirstEmptyIndex = _i;																			\
-																												\
-		if ( f_pChanEntry->aulNlpConfDword[ _i ][ 0 ] == f_ulAddress )											\
-		{																										\
-			/* We found the matching Dword.*/																	\
-			(*f_pulConfigDword) = f_pChanEntry->aulNlpConfDword[ _i ][ 1 ];										\
-			f_ulResult = cOCT6100_ERR_OK;																		\
-		}																										\
-	}																											\
-																												\
-	if ( ( _i == cOCT6100_MAX_NLP_CONF_DWORD ) && ( _ulFirstEmptyIndex == 0xFFFFFFFF ) )						\
-	{																											\
-		/* Nothing to do here, a fatal error occured, no memory was left. */									\
-	}																											\
-	else																										\
-	{																											\
-		if ( f_ulResult != cOCT6100_ERR_OK )																	\
-		{																										\
-			tOCT6100_READ_PARAMS	_ReadParams;																\
-			UINT16					_usReadData;																\
-																												\
-			/* We did not found any entry, let's create a new entry.*/											\
-			f_pChanEntry->aulNlpConfDword[ _ulFirstEmptyIndex ][ 0 ] = f_ulAddress;								\
-																												\
-			_ReadParams.pProcessContext = f_pApiInst->pProcessContext;											\
-			mOCT6100_ASSIGN_USER_READ_WRITE_OBJ( f_pApiInst, _ReadParams );										\
-			_ReadParams.ulUserChipId = f_pApiInst->pSharedInfo->ChipConfig.ulUserChipId;						\
-			_ReadParams.pusReadData = &_usReadData;																\
-																												\
-			/* Read the first 16 bits.*/																		\
-			_ReadParams.ulReadAddress = f_ulAddress;															\
-			mOCT6100_DRIVER_READ_API( _ReadParams, f_ulResult );												\
-			if ( f_ulResult == cOCT6100_ERR_OK )																\
-			{																									\
-				/* Save data.*/																					\
-				(*f_pulConfigDword) = _usReadData << 16;														\
-																												\
-				/* Read the last 16 bits .*/																	\
-				_ReadParams.ulReadAddress += 2;																	\
-				mOCT6100_DRIVER_READ_API( _ReadParams, f_ulResult );											\
-				if ( f_ulResult == cOCT6100_ERR_OK )															\
-				{																								\
-					/* Save data.*/																				\
-					(*f_pulConfigDword) |= _usReadData;															\
-					f_ulResult = cOCT6100_ERR_OK;																\
-				}																								\
-			}																									\
-		}																										\
-	}																											\
-}
+{																										\
+	tOCT6100_READ_PARAMS	_ReadParams;																\
+	UINT16					_usReadData;																\
+	f_ulResult = cOCT6100_ERR_FATAL_8E;																	\
+	(*f_pulConfigDword) = cOCT6100_INVALID_VALUE;														\
+																										\
+	_ReadParams.pProcessContext = f_pApiInst->pProcessContext;											\
+	mOCT6100_ASSIGN_USER_READ_WRITE_OBJ(f_pApiInst, _ReadParams);										\
+	_ReadParams.ulUserChipId = f_pApiInst->pSharedInfo->ChipConfig.ulUserChipId;						\
+	_ReadParams.pusReadData = &_usReadData;																\
+																										\
+	/* Read the first 16 bits.*/																		\
+	_ReadParams.ulReadAddress = f_ulAddress;															\
+	mOCT6100_DRIVER_READ_API(_ReadParams, f_ulResult);													\
+	if (f_ulResult == cOCT6100_ERR_OK) {																\
+		/* Save data.*/																					\
+		(*f_pulConfigDword) = _usReadData << 16;														\
+																										\
+		/* Read the last 16 bits .*/																	\
+		_ReadParams.ulReadAddress += 2;																	\
+		mOCT6100_DRIVER_READ_API(_ReadParams, f_ulResult);												\
+		if (f_ulResult == cOCT6100_ERR_OK) {															\
+			/* Save data.*/																				\
+			(*f_pulConfigDword) |= _usReadData;															\
+			f_ulResult = cOCT6100_ERR_OK;																\
+		}																								\
+	}																									\
+}																										\
 
 
 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
@@ -314,59 +281,25 @@
 
 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
 #define mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInst, f_pChanEntry, f_ulAddress, f_ulConfigDword, f_ulResult )	\
-{																											\
-	UINT32	_i;																								\
-	UINT32	_ulLastValue = 0x0;																				\
-																											\
-	/* Search for the Dword.*/																				\
-	for ( _i = 0; _i < cOCT6100_MAX_NLP_CONF_DWORD; _i++ )													\
-	{																										\
-		if ( f_pChanEntry->aulNlpConfDword[ _i ][ 0 ] == f_ulAddress )										\
-		{																									\
-			/* We found the matching Dword.*/																\
-			_ulLastValue = f_pChanEntry->aulNlpConfDword[ _i ][ 1 ];										\
-			f_pChanEntry->aulNlpConfDword[ _i ][ 1 ] = f_ulConfigDword;										\
-			break;																							\
-		}																									\
-	}																										\
-																											\
-	if ( _i == cOCT6100_MAX_NLP_CONF_DWORD )																\
-	{																										\
-		f_ulResult = cOCT6100_ERR_FATAL_8F;																	\
-	}																										\
-	else																									\
-	{																										\
-		/* Write the config DWORD. */																		\
-		tOCT6100_WRITE_PARAMS	_WriteParams;																\
-																											\
-		_WriteParams.pProcessContext = f_pApiInst->pProcessContext;											\
-		mOCT6100_ASSIGN_USER_READ_WRITE_OBJ( f_pApiInst, _WriteParams )										\
-		_WriteParams.ulUserChipId = f_pApiInst->pSharedInfo->ChipConfig.ulUserChipId;						\
-																											\
-			/* Check if it is worth calling the user function. */											\
-		if ( ( f_ulConfigDword & 0xFFFF0000 ) != ( _ulLastValue & 0xFFFF0000 ) )							\
-		{																									\
-			/* Write the first 16 bits. */																	\
-			_WriteParams.ulWriteAddress = f_ulAddress;														\
-			_WriteParams.usWriteData = (UINT16)((f_ulConfigDword >> 16) & 0xFFFF);							\
-			mOCT6100_DRIVER_WRITE_API( _WriteParams, f_ulResult );											\
-		}																									\
-		else																								\
-		{																									\
-			f_ulResult = cOCT6100_ERR_OK;																	\
-		}																									\
-																											\
-		if ( f_ulResult == cOCT6100_ERR_OK )																\
-		{																									\
-			if ( ( f_ulConfigDword & 0x0000FFFF ) != ( _ulLastValue & 0x0000FFFF ) )						\
-			{																								\
-				/* Write the last word. */																	\
-				_WriteParams.ulWriteAddress = f_ulAddress + 2;												\
-				_WriteParams.usWriteData = (UINT16)(f_ulConfigDword & 0xFFFF);								\
-				mOCT6100_DRIVER_WRITE_API( _WriteParams, f_ulResult );										\
-			}																								\
-		}																									\
-	}																										\
+{																										\
+	/* Write the config DWORD. */																		\
+	tOCT6100_WRITE_PARAMS	_WriteParams;																\
+																										\
+	_WriteParams.pProcessContext = f_pApiInst->pProcessContext;											\
+	mOCT6100_ASSIGN_USER_READ_WRITE_OBJ(f_pApiInst, _WriteParams)										\
+	_WriteParams.ulUserChipId = f_pApiInst->pSharedInfo->ChipConfig.ulUserChipId;						\
+																										\
+	/* Write the first 16 bits. */																		\
+	_WriteParams.ulWriteAddress = f_ulAddress;															\
+	_WriteParams.usWriteData = (UINT16)((f_ulConfigDword >> 16) & 0xFFFF);								\
+	mOCT6100_DRIVER_WRITE_API(_WriteParams, f_ulResult);												\
+																										\
+	if (f_ulResult == cOCT6100_ERR_OK) {																\
+		/* Write the last word. */																		\
+		_WriteParams.ulWriteAddress = f_ulAddress + 2;													\
+		_WriteParams.usWriteData = (UINT16)(f_ulConfigDword & 0xFFFF);									\
+		mOCT6100_DRIVER_WRITE_API(_WriteParams, f_ulResult);											\
+	}																									\
 }
 
 

Modified: linux/trunk/drivers/dahdi/wct4xxp/vpm450m.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wct4xxp/vpm450m.c?view=diff&rev=9750&r1=9749&r2=9750
==============================================================================
--- linux/trunk/drivers/dahdi/wct4xxp/vpm450m.c (original)
+++ linux/trunk/drivers/dahdi/wct4xxp/vpm450m.c Thu Feb 10 10:22:49 2011
@@ -172,7 +172,7 @@
 
 struct vpm450m {
 	tPOCT6100_INSTANCE_API pApiInstance;
-	UINT32 aulEchoChanHndl[ 128 ];
+	UINT32 aulEchoChanHndl[128];
 	int chanflags[128];
 	int ecmode[128];
 	int numchans;
@@ -237,7 +237,7 @@
 	modify->ulChannelHndl = vpm450m->aulEchoChanHndl[channel];
 	ulResult = Oct6100ChannelModify(vpm450m->pApiInstance, modify);
 	if (ulResult != GENERIC_OK) {
-		printk(KERN_NOTICE "Failed to apply echo can changes on channel %d!\n", channel);
+		printk(KERN_NOTICE "Failed to apply echo can changes on channel %d %08x!\n", channel, ulResult);
 	} else {
 #ifdef OCTASIC_DEBUG
 		printk(KERN_DEBUG "Echo can on channel %d set to %d\n", channel, mode);
@@ -449,7 +449,7 @@
 
 	memset(ChannelOpen, 0, sizeof(tOCT6100_CHANNEL_OPEN));
 
-	for (x=0;x<128;x++)
+	for (x = 0; x < ARRAY_SIZE(vpm450m->ecmode); x++)
 		vpm450m->ecmode[x] = -1;
 
 	vpm450m->numchans = numspans * 32;
@@ -474,6 +474,12 @@
 	ChipOpen->ulMaxTdmStreams = 4;
 	ChipOpen->aulTdmStreamFreqs[0] = cOCT6100_TDM_STREAM_FREQ_8MHZ;
 	ChipOpen->ulTdmSampling = cOCT6100_TDM_SAMPLE_AT_FALLING_EDGE;
+	ChipOpen->ulMaxFlexibleConfParticipants = 0;
+	ChipOpen->ulMaxConfBridges = 0;
+	ChipOpen->ulMaxRemoteDebugSessions = 0;
+	ChipOpen->fEnableChannelRecording = FALSE;
+	ChipOpen->ulSoftToneEventsBufSize = 64;
+
 #if 0
 	ChipOpen->fEnableAcousticEcho = TRUE;
 #endif		
@@ -486,7 +492,6 @@
 		kfree(ChannelOpen);
 		return NULL;
 	}
-	
 	
 	vpm450m->pApiInstance = vmalloc(InstanceSize.ulApiInstanceSize);
 	if (!vpm450m->pApiInstance) {
@@ -517,7 +522,7 @@
 		kfree(ChannelOpen);
 		return NULL;
 	}
-	for (x=0;x<128;x++) {
+	for (x = 0; x < ARRAY_SIZE(vpm450m->aulEchoChanHndl); x++) {
 		/* 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)) {
@@ -554,8 +559,9 @@
 			ulResult = Oct6100ChannelOpen(vpm450m->pApiInstance, ChannelOpen);
 			if (ulResult != GENERIC_OK) {
 				printk(KERN_NOTICE "Failed to open channel %d!\n", x);
+				continue;
 			}
-			for (y=0;y<sizeof(tones) / sizeof(tones[0]); y++) {
+			for (y = 0; y < ARRAY_SIZE(tones); y++) {
 				tOCT6100_TONE_DETECTION_ENABLE enable;
 				Oct6100ToneDetectionEnableDef(&enable);
 				enable.ulChannelHndl = vpm450m->aulEchoChanHndl[x];




More information about the svn-commits mailing list