scheduler.cpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. Generated with CMSIS-DSP SDF Scripts.
  3. The generated code is not covered by CMSIS-DSP license.
  4. The support classes and code is covered by CMSIS-DSP license.
  5. */
  6. #include "arm_math.h"
  7. #include "custom.h"
  8. #include "GenericNodes.h"
  9. #include "AppNodes.h"
  10. #include "scheduler.h"
  11. /***********
  12. FIFO buffers
  13. ************/
  14. #define FIFOSIZE0 256
  15. #define FIFOSIZE1 256
  16. #define FIFOSIZE2 13
  17. #define FIFOSIZE3 26
  18. #define BUFFERSIZE0 256
  19. float32_t buf0[BUFFERSIZE0]={0};
  20. #define BUFFERSIZE1 256
  21. float32_t buf1[BUFFERSIZE1]={0};
  22. #define BUFFERSIZE2 13
  23. float32_t buf2[BUFFERSIZE2]={0};
  24. #define BUFFERSIZE3 26
  25. float32_t buf3[BUFFERSIZE3]={0};
  26. uint32_t scheduler(int *error,arm_mfcc_instance_f32 *mfccConfig)
  27. {
  28. int sdfError=0;
  29. uint32_t nbSchedule=0;
  30. int32_t debugCounter=1;
  31. /*
  32. Create FIFOs objects
  33. */
  34. FIFO<float32_t,FIFOSIZE0,0> fifo0(buf0);
  35. FIFO<float32_t,FIFOSIZE1,1> fifo1(buf1);
  36. FIFO<float32_t,FIFOSIZE2,1> fifo2(buf2);
  37. FIFO<float32_t,FIFOSIZE3,0> fifo3(buf3);
  38. /*
  39. Create node objects
  40. */
  41. SlidingBuffer<float32_t,256,128> audioWin(fifo0,fifo1);
  42. MFCC<float32_t,256,float32_t,13> mfcc(fifo1,fifo2,mfccConfig);
  43. SlidingBuffer<float32_t,26,13> mfccWin(fifo2,fifo3);
  44. FileSink<float32_t,13> sink(fifo3,"output_example6.txt");
  45. FileSource<float32_t,192> src(fifo0,"input_example6.txt");
  46. /* Run several schedule iterations */
  47. while((sdfError==0) && (debugCounter > 0))
  48. {
  49. /* Run a schedule iteration */
  50. sdfError = src.run();
  51. CHECKERROR;
  52. sdfError = audioWin.run();
  53. CHECKERROR;
  54. sdfError = mfcc.run();
  55. CHECKERROR;
  56. sdfError = mfccWin.run();
  57. CHECKERROR;
  58. sdfError = sink.run();
  59. CHECKERROR;
  60. sdfError = sink.run();
  61. CHECKERROR;
  62. sdfError = src.run();
  63. CHECKERROR;
  64. sdfError = audioWin.run();
  65. CHECKERROR;
  66. sdfError = mfcc.run();
  67. CHECKERROR;
  68. sdfError = mfccWin.run();
  69. CHECKERROR;
  70. sdfError = sink.run();
  71. CHECKERROR;
  72. sdfError = sink.run();
  73. CHECKERROR;
  74. sdfError = audioWin.run();
  75. CHECKERROR;
  76. sdfError = mfcc.run();
  77. CHECKERROR;
  78. sdfError = mfccWin.run();
  79. CHECKERROR;
  80. sdfError = sink.run();
  81. CHECKERROR;
  82. sdfError = sink.run();
  83. CHECKERROR;
  84. debugCounter--;
  85. nbSchedule++;
  86. }
  87. *error=sdfError;
  88. return(nbSchedule);
  89. }