📄 test_chest_rcv.c
字号:
/*************************************************************************** test_chest_rcv.c - Verifies chest_rcv with a simple channel ------------------- begin : 03/08/08 authors : Selvavinayagam Gunabalan emails : Selvavinayagam.Gunabalan@epfl.ch ***************************************************************************//*************************************************************************** Changes ------- date - name - description 03/08/08 - Selva - Begin 04/03/03 - ineiti - added description **************************************************************************//*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/char desc[] ="Description:\n""Sets up a simple 1-channel transmission and prints out the different\n""estimated channels. Of course, only one channel should contain a single\n""tap, the other channels should be more or less zero (give or take some\n""noise).\n\n";#include "spc.h"#include "std.h"#define DBG_LVL 0struct chain_t *test_chain;void *start_it( void *arg ) { swr_sdb_id src,snk,block,ch,mid_rx,mid_tx; int i; block_t filt; SYMBOL_COMPLEX *filter; test_chain = swr_chain_create(NEW_SPC_VAR( "source", src ), NEW_SPC( "mapper"), NEW_SPC_VAR( "chest_send", mid_tx ), NEW_SPC( "rrc" ), NEW_SPC_VAR( "block", block ), NEW_SPC_VAR( "rrc_rcv", ch ), NEW_SPC_VAR( "chest_rcv", mid_rx ), NEW_SPC( "slicer" ), NEW_SPC_VAR( "sink", snk ), CHAIN_END ); swr_sdb_set_config_int( mid_tx, "circ_ext", 0 ); swr_sdb_set_config_int( mid_rx, "circ_ext", 0 ); swr_sdb_set_config_double( block, "sigma", 10 ); swr_sdb_set_config_int( block, "size", 4096);// swr_sdb_set_config_int( snk, "size", 10000 ); swr_sdb_set_config_int( mid_tx, "index", 0 ); swr_sdb_set_config_int( snk, "flag", 1 ); //dump swr_sdb_send_msg( src, SUBS_MSG_USER, NULL, -1 ); filt = swr_sdb_get_stats_block( mid_rx, "channel"); filter = filt.data; for ( i = 0; i < 4 ; i++) { PR( "Channel %i has coefficients:\n", i ); PR( "0: %i + %ii\n", filter[16*i].real, filter[16*i].imag); PR( "1: %i + %ii\n", filter[16*i+1].real, filter[16*i+1].imag); } PR( "Noise variance = %i, Real Part = %i, Imag Part = %i\n", swr_sdb_get_stats_int( mid_rx, "noise_var"), swr_sdb_get_stats_int( mid_rx, "noise_var_real"), swr_sdb_get_stats_int( mid_rx, "noise_var_imag")); usleep(1000000); return 0;}swr_spc_id_t spm_id;struct thread start;/** * This function is called upon "insmod" and is used to register the * different parts of the module to the SPM. */int um_module_init(void) { test_chain = NULL; PR_CL( desc ); if ( swr_thread_init( &start, start_it, NULL ) < 0 ) goto first_no_stack; return 0;first_no_stack: PR_DBG( 0, "Couldn't allocate stack\n" ); return -1;}void um_module_exit( void ) { swr_thread_free( &start, NULL ); swr_chain_destroy( test_chain );}module_init( um_module_init );module_exit( um_module_exit );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -