📄 test_synch_bs.c
字号:
/*************************************************************************** synch_test_bs.c - SRadio testing of synchronisation - BS ------------------- begin : 2002 authors : Linus Gasser emails : linus.gasser@epfl.ch ***************************************************************************//*************************************************************************** Changes ------- date - name - description 02-10-16 - ineiti - begin 02-12-18 - ineiti - split up in MS and BS part **************************************************************************//*************************************************************************** * * * 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. * * * ***************************************************************************//** * Make a small little chain with the synch */#include "system.h"#include "spc.h"#include "antenna.h"#include "std.h"#include "stfa.h"#define ANTENNA 0#define DBG_LVL 4swr_sdb_id synch_send;struct chain_t *test;#define DESYNCH 1#define MAX_SYNCH 9int count, size;SYMBOL_MMX *buf;/* * The main thread, where the chain is set up and either * a synchronisation-signal is sent, or it waits for one. */void *start_it( void *arg ) { swr_sdb_id stfa, rand; test = swr_chain_create( NEW_SPC_VAR( "random", rand ), NEW_SPC( "mapper" ), NEW_SPC_VAR( "synch_send", synch_send ), NEW_SPC( "rrc" ), NEW_SPC_VAR( "stfa", stfa ), CHAIN_END ); PR( "Getting chain synch_send->rrc->stfa\n" ); PR( "Setting up STFA\n" ); swr_stfa_notice_sdb( stfa, 0, rand ); size = swr_sdb_get_struct( synch_send )->port_in[0].size; buf = swr_sdb_get_struct( synch_send )->port_in[0].data; // And send some slots... PR( "Send some slots to %p with size %i\n", buf, size ); PR( "Setting gains and starting\n" ); count = 0; swr_ant_set_gains( ANTENNA, 0, 0 ); swr_stfa_go( stfa ); while ( count < 8192 ) { usleep( 500000 ); } PR_DBG( 4, "Stopping the STFA\n" ); swr_stfa_stop( stfa ); 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) { if ( swr_thread_init( &start, start_it, 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 synch_send and stfa\n" ); swr_memory_show(); swr_chain_destroy( test );}module_init( um_module_init );module_exit( um_module_exit );EXPORT_SYMBOL(start_it);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -