📄 test_midamble.c
字号:
/*************************************************************************** midamble_test.c - SRadio testing of midamble ------------------- begin : 2002 authors : Linus Gasser emails : linus.gasser@epfl.ch ***************************************************************************//*************************************************************************** Changes ------- date - name - description 02-10-16 - ineiti - begin 02-11-04 - ineiti - extension for notice_function 04/03/03 - ineiti - added a small 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""Make a small little chain with the midamble using the following chain:\n""midamble -> rrc -> block -> matched_filter\n""where the midamble and matched_filter are complementary, that is,\n""what the midamble inserts, the matched_filter should get out.\n""The rrc is a pulse-shape filter which uses a root-raised cosine with\n""alpha (roll-off factor) = 0.22 and it also does an upsampling by a\n""factor of four. block simulates a channel that is,\n""it scales a bit the signal.\n\n";#include "system.h"#include "spc.h"#include "antenna.h"#include "std.h"#include "stfa.h"#include "chain.h"#define ANTENNA 0#define DBG_LVL 4swr_sdb_id mid, block, mafi;struct chain_t *chain_mid;void *mid_test( void *arg ) { swr_sdb_id rand, test_send, test_rcv; int i; PR( "getting sdbs\n" ); chain_mid = swr_chain_create( NEW_SPC_VAR( "random", rand ), NEW_SPC_VAR( "test_data_send", test_send ), NEW_SPC( "mapper" ), NEW_SPC_VAR( "midamble", mid ), NEW_SPC( "rrc" ), NEW_SPC_VAR( "block", block ), NEW_SPC_VAR( "matched_filter", mafi ), NEW_SPC( "slicer" ), NEW_SPC_VAR( "test_data_rcv", test_rcv ), CHAIN_END ); PR( "Adjusting block-size\n" ); swr_sdb_set_config_int( block, "size", 10000 ); PR( "Connecting second stream from test_send to test_rcv\n" ); swr_conn_add( test_send, 1, test_rcv, 1 ); // And send some slots... PR( "Send some slots\n" ); for ( i=0; i<1; i++ ) { swr_sdb_send_msg( rand, SUBS_MSG_USER, NULL, -1 ); } if ( swr_sdb_get_stats_int( test_rcv, "error" ) ) { PR( "Something went wrong, there are errors!\n" ); } else { PR( " *** Test OK *** \n" ); } swr_sdb_show_profile( mafi ); return 0;}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) { PR_CL( desc ); if ( swr_thread_init( &start, mid_test, NULL ) ) { goto rrc_no_thread; } return 0;rrc_no_thread: PR_DBG( 0, "Couldn't init thread\n" ); return -1;}void um_module_exit( void ) { swr_thread_free( &start, NULL ); PR_DBG( 0, "deleting se chain\n" ); swr_chain_destroy( chain_mid );}module_init( um_module_init );module_exit( um_module_exit );EXPORT_SYMBOL(mid_test);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -