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

📄 prbs.cpp

📁 USB开发的一些代码!适用于EX-USBFX2平台!这些源码还是蛮不错的!
💻 CPP
字号:
// PRBS.cpp: implementation of the CPRBS class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include <memory.h>
#include "PRBS.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CPRBS::CPRBS()
{

}

CPRBS::~CPRBS()
{

}
int CPRBS::Initialize(int nDirection, int nSampleNumInSymbol)
{
	memset(m_PRBSData, 0, sizeof(m_PRBSData));


	m_nSampleNumInSymbol = nSampleNumInSymbol;

	if (nDirection == DOWNSTREAM)
		for (int i = 0; i < m_nSampleNumInSymbol; i ++)
		{
			if (i < 9 )
				m_PRBSData[i] = 1;
			else
				m_PRBSData[i] = m_PRBSData[i - 4] ^ m_PRBSData[i - 9];

		}
	else
		for (int i = 0; i < m_nSampleNumInSymbol; i ++)
		{
			if (i < 6 )
				m_PRBSData[i] = 1;
			else
				m_PRBSData[i] = m_PRBSData[i - 5] ^ m_PRBSData[i - 6];

		}
	return SUCCESS;
}



int CPRBS::GetMedleyPRBSBits(int nSysmbolIndex, int nToneIndex)
{

	int nBitIndex = (((nSysmbolIndex * m_nSampleNumInSymbol / 2) + nToneIndex) * 2) % (m_nSampleNumInSymbol - 1);

	return (m_PRBSData[nBitIndex] << 1) | m_PRBSData[nBitIndex + 1];
}


int CPRBS::GetReverbPRBSBits(int nToneIndex)
{
//返回复数对,保存在一个变量的最后两位,高位实部,低位虚部
	return (m_PRBSData[nToneIndex * 2] << 1) | m_PRBSData[nToneIndex * 2 + 1];

}

⌨️ 快捷键说明

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