?? bitload.c
字號:
//bitload.c
//
// Project Red 2002: High Performance OFDM Modem
// Against Channel Imperfections
// Auther: Linus Falk
#include "ofdm.h"
#include "channel_est.h"
volatile bitload_struct BitLoadBuffer1;
volatile bitload_struct BitLoadBuffer2;
volatile bitload_struct *CurrentBitLoadBuffer;
volatile bitload_struct *NextBitLoadBuffer;
#pragma DATA_SECTION (gn, ".sysmem");
float gn[127];
#pragma DATA_SECTION (gn1, ".sysmem");
float gn1[127];
volatile bitload_struct TempBitLoadBuffer;
void calculate_gn(void);
//calculates bitload parameters for next bitload buffer to use
void bitload(void){
int i;
calculate_gn();
#pragma MUST_ITERATE(127,127);
for(i=0; i<127; i++){
if(gn[i] > 1.5){
NextBitLoadBuffer->channel_modulation[i] = 6;
}else if(gn[i] > 0.9){
NextBitLoadBuffer->channel_modulation[i] = 4;
}else if(gn[i] > 0.5){
NextBitLoadBuffer->channel_modulation[i] = 2;
}else if(gn[i] > 0.1){
NextBitLoadBuffer->channel_modulation[i] = 1;
}else{
NextBitLoadBuffer->channel_modulation[i] = 0;
}
}
}
void calculate_gn(void){
int i;
float noise_var_rcpsp = _rcpsp(noise_var);
#pragma MUST_ITERATE(127,127);
for(i=0; i<127; i++){
gn[i] = H_abs_sqr[i]*noise_var_rcpsp;
}
}
#pragma CODE_SECTION(init_bitload,"SBSRAM_PROG_MEM");
void init_bitload(void){
int i;
CurrentBitLoadBuffer = &BitLoadBuffer1;
NextBitLoadBuffer = &BitLoadBuffer2;
BitLoadBuffer1.use_from_frame = 1;
BitLoadBuffer2.use_from_frame = 512;
for(i=0; i<127; i++){
BitLoadBuffer1.channel_modulation[i] = 4;
BitLoadBuffer2.channel_modulation[i] = 4;
}
}
void change_bitload_buffer(void){
NextBitLoadBuffer = CurrentBitLoadBuffer;
bitload(); //real function
if(CurrentBitLoadBuffer == &BitLoadBuffer1){
CurrentBitLoadBuffer = &BitLoadBuffer2;
pci_message_send(FILL_BITLOADBUFFER1_MM);
}else{
CurrentBitLoadBuffer = &BitLoadBuffer1;
//pci_message_send(FILL_BITLOADBUFFER2_MM);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -