scheduler.cpp 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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 256
  17. #define FIFOSIZE3 512
  18. #define FIFOSIZE4 512
  19. #define FIFOSIZE5 512
  20. #define FIFOSIZE6 256
  21. #define FIFOSIZE7 256
  22. #define BUFFERSIZE0 256
  23. float32_t buf0[BUFFERSIZE0]={0};
  24. #define BUFFERSIZE1 256
  25. float32_t buf1[BUFFERSIZE1]={0};
  26. #define BUFFERSIZE2 256
  27. float32_t buf2[BUFFERSIZE2]={0};
  28. #define BUFFERSIZE3 512
  29. float32_t buf3[BUFFERSIZE3]={0};
  30. #define BUFFERSIZE4 512
  31. float32_t buf4[BUFFERSIZE4]={0};
  32. #define BUFFERSIZE5 512
  33. float32_t buf5[BUFFERSIZE5]={0};
  34. #define BUFFERSIZE6 256
  35. float32_t buf6[BUFFERSIZE6]={0};
  36. #define BUFFERSIZE7 256
  37. float32_t buf7[BUFFERSIZE7]={0};
  38. uint32_t scheduler(int *error)
  39. {
  40. int sdfError=0;
  41. uint32_t nbSchedule=0;
  42. int32_t debugCounter=40;
  43. /*
  44. Create FIFOs objects
  45. */
  46. FIFO<float32_t,FIFOSIZE0,0> fifo0(buf0);
  47. FIFO<float32_t,FIFOSIZE1,1> fifo1(buf1);
  48. FIFO<float32_t,FIFOSIZE2,1> fifo2(buf2);
  49. FIFO<float32_t,FIFOSIZE3,1> fifo3(buf3);
  50. FIFO<float32_t,FIFOSIZE4,1> fifo4(buf4);
  51. FIFO<float32_t,FIFOSIZE5,1> fifo5(buf5);
  52. FIFO<float32_t,FIFOSIZE6,1> fifo6(buf6);
  53. FIFO<float32_t,FIFOSIZE7,0> fifo7(buf7);
  54. /*
  55. Create node objects
  56. */
  57. OverlapAdd<float32_t,256,128> audioOverlap(fifo6,fifo7);
  58. SlidingBuffer<float32_t,256,128> audioWin(fifo0,fifo1);
  59. CFFT<float32_t,512,float32_t,512> cfft(fifo3,fifo4);
  60. ICFFT<float32_t,512,float32_t,512> icfft(fifo4,fifo5);
  61. FileSink<float32_t,192> sink(fifo7,"output_example3.txt");
  62. FileSource<float32_t,192> src(fifo0,"input_example3.txt");
  63. ToComplex<float32_t,256,float32_t,512> toCmplx(fifo2,fifo3);
  64. ToReal<float32_t,512,float32_t,256> toReal(fifo5,fifo6);
  65. /* Run several schedule iterations */
  66. while((sdfError==0) && (debugCounter > 0))
  67. {
  68. /* Run a schedule iteration */
  69. sdfError = src.run();
  70. CHECKERROR;
  71. sdfError = audioWin.run();
  72. CHECKERROR;
  73. {
  74. float32_t* i0;
  75. float32_t* o2;
  76. i0=fifo1.getReadBuffer(256);
  77. o2=fifo2.getWriteBuffer(256);
  78. arm_mult_f32(i0,HANN,o2,256);
  79. sdfError = 0;
  80. }
  81. CHECKERROR;
  82. sdfError = toCmplx.run();
  83. CHECKERROR;
  84. sdfError = cfft.run();
  85. CHECKERROR;
  86. sdfError = icfft.run();
  87. CHECKERROR;
  88. sdfError = toReal.run();
  89. CHECKERROR;
  90. sdfError = audioOverlap.run();
  91. CHECKERROR;
  92. sdfError = src.run();
  93. CHECKERROR;
  94. sdfError = audioWin.run();
  95. CHECKERROR;
  96. {
  97. float32_t* i0;
  98. float32_t* o2;
  99. i0=fifo1.getReadBuffer(256);
  100. o2=fifo2.getWriteBuffer(256);
  101. arm_mult_f32(i0,HANN,o2,256);
  102. sdfError = 0;
  103. }
  104. CHECKERROR;
  105. sdfError = toCmplx.run();
  106. CHECKERROR;
  107. sdfError = cfft.run();
  108. CHECKERROR;
  109. sdfError = icfft.run();
  110. CHECKERROR;
  111. sdfError = toReal.run();
  112. CHECKERROR;
  113. sdfError = audioWin.run();
  114. CHECKERROR;
  115. {
  116. float32_t* i0;
  117. float32_t* o2;
  118. i0=fifo1.getReadBuffer(256);
  119. o2=fifo2.getWriteBuffer(256);
  120. arm_mult_f32(i0,HANN,o2,256);
  121. sdfError = 0;
  122. }
  123. CHECKERROR;
  124. sdfError = toCmplx.run();
  125. CHECKERROR;
  126. sdfError = cfft.run();
  127. CHECKERROR;
  128. sdfError = icfft.run();
  129. CHECKERROR;
  130. sdfError = audioOverlap.run();
  131. CHECKERROR;
  132. sdfError = sink.run();
  133. CHECKERROR;
  134. sdfError = toReal.run();
  135. CHECKERROR;
  136. sdfError = audioOverlap.run();
  137. CHECKERROR;
  138. sdfError = sink.run();
  139. CHECKERROR;
  140. debugCounter--;
  141. nbSchedule++;
  142. }
  143. *error=sdfError;
  144. return(nbSchedule);
  145. }