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

📄 test_tcpip.c

📁 This a framework to test new ideas in transmission technology. Actual development is a LDPC-coder in
💻 C
字号:
/***************************************************************************              test_tcpip.c  -  Module for testing tcpip - yet to come                            -------------------    begin                :  date    authors              :  name    emails               :  e-mail ***************************************************************************//***************************************************************************                                 Changes                                 ------- date - name - 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.                                   * *                                                                         * ***************************************************************************//** * This is a module to write a test for some sort of SPC. Usually * you just create one or two chains in here, and they will be * tested afterwards. */#include "spc.h"#include "std.h"#define DBG_LVL 4struct chain_t *test_chain, *test_chain2;int loop;swr_sdb_id tcpip1, tcpip2;void *start_it( void *arg ) {#if 0  swr_sdb_id tcpip1, tcpip2, block1, block2, mafi1, mafi2;  // Create two connected tcpips  test_chain = swr_chain_create( NEW_SPC_VAR( "tcpip", tcpip1 ),                                 NEW_SPC( "mapper" ),                                 NEW_SPC( "midamble" ),                                 NEW_SPC( "rrc" ),                                 NEW_SPC_VAR( "block", block1 ),                                 NEW_SPC_VAR( "matched_filter", mafi1 ),                                 NEW_SPC( "slicer" ),                                 NEW_SPC_VAR( "tcpip", tcpip2 ),                                 CHAIN_END );  test_chain2 = swr_chain_create( OLD_SPC( tcpip2 ),                                  NEW_SPC( "mapper" ),                                  NEW_SPC( "midamble" ),                                  NEW_SPC( "rrc" ),                                  NEW_SPC_VAR( "block", block2 ),                                  NEW_SPC_VAR( "matched_filter", mafi2 ),                                  NEW_SPC( "slicer" ),                                  OLD_SPC( tcpip1 ),                                  CHAIN_END );  swr_sdb_set_config_double( block1, "sigma", 20 );  // Put one packet in the sending-queue of module 1  swr_sdb_send_msg( tcpip1, SUBS_MSG_USER, NULL, 0 );  swr_sdb_send_msg( tcpip2, SUBS_MSG_USER, NULL, 0 );  swr_sdb_send_msg( tcpip2, SUBS_MSG_USER, NULL, 0 );  loop = 1;  // Try to send the things  while ( loop ) {    PR( "Tcpip1\n" );    swr_sdb_send_msg( tcpip1, SUBS_MSG_USER, NULL, -1 );    PR( "Tcpip2\n" );    swr_sdb_send_msg( tcpip2, SUBS_MSG_USER, NULL, -1 );  }  loop = 0;  // wait for unload  while ( loop ) {    PR( "Tcpip1\n" );    swr_sdb_send_msg( tcpip1, SUBS_MSG_USER, NULL, -1 );    PR( "Tcpip2\n" );    swr_sdb_send_msg( tcpip2, SUBS_MSG_USER, NULL, -1 );  }#else  tcpip1 = swr_sdb_instantiate_name( "tcpip" );  return 0;  test_chain = swr_chain_create( NEW_SPC_VAR( "tcpip", tcpip1 ),                                 NEW_SPC_VAR( "tcpip", tcpip2 ),                                 CHAIN_END );  swr_conn_add( tcpip2, 0, tcpip1, 0 );#endif  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;  test_chain2 = NULL;  loop = 1;  //  if ( swr_thread_init( &start, start_it, NULL ) < 0 ) goto first_no_stack;  start_it( NULL );  return 0;  //first_no_stack:  PR_DBG( 0, "Couldn't allocate stack\n" );  return -1;}void um_module_exit( void ) {#ifndef USER_SPACE  loop = 0;#endif  //  swr_thread_free( &start, NULL );  swr_sdb_destroy( tcpip1 );  swr_chain_destroy( test_chain2 );  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 + -