scheduler.cpp 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. /*
  2. Generated with CMSIS-DSP Compute Graph 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. #if !defined(CHECKERROR)
  12. #define CHECKERROR if (cgStaticError < 0) \
  13. {\
  14. goto errorHandling;\
  15. }
  16. #endif
  17. #if !defined(CG_BEFORE_ITERATION)
  18. #define CG_BEFORE_ITERATION
  19. #endif
  20. #if !defined(CG_AFTER_ITERATION)
  21. #define CG_AFTER_ITERATION
  22. #endif
  23. #if !defined(CG_BEFORE_SCHEDULE)
  24. #define CG_BEFORE_SCHEDULE
  25. #endif
  26. #if !defined(CG_AFTER_SCHEDULE)
  27. #define CG_AFTER_SCHEDULE
  28. #endif
  29. #if !defined(CG_BEFORE_BUFFER)
  30. #define CG_BEFORE_BUFFER
  31. #endif
  32. #if !defined(CG_BEFORE_FIFO_BUFFERS)
  33. #define CG_BEFORE_FIFO_BUFFERS
  34. #endif
  35. #if !defined(CG_BEFORE_FIFO_INIT)
  36. #define CG_BEFORE_FIFO_INIT
  37. #endif
  38. #if !defined(CG_BEFORE_NODE_INIT)
  39. #define CG_BEFORE_NODE_INIT
  40. #endif
  41. #if !defined(CG_AFTER_INCLUDES)
  42. #define CG_AFTER_INCLUDES
  43. #endif
  44. #if !defined(CG_BEFORE_SCHEDULER_FUNCTION)
  45. #define CG_BEFORE_SCHEDULER_FUNCTION
  46. #endif
  47. #if !defined(CG_BEFORE_NODE_EXECUTION)
  48. #define CG_BEFORE_NODE_EXECUTION
  49. #endif
  50. #if !defined(CG_AFTER_NODE_EXECUTION)
  51. #define CG_AFTER_NODE_EXECUTION
  52. #endif
  53. CG_AFTER_INCLUDES
  54. /*
  55. Description of the scheduling.
  56. */
  57. static unsigned int schedule[37]=
  58. {
  59. 6,6,1,5,0,2,3,4,6,1,5,0,2,3,4,6,6,1,5,0,2,3,4,6,1,5,0,2,3,4,6,1,5,0,2,3,4,
  60. };
  61. CG_BEFORE_FIFO_BUFFERS
  62. /***********
  63. FIFO buffers
  64. ************/
  65. #define FIFOSIZE0 11
  66. #define FIFOSIZE1 5
  67. #define FIFOSIZE2 5
  68. #define FIFOSIZE3 5
  69. #define FIFOSIZE4 5
  70. #define FIFOSIZE5 5
  71. #define BUFFERSIZE1 11
  72. CG_BEFORE_BUFFER
  73. complex buf1[BUFFERSIZE1]={0};
  74. #define BUFFERSIZE2 5
  75. CG_BEFORE_BUFFER
  76. complex buf2[BUFFERSIZE2]={0};
  77. #define BUFFERSIZE3 5
  78. CG_BEFORE_BUFFER
  79. complex buf3[BUFFERSIZE3]={0};
  80. #define BUFFERSIZE4 5
  81. CG_BEFORE_BUFFER
  82. complex buf4[BUFFERSIZE4]={0};
  83. #define BUFFERSIZE5 5
  84. CG_BEFORE_BUFFER
  85. complex buf5[BUFFERSIZE5]={0};
  86. #define BUFFERSIZE6 5
  87. CG_BEFORE_BUFFER
  88. complex buf6[BUFFERSIZE6]={0};
  89. CG_BEFORE_SCHEDULER_FUNCTION
  90. uint32_t scheduler(int *error,int someVariable)
  91. {
  92. int cgStaticError=0;
  93. uint32_t nbSchedule=0;
  94. int32_t debugCounter=1;
  95. CG_BEFORE_FIFO_INIT;
  96. /*
  97. Create FIFOs objects
  98. */
  99. FIFO<complex,FIFOSIZE0,0,0> fifo0(buf1);
  100. FIFO<complex,FIFOSIZE1,1,0> fifo1(buf2);
  101. FIFO<complex,FIFOSIZE2,1,0> fifo2(buf3);
  102. FIFO<complex,FIFOSIZE3,1,0> fifo3(buf4);
  103. FIFO<complex,FIFOSIZE4,1,0> fifo4(buf5);
  104. FIFO<complex,FIFOSIZE5,1,0> fifo5(buf6);
  105. CG_BEFORE_NODE_INIT;
  106. /*
  107. Create node objects
  108. */
  109. Duplicate3<complex,5,complex,5,complex,5,complex,5> dup0(fifo2,fifo3,fifo4,fifo5);
  110. ProcessingNode<complex,7,complex,5,complex,5> filter(fifo0,fifo2,fifo1,4,"Test",someVariable);
  111. Sink<complex,5> sa(fifo3);
  112. Sink<complex,5> sb(fifo4);
  113. Sink<complex,5> sc(fifo5);
  114. Sink<complex,5> sd(fifo1);
  115. Source<complex,5> source(fifo0);
  116. /* Run several schedule iterations */
  117. CG_BEFORE_SCHEDULE;
  118. while((cgStaticError==0) && (debugCounter > 0))
  119. {
  120. /* Run a schedule iteration */
  121. CG_BEFORE_ITERATION;
  122. for(unsigned long id=0 ; id < 37; id++)
  123. {
  124. CG_BEFORE_NODE_EXECUTION;
  125. switch(schedule[id])
  126. {
  127. case 0:
  128. {
  129. cgStaticError = dup0.run();
  130. }
  131. break;
  132. case 1:
  133. {
  134. cgStaticError = filter.run();
  135. }
  136. break;
  137. case 2:
  138. {
  139. cgStaticError = sa.run();
  140. }
  141. break;
  142. case 3:
  143. {
  144. cgStaticError = sb.run();
  145. }
  146. break;
  147. case 4:
  148. {
  149. cgStaticError = sc.run();
  150. }
  151. break;
  152. case 5:
  153. {
  154. cgStaticError = sd.run();
  155. }
  156. break;
  157. case 6:
  158. {
  159. cgStaticError = source.run();
  160. }
  161. break;
  162. default:
  163. break;
  164. }
  165. CG_AFTER_NODE_EXECUTION;
  166. CHECKERROR;
  167. }
  168. debugCounter--;
  169. CG_AFTER_ITERATION;
  170. nbSchedule++;
  171. }
  172. errorHandling:
  173. CG_AFTER_SCHEDULE;
  174. *error=cgStaticError;
  175. return(nbSchedule);
  176. }