From a7f82c0ffe1abc3b5db7839ee67e8d105628066a Mon Sep 17 00:00:00 2001 From: kevin Date: Fri, 7 Aug 2015 18:32:04 -0400 Subject: [PATCH] cmProc5.h/c : Updated cmGoldSig to use LPF instead of BPF. --- cmProc5.c | 28 ++++++++++++++++++++++++++-- cmProc5.h | 3 ++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/cmProc5.c b/cmProc5.c index a0f6449..afcc545 100644 --- a/cmProc5.c +++ b/cmProc5.c @@ -209,6 +209,8 @@ void _cmGoldSigModulate( cmGoldSig_t* p, unsigned chIdx ) cmGoldSig_t* cmGoldSigAlloc( cmCtx* ctx, cmGoldSig_t* p, const cmGoldSigArg_t* a ) { cmGoldSig_t* op = cmObjAlloc(cmGoldSig_t,ctx,p); + + p->fir = cmFIRAllocKaiser(ctx, NULL, 0, 0, 0, 0, 0, 0, 0 ); if( a != NULL ) if( cmGoldSigInit(op,a) != cmOkRC ) @@ -236,7 +238,8 @@ cmRC_t cmGoldSigFree( cmGoldSig_t** pp ) cmMemFree(p->ch[i].bbV); cmMemFree(p->ch[i].mdV); } - + + cmFIRFree(&p->fir); cmMemFree(p->ch); cmMemFree(p->rcosV); cmMemFree(p->pnM); @@ -270,6 +273,27 @@ cmRC_t cmGoldSigInit( cmGoldSig_t* p, const cmGoldSigArg_t* a ) // generate the rcos impulse response _cmGoldSigRaisedCos(p->rcosV,p->rcosN,a->samplesPerChip,a->rcosBeta); + if(1) + { + double passHz = 20000.0; + double stopHz = 17000.0; + double passDb = 1.0; + double stopDb = 90.0; + unsigned flags = 0; + + if( cmFIRInitKaiser(p->fir, 64, a->srate, passHz, stopHz, passDb, stopDb, flags ) != cmOkRC ) + { + rc = cmCtxRtCondition(&p->obj,cmSubSysFailRC,"Unable to allocate internal FIR."); + goto errLabel; + } + + p->rcosN = p->fir->coeffCnt; + p->rcosV = cmMemResizeZ(cmSample_t,p->rcosV,p->rcosN); + cmVOS_CopyD(p->rcosV,p->rcosN,p->fir->coeffV); + + } + + // for each channel for(i=0; ichN; ++i) { @@ -294,7 +318,7 @@ cmRC_t cmGoldSigInit( cmGoldSig_t* p, const cmGoldSigArg_t* a ) } cmRC_t cmGoldSigFinal( cmGoldSig_t* p ) -{ return cmOkRC; } +{ return cmFIRFinal(p->fir); } cmRC_t cmGoldSigWrite( cmCtx* ctx, cmGoldSig_t* p, const char* fn ) { diff --git a/cmProc5.h b/cmProc5.h index 84719b5..682eb74 100644 --- a/cmProc5.h +++ b/cmProc5.h @@ -73,7 +73,8 @@ extern "C" { cmSample_t* rcosV; // rcosV[rcosN] raised cosine impulse response unsigned rcosN; // length of raised cosine impulse response unsigned mlsN; // length of Gold codes (Maximum length sequence length) - unsigned sigN; // length of channel signals bbV[] and mdV[] + unsigned sigN; // length of channel signals bbV[] and mdV[] + cmFIR* fir; } cmGoldSig_t;