📄 wcdma_demux1in2.c
字号:
/****************************************************************
File Name: t3g_demux1in2.c
****************************************************************/
#include "c2f77defs.h"
#define IVER 1999
#define IREV 5
typedef float SIGNAL;
#ifdef USE_PROTOS
void M5008_1008_2_t3g_demux1in2_9912(long *iparam, float *rparam)
#else
void M5008_1008_2_t3g_demux1in2_9912(iparam, rparam)
long *iparam;
float *rparam;
#endif
{
long ccg_npast, ccg_nfut, ccg_istat, ccg_savearea = 0;
long ccg_pos = 0, ccg_len = 0;
long BlockFactor;
/* port declarations */
/* 1. inputport */
int *Input;
/* 1. outport */
int *Output1;
int *ccg_Output1;
long ccg_outrate_Output1 = 1;
/* 2. outport */
int *Output2;
int *ccg_Output2;
long ccg_outrate_Output2 = 1;
/* parameter declarations */
/* 1. parameter */
long BlockLengthIn;
/* 2. parameter */
long BlockLengthOut1;
/* 3. parameter */
long BlockLengthOut2;
/* state declarations */
int *datain, *ccg_datain;
#include "lclpar.h"
#include "scrtch.h"
#include "modsrc.h"
/* get parameters */
BlockLengthIn = GetParameter_I(1);
BlockLengthOut1 = GetParameter_I(2);
BlockLengthOut2 = GetParameter_I(3);
switch (init)
{
case 1:
SetVersion;
SetRevision;
/* map state datain to scratch area */
ChkScratchPadSize( ccg_pos + (BlockLengthIn) );
ccg_len = BlockLengthIn;
datain = ccg_datain = &ih[ccg_pos];
{ int ccg_i = 0; for (;ccg_i < (BlockLengthIn) ; ccg_i++) datain[ccg_i] = 0;}
ccg_pos += ccg_len;
/* set scheduling rates */
SetInputSchedule(1) = BlockLengthIn;
/* save all states */
ccg_savearea++;
ccg_len = BlockLengthIn;
vsav(&mseqn, ccg_datain, &ccg_len, &ccg_savearea, &ccg_istat);
ExitOnError(-ccg_istat);
return;
case 2:
/* get all states */
ccg_savearea++;
ChkScratchPadSize( ccg_pos + (BlockLengthIn) );
datain = ccg_datain = &ih[ccg_pos];
vget(&mseqn, datain, &ccg_len, &ccg_savearea, &ccg_istat);
ExitOnError(-ccg_istat);
ccg_pos += ccg_len;
/* ringbuffer check */
rbchk( InPort(1), &ccg_npast, &ccg_nfut, &ccg_istat);
ExitOnError(-ccg_istat);
BlockFactor = ccg_nfut/( BlockLengthIn);
if ( BlockFactor < 1 ) return;
/* get rates of output ports */
ccg_outrate_Output1 = GetOutputRate(1);
if ( ( BlockLengthOut1)*BlockFactor > ccg_outrate_Output1 )
BlockFactor = ccg_outrate_Output1/( BlockLengthOut1);
if ( BlockFactor < 1 ) BlockFactor = 1;
ccg_outrate_Output2 = GetOutputRate(2);
if ( ( BlockLengthOut2)*BlockFactor > ccg_outrate_Output2 )
BlockFactor = ccg_outrate_Output2/( BlockLengthOut2);
if ( BlockFactor < 1 ) BlockFactor = 1;
/* read input signals */
ccg_len = ( BlockLengthIn)*BlockFactor;
ChkScratchPadSize(ccg_pos+ccg_len);
Input = &ih[ccg_pos];
rbrd( InPort(1), Input, &ccg_len, &ccg_istat);
ExitOnError(-ccg_istat);
ccg_pos += ccg_len;
/* prepare scratch area for output signals */
ccg_len = ( BlockLengthOut1)*BlockFactor;
ChkScratchPadSize(ccg_pos+ccg_len);
Output1 = ccg_Output1 = &ih[ccg_pos];
ccg_pos += ccg_len;
ccg_len = ( BlockLengthOut2)*BlockFactor;
ChkScratchPadSize(ccg_pos+ccg_len);
Output2 = ccg_Output2 = &ih[ccg_pos];
ccg_pos += ccg_len;
/* signal processing code */
{
register long ccg_lp0;
int i;
for(ccg_lp0=BlockFactor; ccg_lp0-- > 0;) {
for (i = 0;i < BlockLengthIn;++i)
{ datain[i] = *Input++; }
for (i = 0;i < BlockLengthOut1;++i)
{ *Output1++ = datain[i]; }
for (i = 0;i < BlockLengthOut2;++i)
{ *Output2++ = datain[ BlockLengthOut1 + i]; }
}
}
/* write output signals */
ccg_len = ( BlockLengthOut1) * BlockFactor;
rbwr(OutPort(1),ccg_Output1, &ccg_len, &ccg_istat);
ExitOnError(-ccg_istat);
ccg_len = ( BlockLengthOut2) * BlockFactor;
rbwr(OutPort(2),ccg_Output2, &ccg_len, &ccg_istat);
ExitOnError(-ccg_istat);
/* initialize save area index */
ccg_savearea = 0;
/* save all states */
ccg_savearea++;
ccg_len = BlockLengthIn;
vsav(&mseqn, ccg_datain, &ccg_len, &ccg_savearea, &ccg_istat);
ExitOnError(-ccg_istat);
return;
case 3:
return;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -