You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

285 lines
11 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #include "pruCoresWindow.h"
  2. #include "../../source/lib/hardware/soc/modules/pru/pru_ss.h"
  3. pruCoresWindow::pruCoresWindow() : WindowCLI( NULL ){
  4. m_pSOC = classSOC::getInstance();
  5. m_x = 6;
  6. m_y = 3;
  7. m_w = 80;
  8. m_h = 32;
  9. #ifdef NEWT_CLI
  10. m_l1 = newtLabel( 3, 1, "--- PRU0 [Pulse Control] ---");
  11. m_l2 = newtLabel( 3, 2, "TUPUS[0,0]:");
  12. m_t1 = newtTextbox( 3, 3, 32, 1, 0 );
  13. m_t2 = newtTextbox( 3, 4, 32, 1, 0 );
  14. m_t3 = newtTextbox( 3, 5, 32, 1, 0 );
  15. m_t4 = newtTextbox( 3, 6, 32, 1, 0 );
  16. m_t5 = newtTextbox( 3, 7, 32, 1, 0 );
  17. m_t6 = newtTextbox( 3, 8, 32, 1, 0 );
  18. m_t7 = newtTextbox( 3, 9, 32, 1, 0 );
  19. m_t8 = newtTextbox( 3, 10, 32, 1, 0 );
  20. m_t38 = newtTextbox( 3, 11, 32, 1, 0 );
  21. m_l3 = newtLabel( 3, 12, "Core Status:");
  22. m_t9 = newtTextbox( 3, 13, 32, 1, 0 );
  23. m_l4 = newtLabel( 3, 15, "--- PRU1 [Motors Control]---");
  24. m_l5 = newtLabel( 3, 16, "TUPUS[0,1]:");
  25. m_t10 = newtTextbox( 3, 17, 32, 1, 0 );
  26. m_t11 = newtTextbox( 3, 18, 32, 1, 0 );
  27. m_t12 = newtTextbox( 3, 19, 32, 1, 0 );
  28. m_t13 = newtTextbox( 3, 20, 32, 1, 0 );
  29. m_t14 = newtTextbox( 3, 21, 32, 1, 0 );
  30. m_t15 = newtTextbox( 3, 22, 32, 1, 0 );
  31. m_t16 = newtTextbox( 3, 23, 32, 1, 0 );
  32. m_t17 = newtTextbox( 3, 24, 32, 1, 0 );
  33. m_t39 = newtTextbox( 3, 25, 32, 1, 0 );
  34. m_l6 = newtLabel( 3, 26, "Core Status:");
  35. m_t18 = newtTextbox( 3, 27, 32, 1, 0 );
  36. m_l7 = newtLabel( 39, 1, "--- PRU2 [ADC Control] ---");
  37. m_l8 = newtLabel( 39, 2, "TUPUS[1,0]:");
  38. m_t19 = newtTextbox( 39, 3, 32, 1, 0 );
  39. m_t20 = newtTextbox( 39, 4, 32, 1, 0 );
  40. m_t21 = newtTextbox( 39, 5, 32, 1, 0 );
  41. m_t22 = newtTextbox( 39, 6, 32, 1, 0 );
  42. m_t23 = newtTextbox( 39, 7, 32, 1, 0 );
  43. m_t24 = newtTextbox( 39, 8, 32, 1, 0 );
  44. m_t25 = newtTextbox( 39, 9, 32, 1, 0 );
  45. m_t26 = newtTextbox( 39, 10, 32, 1, 0 );
  46. m_t40 = newtTextbox( 39, 11, 32, 1, 0 );
  47. m_l9 = newtLabel( 39,12, "Core Status:");
  48. m_t27 = newtTextbox( 39, 13, 32, 1, 0 );
  49. m_l10 = newtLabel(39,15, "--- PRU3 [Detector] ---");
  50. m_l11 = newtLabel(39,16, "TUPUS[1,1]:");
  51. m_t28 = newtTextbox( 39, 17, 32, 1, 0 );
  52. m_t29 = newtTextbox( 39, 18, 32, 1, 0 );
  53. m_t30 = newtTextbox( 39, 19, 32, 1, 0 );
  54. m_t31 = newtTextbox( 39, 20, 32, 1, 0 );
  55. m_t32 = newtTextbox( 39, 21, 32, 1, 0 );
  56. m_t33 = newtTextbox( 39, 22, 32, 1, 0 );
  57. m_t34 = newtTextbox( 39, 23, 32, 1, 0 );
  58. m_t35 = newtTextbox( 39, 24, 32, 1, 0 );
  59. m_t41 = newtTextbox( 39, 25, 32, 1, 0 );
  60. m_l12 = newtLabel( 39, 26, "Core Status:");
  61. m_t36 = newtTextbox( 39, 27, 32, 1, 0 );
  62. m_l13 = newtLabel( 39,28, "Detector Parameters:");
  63. m_t37 = newtTextbox( 39, 29, 38, 1, 0 );
  64. m_b1 = newtCompactButton( 35, 30, "Close" );
  65. newtFormAddComponents( m_oForm, m_l1, m_l2,
  66. m_t1, m_t2, m_t3, m_t4, m_t5, m_t6, m_t7, m_t8,
  67. m_l3,
  68. m_t9,
  69. m_l4, m_l5,
  70. m_l6,
  71. m_t10,
  72. m_l7, m_l8,
  73. m_t11, m_t12, m_t13, m_t14, m_l9, m_t15,
  74. m_l10, m_l11, m_t16, m_t17, m_t18, m_t19, m_l12, m_t20, m_b1,
  75. m_t21, m_t22, m_t23, m_t24, m_t25, m_t26, m_t27, m_t28, m_t29, m_t30,
  76. m_t31, m_t32, m_t33, m_t34, m_t35, m_t36, m_l13, m_t37,
  77. m_t38, m_t39, m_t40, m_t41,
  78. NULL );
  79. #else
  80. create( 40, 18, 40, 17 );
  81. #endif
  82. };
  83. pruCoresWindow::~pruCoresWindow(){
  84. #ifdef NEWT_CLI
  85. newtPopWindow();
  86. #else
  87. #endif
  88. };
  89. void pruCoresWindow::paint( void ){
  90. volatile structTUPUS *tTUPUS;
  91. #ifdef NEWT_CLI
  92. char tBuffer[245];
  93. newtCenteredWindow( m_w, m_h, "PRU Cores Info" );
  94. tTUPUS = m_pSOC->getTUPUS( 0 , 0 );
  95. if( tTUPUS != NULL ) {
  96. sprintf( tBuffer, "Host status: 0x%08X", tTUPUS->HOST_status );
  97. newtTextboxSetText( m_t1, tBuffer );
  98. sprintf( tBuffer, "Host cmd: 0x%08X", tTUPUS->HOST_command );
  99. newtTextboxSetText( m_t2, tBuffer );
  100. sprintf( tBuffer, "Host address: 0x%08X", tTUPUS->HOST_address );
  101. newtTextboxSetText( m_t3, tBuffer );
  102. sprintf( tBuffer, "Host data: 0x%08X", tTUPUS->HOST_data );
  103. newtTextboxSetText( m_t4, tBuffer );
  104. sprintf( tBuffer, "PRU ID: 0x%08X", tTUPUS->PRU_id );
  105. newtTextboxSetText( m_t5, tBuffer );
  106. sprintf( tBuffer, "PRU status: 0x%08X", tTUPUS->PRU_status );
  107. newtTextboxSetText( m_t6, tBuffer );
  108. sprintf( tBuffer, "PRU address: 0x%08X", tTUPUS->PRU_address );
  109. newtTextboxSetText( m_t7, tBuffer );
  110. sprintf( tBuffer, "PRU data: 0x%08X", tTUPUS->PRU_data );
  111. newtTextboxSetText( m_t8, tBuffer );
  112. sprintf( tBuffer, "Build Type: 0x%08X", tTUPUS->CORE_id );
  113. newtTextboxSetText( m_t38, tBuffer );
  114. MO_STATUS tT;
  115. *((uint32_t *)&tT) = m_pSOC->getMotorStatus();
  116. sprintf( tBuffer, "O[%s]L[%s]I[%d]M[%d:%d]M[%d:%d]S[%d]E[%d]",
  117. (tT.online?"A":"D"),
  118. (tT.lrf_en?"A":"D"),
  119. tT.inter_mode,
  120. tT.v_motor_en,
  121. tT.v_motor_ok,
  122. tT.h_motor_en,
  123. tT.h_motor_ok,
  124. tT.simulate,
  125. tT.param_err );
  126. newtTextboxSetText( m_t9, tBuffer );
  127. } else {
  128. sprintf( tBuffer, "Not Initialized");
  129. newtTextboxSetText( m_t1, tBuffer );
  130. };
  131. tTUPUS = m_pSOC->getTUPUS( 0 , 1 );
  132. if( tTUPUS != NULL ) {
  133. sprintf( tBuffer, "Host status: 0x%08X", tTUPUS->HOST_status );
  134. newtTextboxSetText( m_t10, tBuffer );
  135. sprintf( tBuffer, "Host cmd: 0x%08X", tTUPUS->HOST_command );
  136. newtTextboxSetText( m_t11, tBuffer );
  137. sprintf( tBuffer, "Host address: 0x%08X", tTUPUS->HOST_address );
  138. newtTextboxSetText( m_t12, tBuffer );
  139. sprintf( tBuffer, "Host data: 0x%08X", tTUPUS->HOST_data );
  140. newtTextboxSetText( m_t13, tBuffer );
  141. sprintf( tBuffer, "PRU ID: 0x%08X", tTUPUS->PRU_id );
  142. newtTextboxSetText( m_t14, tBuffer );
  143. sprintf( tBuffer, "PRU status: 0x%08X", tTUPUS->PRU_status );
  144. newtTextboxSetText( m_t15, tBuffer );
  145. sprintf( tBuffer, "PRU address: 0x%08X", tTUPUS->PRU_address );
  146. newtTextboxSetText( m_t16, tBuffer );
  147. sprintf( tBuffer, "PRU data: 0x%08X", tTUPUS->PRU_data );
  148. newtTextboxSetText( m_t17, tBuffer );
  149. sprintf( tBuffer, "Build Type: 0x%08X", tTUPUS->CORE_id );
  150. newtTextboxSetText( m_t39, tBuffer );
  151. sprintf( tBuffer, "-- No Status of This Core --" );
  152. newtTextboxSetText( m_t18, tBuffer );
  153. } else {
  154. sprintf( tBuffer, "Not Initialized");
  155. newtTextboxSetText( m_t10, tBuffer );
  156. };
  157. tTUPUS = m_pSOC->getTUPUS( 1 , 0 );
  158. if( tTUPUS != NULL ) {
  159. sprintf( tBuffer, "Host status: 0x%08X", tTUPUS->HOST_status );
  160. newtTextboxSetText( m_t19, tBuffer );
  161. sprintf( tBuffer, "Host cmd: 0x%08X", tTUPUS->HOST_command );
  162. newtTextboxSetText( m_t20, tBuffer );
  163. sprintf( tBuffer, "Host address: 0x%08X", tTUPUS->HOST_address );
  164. newtTextboxSetText( m_t21, tBuffer );
  165. sprintf( tBuffer, "Host data: 0x%08X", tTUPUS->HOST_data );
  166. newtTextboxSetText( m_t22, tBuffer );
  167. sprintf( tBuffer, "PRU ID: 0x%08X", tTUPUS->PRU_id );
  168. newtTextboxSetText( m_t23, tBuffer );
  169. sprintf( tBuffer, "PRU status: 0x%08X", tTUPUS->PRU_status );
  170. newtTextboxSetText( m_t24, tBuffer );
  171. sprintf( tBuffer, "PRU address: 0x%08X", tTUPUS->PRU_address );
  172. newtTextboxSetText( m_t25, tBuffer );
  173. sprintf( tBuffer, "PRU data: 0x%08X", tTUPUS->PRU_data );
  174. newtTextboxSetText( m_t26, tBuffer );
  175. sprintf( tBuffer, "Build Type: 0x%08X", tTUPUS->CORE_id );
  176. newtTextboxSetText( m_t40, tBuffer );
  177. sprintf( tBuffer, "Base Shift: %d Mirror Shift: %d", m_pSOC->getBaseShift(), m_pSOC->getMirrorShift());
  178. newtTextboxSetText( m_t27, tBuffer );
  179. } else {
  180. sprintf( tBuffer, "Not Initialized");
  181. newtTextboxSetText( m_t19, tBuffer );
  182. };
  183. tTUPUS = m_pSOC->getTUPUS( 1 , 1 );
  184. if( tTUPUS != NULL ) {
  185. sprintf( tBuffer, "Host status: 0x%08X", tTUPUS->HOST_status );
  186. newtTextboxSetText( m_t28, tBuffer );
  187. sprintf( tBuffer, "Host cmd: 0x%08X", tTUPUS->HOST_command );
  188. newtTextboxSetText( m_t29, tBuffer );
  189. sprintf( tBuffer, "Host address: 0x%08X", tTUPUS->HOST_address );
  190. newtTextboxSetText( m_t30, tBuffer );
  191. sprintf( tBuffer, "Host data: 0x%08X", tTUPUS->HOST_data );
  192. newtTextboxSetText( m_t31, tBuffer );
  193. sprintf( tBuffer, "PRU ID: 0x%08X", tTUPUS->PRU_id );
  194. newtTextboxSetText( m_t32, tBuffer );
  195. sprintf( tBuffer, "PRU status: 0x%08X", tTUPUS->PRU_status );
  196. newtTextboxSetText( m_t33, tBuffer );
  197. sprintf( tBuffer, "PRU address: 0x%08X", tTUPUS->PRU_address );
  198. newtTextboxSetText( m_t34, tBuffer );
  199. sprintf( tBuffer, "PRU data: 0x%08X", tTUPUS->PRU_data );
  200. newtTextboxSetText( m_t35, tBuffer );
  201. sprintf( tBuffer, "Build Type: 0x%08X", tTUPUS->CORE_id );
  202. newtTextboxSetText( m_t41, tBuffer );
  203. DT_STATUS tT;
  204. TH_PARAMS tP;
  205. uint32_t tVal;
  206. tVal = m_pSOC->getThCoreStatus();
  207. memcpy( &tT, &tVal, sizeof(DT_STATUS));
  208. sprintf( tBuffer, "O[%s]W[%s]M[%d]R[%d]E[%d]",
  209. (tT.online?"A":"D"),
  210. (tT.work_en?"A":"D"),
  211. tT.mode,
  212. tT.req,
  213. tT.param_err );
  214. newtTextboxSetText( m_t36, tBuffer );
  215. tVal = m_pSOC->getThCoreParams();
  216. memcpy( &tP, &tVal, sizeof(TH_PARAMS));
  217. sprintf( tBuffer, "Flip:%d GP:%d Off:%d Ord:%d A_TH:%d",
  218. tP.flip_size,
  219. tP.good_points,
  220. tP.offset,
  221. tP.order,
  222. tP.self_build_ena );
  223. newtTextboxSetText( m_t37, tBuffer );
  224. } else {
  225. sprintf( tBuffer, "Not Initialized");
  226. newtTextboxSetText( m_t28, tBuffer );
  227. };
  228. newtDrawForm( m_oForm );
  229. newtRefresh();
  230. #else
  231. volatile pruCfg *c_pPRUSS = NULL;
  232. volatile pruCtrl *c_pPRU = NULL;
  233. c_pPRUSS = m_pSOC->getPRUSS_GFG( 1 );
  234. c_pPRU = m_pSOC->getPRU_CTRL( 1, 0 );
  235. createBox( true );
  236. mvwprintw( m_pWND, 2,2, " PRUSS%d Config at: \t%p", 1, c_pPRUSS );
  237. if( c_pPRUSS != NULL ) {
  238. mvwprintw( m_pWND, 3,2, " PRUSS%d Revision ID: \t0x%08x", 1, c_pPRUSS->REVID );
  239. } else {
  240. mvwprintw( m_pWND, 3,2, " Not Init" );
  241. }
  242. if( c_pPRU != NULL ) {
  243. mvwprintw( m_pWND, 4,2, " PRUSS%d_PRU%d INFO:", 1, 0 );
  244. mvwprintw( m_pWND, 6,2, " soft reset bit: \t%d", c_pPRU->CTRL_bit.SOFT_RST_N );
  245. mvwprintw( m_pWND, 7,2, " enable bit: \t\t%d", c_pPRU->CTRL_bit.ENABLE );
  246. mvwprintw( m_pWND, 8,2, " sleeping bit: \t%d", c_pPRU->CTRL_bit.SLEEPING );
  247. mvwprintw( m_pWND, 9,2, " counter enable bit: \t%d", c_pPRU->CTRL_bit.COUNTER_ENABLE );
  248. mvwprintw( m_pWND, 10,2, " single step bit: \t%d", c_pPRU->CTRL_bit.SINGLE_STEP );
  249. mvwprintw( m_pWND, 11,2, " run state bit: \t%d", c_pPRU->CTRL_bit.RUNSTATE );
  250. mvwprintw( m_pWND, 12,2, " PC counter init val: x%08x", c_pPRU->CTRL_bit.PCOUNTER_RST_VAL );
  251. mvwprintw( m_pWND, 13,2, " PC counter value: \t%d", c_pPRU->STS_bit.PCOUNTER );
  252. mvwprintw( m_pWND, 14,2, " cycle count value: \t%d", c_pPRU->CYCLE_bit.CYCLECOUNT );
  253. mvwprintw( m_pWND, 15,2, " stall count value: \t%d", c_pPRU->STALL_bit.STALLCOUNT );
  254. } else {
  255. mvwprintw( m_pWND, 4,2, " NO PRU INFO" );
  256. }
  257. wrefresh( m_pWND );
  258. #endif
  259. };