mirror of
				https://github.com/brmlab/osmo-tetra.git
				synced 2025-10-30 23:14:00 +01:00 
			
		
		
		
	patch for dumping traffic
This commit is contained in:
		
							parent
							
								
									31c5b55186
								
							
						
					
					
						commit
						243fd9b554
					
				
					 4 changed files with 59 additions and 4 deletions
				
			
		|  | @ -184,6 +184,57 @@ void tp_sap_udata_ind(enum tp_sap_data_type type, const uint8_t *bits, unsigned | ||||||
| 	DEBUGP("%s %s type4: %s\n", tbp->name, time_str, | 	DEBUGP("%s %s type4: %s\n", tbp->name, time_str, | ||||||
| 		osmo_ubit_dump(type4, tbp->type345_bits)); | 		osmo_ubit_dump(type4, tbp->type345_bits)); | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | /*  ###### Begin traffic dump patch ###### */ | ||||||
|  | 
 | ||||||
|  | 	if ((type == TPSAP_T_SCH_F) && (tms->cur_burst.is_traffic)) { | ||||||
|  | 		printf("SAVING FRAME\n"); | ||||||
|  | 		char fname[200]; | ||||||
|  | 		int16_t block[690]; | ||||||
|  | 		FILE *f; | ||||||
|  | 		int i; | ||||||
|  | 
 | ||||||
|  | 		/* Open target file */ | ||||||
|  | 		//snprintf(fname, 100, "traffic_%d_%d.out", tcd->time.tn, tms->cur_burst.is_traffic);
 | ||||||
|  | 		//snprintf(fname, 100, "traffic_%d.out", tcd->time.tn);
 | ||||||
|  | 		extern char *dumpdir; | ||||||
|  | 		snprintf(fname, 199, "%s/traffic_%d.out", dumpdir, 666	/*tms->cur_burst.is_traffic*/); | ||||||
|  | 		f = fopen(fname, "ab"); | ||||||
|  | 
 | ||||||
|  | 		/* Generate a block */ | ||||||
|  | 		memset(block, 0x00, sizeof(int16_t) * 690); | ||||||
|  | 		for (i=0; i<6; i++) | ||||||
|  | 		block[115*i] = 0x6b21 + i; | ||||||
|  | 
 | ||||||
|  | 		for (i=0; i<114; i++) | ||||||
|  | 		block[ 1+i] = type4[ i] ? -127 : 127; | ||||||
|  | 
 | ||||||
|  | 		for (i=0; i<114; i++) | ||||||
|  | 		block[116+i] = type4[114+i] ? -127 : 127; | ||||||
|  | 
 | ||||||
|  | 		for (i=0; i<114; i++) | ||||||
|  | 		block[231+i] = type4[228+i] ? -127 : 127; | ||||||
|  | 
 | ||||||
|  | 		for (i=0; i<90; i++) | ||||||
|  | 		block[346+i] = type4[342+i] ? -127 : 127; | ||||||
|  | 
 | ||||||
|  | 		/* Write it */ | ||||||
|  | 		fwrite(block, sizeof(int16_t), 690, f); | ||||||
|  | 
 | ||||||
|  | 		/* Close */ | ||||||
|  | 		fclose(f); | ||||||
|  | 		memset(fname, 0x0, sizeof(char)*200); | ||||||
|  | 		//snprintf(fname, 199, "%s/traffic_%d.txt", dumpdir, tms->cur_burst.is_traffic);
 | ||||||
|  | 		/* Write used ssi */ | ||||||
|  | 		/*f=fopen(fname, "a");
 | ||||||
|  | 		memset(fname, 0x0, sizeof(char)*200); | ||||||
|  | 		snprintf(fname, 199, "%d\n", ssi); | ||||||
|  | 		fwrite(fname, sizeof(char), strlen(fname), f); | ||||||
|  | 		fclose(f);*/ | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	/* end traffic dump patch */ | ||||||
|  | 
 | ||||||
| 	if (tbp->interleave_a) { | 	if (tbp->interleave_a) { | ||||||
| 		/* Run block deinterleaving: type-3 bits */ | 		/* Run block deinterleaving: type-3 bits */ | ||||||
| 		block_deinterleave(tbp->type345_bits, tbp->interleave_a, type4, type3); | 		block_deinterleave(tbp->type345_bits, tbp->interleave_a, type4, type3); | ||||||
|  |  | ||||||
|  | @ -24,7 +24,7 @@ | ||||||
| 
 | 
 | ||||||
| #include <osmocom/core/utils.h> | #include <osmocom/core/utils.h> | ||||||
| 
 | 
 | ||||||
| //#define DEBUG
 | #define DEBUG | ||||||
| 
 | 
 | ||||||
| #include <tetra_common.h> | #include <tetra_common.h> | ||||||
| #include <phy/tetra_burst.h> | #include <phy/tetra_burst.h> | ||||||
|  |  | ||||||
|  | @ -38,6 +38,7 @@ | ||||||
| #define BUF_SIZE 256 | #define BUF_SIZE 256 | ||||||
| 
 | 
 | ||||||
| void *tetra_tall_ctx; | void *tetra_tall_ctx; | ||||||
|  | char *dumpdir; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| static int process_sym_fl(float fl) | static int process_sym_fl(float fl) | ||||||
|  | @ -109,6 +110,8 @@ int main(int argc, char **argv) | ||||||
| 		exit(1); | 		exit(1); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	dumpdir=argv[2]; | ||||||
|  | 
 | ||||||
| 	tetra_gsmtap_init("localhost", 0); | 	tetra_gsmtap_init("localhost", 0); | ||||||
| 
 | 
 | ||||||
| 	tms = talloc_zero(tetra_tall_ctx, struct tetra_mac_state); | 	tms = talloc_zero(tetra_tall_ctx, struct tetra_mac_state); | ||||||
|  |  | ||||||
|  | @ -240,11 +240,12 @@ static void rx_aach(struct tetra_tmvsap_prim *tmvp, struct tetra_mac_state *tms) | ||||||
| 		printf("UL_USAGE: %s ", tetra_get_ul_usage_name(aad.ul_usage)); | 		printf("UL_USAGE: %s ", tetra_get_ul_usage_name(aad.ul_usage)); | ||||||
| 
 | 
 | ||||||
| 	/* save the state whether the current burst is traffic or not */ | 	/* save the state whether the current burst is traffic or not */ | ||||||
| 	if (aad.dl_usage > 3) | 	if (aad.dl_usage > 3) { | ||||||
| 		tms->cur_burst.is_traffic = 1; | 		tms->cur_burst.is_traffic = 1; | ||||||
| 	else | 		tms->cur_burst.is_traffic = aad.dl_usage; | ||||||
|  | 	} else { | ||||||
| 		tms->cur_burst.is_traffic = 0; | 		tms->cur_burst.is_traffic = 0; | ||||||
| 
 | 	} | ||||||
| 	printf("\n"); | 	printf("\n"); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jiří Pinkava
						Jiří Pinkava