📄 qpsk_ints.c
字号:
/* | | Copyright disclaimer: | This software was developed at the National Institute of Standards | and Technology by employees of the Federal Government in the course | of their official duties. Pursuant to title 17 Section 105 of the | United States Code this software is not subject to copyright | protection and is in the public domain. | | We would appreciate acknowledgement if the software is used. |*//* | Project: WCDMA simulation environment | Module: QPSK data modulation and demodulation | Author: Tommi Makelainen, Nokia/NIST | Date: January 6, 1999 | | History: | January 6, 1999 Tommi Makelainen | Initial version. | */#include <stdio.h>#include <math.h>#include "config_wcdma.h"/* * Function: wcdma_dl_qpsk_mod * Desc.: QPSK downlink data modulation * * Note: * Incoming data is char vector (one char = one bit). * Output vectors must be 4 times longer than input vector. */int wcdma_dl_qpsk_mod( int data[], /* input data bit vector */ int data_len, /* length of input data vector, in bytes */ int I_out[], /* output I parts of complex symbol vector */ int Q_out[], /* output Q parts of complex symbol vector */ int *out_len) /* output length of complex symbol vector */{ int I_out_index, Q_out_index, i, j; I_out_index = 0; Q_out_index = 0; for (i=0; i < data_len; i++) { /* get I branch, if even turn, otherwise get Q one */ if ( (i % 2) == 0 ) { I_out[I_out_index] = data[i]; I_out_index++; } else { Q_out[Q_out_index] = data[i]; Q_out_index++; } } *out_len = I_out_index; return(0);}/* * Function: wcdma_dl_qpsk_demod * Desc.: QPSK data demodulation * * Note: */int wcdma_dl_qpsk_demod( int I_in[], /* IN: input I part of complex symbol vector */ int Q_in[], /* IN: input Q part of complex symbol vector */ int in_len, /* IN: length of input symbol vectors */ int out_data[],/* OUT: output symbol vector */ int *out_len) /* OUT: length of output symbol vector */{ int i, out_index, j, I_index, Q_index; int antipodal_data, outer_loop_count; int temp_byte; I_index = 0; Q_index = 0; out_index = 0; /* Construct one byte per round */ while (I_index < in_len) { /* Set bits from I branch */ out_data[out_index] = I_in[I_index]; I_index++; out_index++; /* Set bits from Q branch */ out_data[out_index] = Q_in[Q_index]; Q_index++; out_index++; }; *out_len = out_index; return(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -