/* Generated with CMSIS-DSP Compute Graph Scripts. The generated code is not covered by CMSIS-DSP license. The support classes and code is covered by CMSIS-DSP license. */ #include "arm_math.h" #include "custom.h" #include "GenericNodes.h" #include "AppNodes.h" #include "scheduler.h" /* Description of the scheduling. It is a list of nodes to call. The values are indexes in the previous array. */ static unsigned int schedule[302]= { 7,8,3,2,1,7,8,3,2,1,4,5,7,8,3,2,1,7,8,3,2,1,4,5,7,8,3,2,1,7,8,3,2,1,4,5,7,8,3,2, 1,7,8,3,2,1,4,5,7,8,3,2,1,7,8,3,2,1,4,5,7,8,3,2,1,7,8,3,2,1,4,5,7,8,3,2,1,7,8,3, 2,1,4,5,7,8,3,2,1,7,8,3,2,1,4,5,7,8,3,2,1,7,8,3,2,1,4,5,7,8,3,2,1,7,8,3,2,1,4,5, 7,8,3,2,1,7,8,3,2,1,4,5,7,8,3,2,1,7,8,3,2,1,4,5,7,8,3,2,1,7,8,3,2,1,4,5,7,8,3,2, 1,7,8,3,2,1,4,5,7,8,3,2,1,7,8,3,2,1,4,5,7,8,3,2,1,7,8,3,2,1,4,5,7,8,3,2,1,7,8,3, 2,1,4,5,7,8,3,2,1,7,8,3,2,1,4,5,7,8,3,2,1,7,8,3,2,1,4,5,7,8,3,2,1,7,8,3,2,1,4,5, 7,8,3,2,1,7,8,3,2,1,4,5,7,8,3,2,1,7,8,3,2,1,4,5,7,8,3,2,1,7,8,3,2,1,4,5,7,8,3,2, 1,7,8,3,2,1,4,5,7,8,3,2,1,7,8,3,2,1,4,5,6,0, }; /*********** FIFO buffers ************/ #define FIFOSIZE0 330 #define FIFOSIZE1 160 #define FIFOSIZE2 160 #define FIFOSIZE3 160 #define FIFOSIZE4 160 #define FIFOSIZE5 320 #define FIFOSIZE6 640 #define FIFOSIZE7 250 #define FIFOSIZE8 500 #define BUFFERSIZE0 330 float32_t buf0[BUFFERSIZE0]={0}; #define BUFFERSIZE1 160 float32_t buf1[BUFFERSIZE1]={0}; #define BUFFERSIZE2 160 float32_t buf2[BUFFERSIZE2]={0}; #define BUFFERSIZE3 160 float32_t buf3[BUFFERSIZE3]={0}; #define BUFFERSIZE4 160 float32_t buf4[BUFFERSIZE4]={0}; #define BUFFERSIZE5 320 float32_t buf5[BUFFERSIZE5]={0}; #define BUFFERSIZE6 640 float32_t buf6[BUFFERSIZE6]={0}; #define BUFFERSIZE7 250 float32_t buf7[BUFFERSIZE7]={0}; #define BUFFERSIZE8 500 float32_t buf8[BUFFERSIZE8]={0}; uint32_t scheduler(int *error,int opt1,int opt2) { int cgStaticError=0; uint32_t nbSchedule=0; int32_t debugCounter=1; /* Create FIFOs objects */ FIFO fifo0(buf0,10); FIFO fifo1(buf1); FIFO fifo2(buf2); FIFO fifo3(buf3); FIFO fifo4(buf4); FIFO fifo5(buf5); FIFO fifo6(buf6); FIFO fifo7(buf7); FIFO fifo8(buf8); /* Create node objects */ TFLite TFLite(fifo8); SlidingBuffer audioWin(fifo5,fifo6); MFCC mfcc(fifo6,fifo7); SlidingBuffer mfccWind(fifo7,fifo8); StereoSource src(fifo0); Unzip toMono(fifo0,fifo1,fifo2); /* Run several schedule iterations */ while((cgStaticError==0) && (debugCounter > 0)) { /* Run a schedule iteration */ for(unsigned long id=0 ; id < 302; id++) { switch(schedule[id]) { case 0: { cgStaticError = TFLite.run(); CHECKERROR; } break; case 1: { { float32_t* i0; float32_t* i1; float32_t* o2; i0=fifo3.getReadBuffer(160); i1=fifo4.getReadBuffer(160); o2=fifo5.getWriteBuffer(160); arm_add_f32(i0,i1,o2,160); cgStaticError = 0; } CHECKERROR; } break; case 2: { { float32_t* i0; float32_t* o2; i0=fifo1.getReadBuffer(160); o2=fifo3.getWriteBuffer(160); arm_scale_f32(i0,HALF,o2,160); cgStaticError = 0; } CHECKERROR; } break; case 3: { { float32_t* i0; float32_t* o2; i0=fifo2.getReadBuffer(160); o2=fifo4.getWriteBuffer(160); arm_scale_f32(i0,HALF,o2,160); cgStaticError = 0; } CHECKERROR; } break; case 4: { cgStaticError = audioWin.run(); CHECKERROR; } break; case 5: { cgStaticError = mfcc.run(); CHECKERROR; } break; case 6: { cgStaticError = mfccWind.run(); CHECKERROR; } break; case 7: { cgStaticError = src.run(); CHECKERROR; } break; case 8: { cgStaticError = toMono.run(); CHECKERROR; } break; default: break; } } debugCounter--; nbSchedule++; } errorHandling: *error=cgStaticError; return(nbSchedule); }