⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qpsk.c

📁 这是一个c++编写的WCDMA链路采用RAKE接收的方针源代码
💻 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 have to be a multiple of full bytes. *		Output vectors must be 4 times longer than input vector. */int wcdma_dl_qpsk_mod(	char data[],	/* input data bit vector */        int data_len,	/* length of input data vector, in bytes */        char I_out[],	/* output I parts of complex symbol vector */        char 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 bits from a byte */      for (j=7; j > 0; j -= 2) {        I_out[I_out_index] = extract_bit_from_byte(data[i], j);        I_out_index++;      }      /* get Q branch bits from a byte */      for (j=6; j > -1; j -= 2) {        Q_out[Q_out_index] = extract_bit_from_byte(data[i], j);        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(	char I_in[],	/* IN: input I part of complex symbol vector */        char Q_in[],	/* IN: input Q part of complex symbol vector */        int in_len,	/* IN: length of input symbol vectors */        char 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;    char temp_byte;    I_index = 0;    Q_index = 0;    out_index = 0;        /* Construct one byte per round */    while (I_index < in_len) {       temp_byte = 0;      /* Set bits from I branch */      for (j=7; j > 0; j -= 2) {        set_bit_in_byte(I_in[I_index], j, &temp_byte);        I_index++;      }      /* Set bits from Q branch */      for (j=6; j > -1; j -= 2) {        set_bit_in_byte(Q_in[Q_index], j, &temp_byte);        Q_index++;      }      out_data[out_index] = temp_byte;      out_index++;    };    *out_len = out_index;    return(0);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -