/** * Module Name: gen9SK_SINK * Description: * Files: gen9SK_SINK.c * * Author: A.Gelonch: Feb. 2011. * Created: Fri Feb 18 10:57:54 2011 * Revision: 0.1 * * Comments: * */ #include #include #include #include "typetools.h" #include "stats.h" #include "moduleConfig.h" /** This file must be included AFTER moduleConfig.h */ #include /** MODULE INCLUDES*/ #include "compare_data.h" /*GLOBAL DEFINEs*/ #define L_MAX 50000000 #define MAXNUM_ERRORS 1000 #define PATTERN 0xAF /*GLOBAL VARIABLES & BUFFERS*/ int value; unsigned char frase[L_MAX]; int filelength=0; /*PREDEFINED FUNCTIONS*/ //int compare_data(unsigned char *data_in, unsigned char *file,\ int numchars, int file_length, int NumErrorsMax); /** Initialization function. This code is executed during the INIT phase only. * @return 0 fails initialization and stops execution of application. */ int myinit() { int outputlength=0; filelength=lee_archivo("data/rfc793.txt",frase,L_MAX); /*Read the file*/ printf("O SPECIFIC PARAMETERS SETUP: %s.myinit().\n", GetObjectName()); printf("O ProcessingTypeIN=%d, ProcessingTypeOUT=%d, OutputDataLength=%d \n",\ PROCESSING_TYPE_IN, PROCESSING_TYPE_OUT, outputlength); printf("O File rfc793.txt readed, filelength=%d \n", filelength); if(filelength > L_MAX)printf("%s.init_my_prog(). ERROR: filelength=%d > LMAX=%d\n",\ GetObjectName(), filelength, L_MAX); printf("O------------------------------------------------------------------------------O\n"); /** during the initialization phase, you can force a special type for an input or output * interface. If you do so, declare the pointer to the data using INS(itf_num) */ /*set_special_type_IN(0,TYPE_SHORT);*/ /* or for output interfaces use set_special_type_OUT() */ return 1; } /** Main work function. The input and output buffers can be accessed through the * inputN and outputM pointers where N and M are the input and output interface * index * * @returns >0 Number of samples to send through ALL the output interfaces. * If some output interface sends a different number of samples, use setLength(M,size) * @returns <0 if error, stops execution */ int execute() { int i; char *input0_c = IN(0); /** pointer to input interface 0 */ char *input1_c = IN(1); /** pointer to input interface 1 */ //printf("%s.execute(): getLength(0)=%d, getLength(1)=%d\n", GetObjectName(), getLength(0), getLength(1)); /** your code goes here */ compare_data0(input0_c, frase, getLength(0), filelength, MAXNUM_ERRORS); compare_data1(input1_c, frase, getLength(1), filelength, MAXNUM_ERRORS); /** return the number of samples to send */ i=0; return i; }