/** * Module Name: gen9SK_SOURCE * Description: * Files: gen9SK_SOURCE.c * * Author: A.Gelonch * Created: Thu Feb 17 11:19:57 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 /*GLOBAL DEFINEs*/ #define L_MAX 50000000 #define PATTERN 0xAF /*GLOBAL VARIABLES & BUFFERS*/ int value; unsigned char frase[L_MAX]; int filelength=0; /** Initialization function. This code is executed during the INIT phase only. * @return 0 fails initialization and stops execution of application. */ int myinit() { /** 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() */ filelength=lee_archivo("data/rfc793.txt",frase,L_MAX); /*Read the file*/ printf("O SPECIFIC PARAMETERS SETUP: %s.myinit().\n", GetObjectName()); printf("O SignalFlow=%d, SignalType=%d\n", signalflow, signaltype); 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"); 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() { static int p=0, k, one=3; static int filefinish=0; //filefinish=1 --> FILE SENT int time_slot; int i; int *x = IN(0); /** pointer to input interface 0. Use the correct type */ /*short *y = (short*) INS(1);*/ /** special type pointer to interface 1 */ char *output0=OUT(0); /** pointer to output interface 0 */ char *output1=OUT(1); /** your code goes here */ // for (i=0;i=filelength){ *(output0+i)=0; /** Send 0 to complete transfer size*/ *(output1+i)=0; /** Send 0 to complete transfer size*/ outputlength=0; } p++; } setLength(0,outputlength); setLength(1,outputlength); return(outputlength); } if(p>=filelength){ outputlength=0; if(filefinish==0){ filefinish=1; printf("FILE SENT %s: filelength=%d\n", GetObjectName(), filelength); //printf("outputlength=%d, myctrl.time_slot=%d\n", outputlength, time_slot); } return(outputlength); } } if(signalflow==SAMPLES){ if(signaltype==SEN){ /** TO BE EXTENDED*/ } return(outputlength); } one++; /*setLength(0,i); Set output length for each output*/ /** return the number of samples to send */ return i; }