📄 diff.c
字号:
/***********************************************************************************/
/* IS54 Baseband Simulation Software */
/* */
/* File Description : IS54 DQPSK Differential Detector */
/* File Name : diff.c */
/* Date : 12/30/93 */
/* : July, 20001 - Modified for TMS320C55x project */
/* */
/* This decoder produces two symbol bits for every input IS54 DQPSK */
/* modulation I,Q vector pair. */
/* */
/* The decoding algorithm is based on looking at the sign of */
/* the real and imaginary parts of the phase transitions from */
/* an old I,Q vector to a new I,Q vector. */
/* */
/* Note that we take advantage of the fact that the 1st bit of */
/* the symbol is dependent on the imaginary part of the phase transition */
/* only, while the 2nd bit is dependent only on the real part of */
/* the phase transition. */
/* */
/* Inputs : */
/* irx : Pointer to floating point array of */
/* at least 163 I samples. */
/* */
/* qrx : Pointer to floating point array of */
/* at least 163 Q samples. */
/* */
/* Outputs : */
/* bits : Pointer to unsigned array where */
/* 324 symbol bits are to be stored. */
/* Note that each element of the array */
/* will contain a single bit (i.e. 0 */
/* or 1 only) */
/* */
/* Return Value : */
/* NONE */
/* */
/***********************************************************************************/
/* Include Files */
#include <intrindefs.h>
/* Defines */
#define OLD_I (*irx)
#define OLD_Q (*qrx)
#define NEW_I (*(irx+1))
#define NEW_Q (*(qrx+1))
#define SLOT_LENGTH 162
/* Function Prototypes */
void diff( int*, int*, unsigned* );
/* External Functions */
/* Data */
/* Extrenal Data */
/* Code */
void diff( int *irx, int *qrx, unsigned *bits )
{
int i;
long ltemp;
for (i=0; i < SLOT_LENGTH; i++ )
{
/* Determione 1st bit */
/* if( (OLD_I*NEW_Q - OLD_Q*NEW_I) >= 0) *(bits++) = 0; */
/* else *(bits++) = 1; */
ltemp = _lsmpy(OLD_I, NEW_Q);
ltemp = _smas(ltemp, OLD_Q, NEW_I);
if (ltemp >= 0) *(bits++) = 0;
else *(bits++) = 1;
/* Determine 2nd bit */
/* if( (OLD_I*NEW_I + OLD_Q*NEW_Q) >= 0 ) *(bits++) = 0; */
/* else *(bits++) = 1; */
ltemp = _lsmpy(OLD_I, NEW_I);
ltemp = _smac(ltemp, OLD_Q, NEW_Q);
if (ltemp >= 0) *(bits++) = 0;
else *(bits++) = 1;
/* Update Pointers */
irx++;
qrx++;
}
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -