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.

185 lines
8.7 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #include "pwmInfoWindow.h"
  2. pwmInfoWindow::pwmInfoWindow() : WindowCLI( NULL ){
  3. m_pSOC = classSOC::getInstance();
  4. m_x = 26;
  5. m_y = 3;
  6. m_w = 80;
  7. m_h = 17;
  8. #ifdef NEWT_CLI
  9. m_l1 = newtLabel( 3, 1, "PWMSS0 Config:");
  10. m_l2 = newtLabel( 39, 1, "PWMSS1 Config:");
  11. m_t1 = newtTextbox( 3, 2, 38, 1, 0 );
  12. m_t2 = newtTextbox( 3, 3, 38, 1, 0 );
  13. m_t3 = newtTextbox( 3, 4, 38, 1, 0 );
  14. m_t4 = newtTextbox( 3, 5, 38, 1, 0 );
  15. m_t5 = newtTextbox( 3, 6, 38, 1, 0 );
  16. m_t6 = newtTextbox( 3, 7, 38, 1, 0 );
  17. m_t7 = newtTextbox( 3, 8, 38, 1, 0 );
  18. m_t8 = newtTextbox( 3, 9, 38, 1, 0 );
  19. m_t9 = newtTextbox( 3, 10, 38, 1, 0 );
  20. m_t10 = newtTextbox( 3, 11, 38, 1, 0 );
  21. m_t11 = newtTextbox( 3, 12, 38, 1, 0 );
  22. m_t12 = newtTextbox( 3, 13, 38, 1, 0 );
  23. m_t13 = newtTextbox( 3, 14, 38, 1, 0 );
  24. m_t14 = newtTextbox( 39, 2, 38, 1, 0 );
  25. m_t15 = newtTextbox( 39, 3, 38, 1, 0 );
  26. m_t16 = newtTextbox( 39, 4, 38, 1, 0 );
  27. m_t17 = newtTextbox( 39, 5, 38, 1, 0 );
  28. m_t18 = newtTextbox( 39, 6, 38, 1, 0 );
  29. m_t19 = newtTextbox( 39, 7, 38, 1, 0 );
  30. m_t20 = newtTextbox( 39, 8, 38, 1, 0 );
  31. m_t21 = newtTextbox( 39, 9, 38, 1, 0 );
  32. m_t22 = newtTextbox( 39, 10, 38, 1, 0 );
  33. m_t23 = newtTextbox( 39, 11, 38, 1, 0 );
  34. m_t24 = newtTextbox( 39, 12, 38, 1, 0 );
  35. m_t25 = newtTextbox( 39, 13, 38, 1, 0 );
  36. m_t26 = newtTextbox( 39, 14, 38, 1, 0 );
  37. newtFormAddComponents( m_oForm, m_l1, m_l2, m_t1, m_t2, m_t3, m_t4,
  38. m_t5, m_t6, m_t7, m_t8, m_t9, m_t10, m_t11,
  39. m_t12, m_t13,m_t14,m_t15,m_t16,m_t17,m_t18,
  40. m_t19,m_t20,m_t21,m_t22,m_t23,m_t24,m_t25,m_t26, NULL );
  41. //paint();
  42. #else
  43. create( m_x, m_y, m_w, m_h );
  44. #endif
  45. };
  46. pwmInfoWindow::~pwmInfoWindow(){
  47. newtPopWindow();
  48. };
  49. void pwmInfoWindow::paint( void ){
  50. volatile sysPwmss *c_pPWM = NULL;
  51. #ifdef NEWT_CLI
  52. char tBuffer[245];
  53. //newtOpenWindow( m_x, m_y, m_w, m_h, "PWM Info" );
  54. newtCenteredWindow( m_w, m_h, "PWM Info" );
  55. c_pPWM = m_pSOC->getPWMSS_CTRL( 1 );
  56. if( c_pPWM != NULL ) {
  57. sprintf( tBuffer, "PWMSS0 Signature: 0x%08x",c_pPWM->IDVER );
  58. newtTextboxSetText( m_t1, tBuffer );
  59. sprintf( tBuffer, " Scheme: %d Func: %d",
  60. c_pPWM->IDVER_bit.SCHEME,
  61. c_pPWM->IDVER_bit.FUNC );
  62. newtTextboxSetText( m_t2, tBuffer );
  63. sprintf( tBuffer, "RTL: %d Revision ID: %d.%d Custom:%d",
  64. c_pPWM->IDVER_bit.R_RTL,
  65. c_pPWM->IDVER_bit.X_MAJOR,
  66. c_pPWM->IDVER_bit.Y_MINOR,
  67. c_pPWM->IDVER_bit.CUSTOM );
  68. newtTextboxSetText( m_t4, tBuffer );
  69. sprintf( tBuffer, "ID: \t0x%08X", c_pPWM->ECAP_REVID );
  70. newtTextboxSetText( m_t5, tBuffer );
  71. sprintf( tBuffer, "Polarity: \t%s",((c_pPWM->ECAP_ECCTL2_bit.APWMPOL==0)?"High":"Low") );
  72. newtTextboxSetText( m_t6, tBuffer );
  73. sprintf( tBuffer, "ECCTL1: \t0x%08X", c_pPWM->ECAP_ECCTL1 );
  74. newtTextboxSetText( m_t7, tBuffer );
  75. sprintf( tBuffer, "ECCTL2: \t0x%08X", c_pPWM->ECAP_ECCTL2 );
  76. newtTextboxSetText( m_t8, tBuffer );
  77. sprintf( tBuffer, "Period: \t%d (%d nSec)", c_pPWM->ECAP_CAP1, c_pPWM->ECAP_CAP1*10 );
  78. newtTextboxSetText( m_t9, tBuffer );
  79. sprintf( tBuffer, "PRESCALE: \t%d", c_pPWM->ECAP_ECCTL1_bit.PRESCALE );
  80. newtTextboxSetText( m_t10, tBuffer );
  81. sprintf( tBuffer, "Duty Cycle: \t\t%d (%d nSec)", c_pPWM->ECAP_CAP2, c_pPWM->ECAP_CAP2*10 );
  82. newtTextboxSetText( m_t11, tBuffer );
  83. sprintf( tBuffer, "S_Period: \t\t%d (%d nSec)", c_pPWM->ECAP_CAP3, c_pPWM->ECAP_CAP3*10 );
  84. newtTextboxSetText( m_t12, tBuffer );
  85. sprintf( tBuffer, "S_Duty Cycle: \t\t%d (%d nSec)", c_pPWM->ECAP_CAP4, c_pPWM->ECAP_CAP4*10 );
  86. newtTextboxSetText( m_t13, tBuffer );
  87. } else {
  88. sprintf( tBuffer, "Not Initialized" );
  89. newtTextboxSetText( m_t1, tBuffer );
  90. };
  91. c_pPWM = m_pSOC->getPWMSS_CTRL( 2 );
  92. if( c_pPWM != NULL ) {
  93. sprintf( tBuffer, "PWMSS1 Signature: 0x%08x", c_pPWM->IDVER );
  94. newtTextboxSetText( m_t14, tBuffer );
  95. sprintf( tBuffer, " Scheme: %d Func: %d",
  96. c_pPWM->IDVER_bit.SCHEME,
  97. c_pPWM->IDVER_bit.FUNC );
  98. newtTextboxSetText( m_t15, tBuffer );
  99. sprintf( tBuffer, "RTL: %d Revision ID: %d.%d Custom:%d",
  100. c_pPWM->IDVER_bit.R_RTL,
  101. c_pPWM->IDVER_bit.X_MAJOR,
  102. c_pPWM->IDVER_bit.Y_MINOR,
  103. c_pPWM->IDVER_bit.CUSTOM );
  104. newtTextboxSetText( m_t17, tBuffer );
  105. sprintf( tBuffer, "ID: \t0x%08x", c_pPWM->ECAP_REVID );
  106. newtTextboxSetText( m_t18, tBuffer );
  107. sprintf( tBuffer, "Polarity: %s",((c_pPWM->ECAP_ECCTL2_bit.APWMPOL==0)?"High":"Low") );
  108. newtTextboxSetText( m_t19, tBuffer );
  109. sprintf( tBuffer, "Time Stamp (TSCTR): %s",((c_pPWM->ECAP_ECCTL2_bit.TSCTRSTOP==0)?"Stoped":"Free-Run") );
  110. newtTextboxSetText( m_t20, tBuffer );
  111. sprintf( tBuffer, "Mode: %s", ((c_pPWM->ECAP_ECCTL2_bit.CAP_APWM==0)?"eCAP":"APWM") );
  112. newtTextboxSetText( m_t21, tBuffer );
  113. sprintf( tBuffer, "Period: \t%d (%d nSec)", c_pPWM->ECAP_CAP1, c_pPWM->ECAP_CAP1*10 );
  114. newtTextboxSetText( m_t22, tBuffer );
  115. sprintf( tBuffer, "PRESCALE: \t%d", c_pPWM->ECAP_ECCTL1_bit.PRESCALE );
  116. newtTextboxSetText( m_t23, tBuffer );
  117. sprintf( tBuffer, "Duty Cycle: \t%d (%d nSec)", c_pPWM->ECAP_CAP2, c_pPWM->ECAP_CAP2*10 );
  118. newtTextboxSetText( m_t24, tBuffer );
  119. sprintf( tBuffer, "S_Period: \t%d (%d nSec)", c_pPWM->ECAP_CAP3, c_pPWM->ECAP_CAP3*10 );
  120. newtTextboxSetText( m_t25, tBuffer );
  121. sprintf( tBuffer, "S_Duty Cycle: %d (%d nSec)", c_pPWM->ECAP_CAP4, c_pPWM->ECAP_CAP4*10 );
  122. newtTextboxSetText( m_t26, tBuffer );
  123. } else {
  124. sprintf( tBuffer, "Not Initialized");
  125. newtTextboxSetText( m_t14, tBuffer );
  126. };
  127. newtDrawForm( m_oForm );
  128. newtRefresh();
  129. #else
  130. createBox( true );
  131. mvwprintw( m_pWND, 2,2,"PWMSS%d Config at: \t%p", 0, 0 );
  132. c_pPWM = m_pSOC->getPWMSS_CTRL( 1 );
  133. if( c_pPWM != NULL ) {
  134. mvwprintw( m_pWND, 3,2,"PWMSS%d val: 0x%08x", 0, c_pPWM->IDVER );
  135. mvwprintw( m_pWND, 4,2," Scheme: %d Func: %d",
  136. c_pPWM->IDVER_bit.SCHEME,
  137. c_pPWM->IDVER_bit.FUNC );
  138. mvwprintw( m_pWND, 5,2,"RTL: %d Revision ID: %d.%d Custom:%d",
  139. c_pPWM->IDVER_bit.R_RTL,
  140. c_pPWM->IDVER_bit.X_MAJOR,
  141. c_pPWM->IDVER_bit.Y_MINOR,
  142. c_pPWM->IDVER_bit.CUSTOM );
  143. mvwprintw( m_pWND, 7,2,"ID: \t0x%08x", c_pPWM->ECAP_REVID );
  144. mvwprintw( m_pWND, 8,2,"Polarity: %s",((c_pPWM->ECAP_ECCTL2_bit.APWMPOL==0)?"High":"Low") );
  145. mvwprintw( m_pWND, 9,2,"ECCTL1: \t\t%08X", c_pPWM->ECAP_ECCTL1 );
  146. mvwprintw( m_pWND, 10,2,"ECCTL2: \t\t%08X", c_pPWM->ECAP_ECCTL2 );
  147. mvwprintw( m_pWND, 11,2,"Period: \t%d (%d nSec)", c_pPWM->ECAP_CAP1, c_pPWM->ECAP_CAP1*10 );
  148. mvwprintw( m_pWND, 12,2,"PRESCALE: \t%d", c_pPWM->ECAP_ECCTL1_bit.PRESCALE );
  149. mvwprintw( m_pWND, 13,2,"Duty Cycle: \t%d (%d nSec)", c_pPWM->ECAP_CAP2, c_pPWM->ECAP_CAP2*10 );
  150. mvwprintw( m_pWND, 14,2,"S_Period: \t%d (%d nSec)", c_pPWM->ECAP_CAP3, c_pPWM->ECAP_CAP3*10 );
  151. mvwprintw( m_pWND, 15,2,"S_Duty Cycle: %d (%d nSec)", c_pPWM->ECAP_CAP4, c_pPWM->ECAP_CAP4*10 );
  152. } else {
  153. mvwprintw( m_pWND, 3,2,"Not Initialized");
  154. }
  155. c_pPWM = m_pSOC->getPWMSS_CTRL( 2 );
  156. mvwprintw( m_pWND, 2,42,"PWMSS%d Config at: \t%p", 1, 0 );
  157. if( c_pPWM != NULL ) {
  158. mvwprintw( m_pWND, 3,42,"PWMSS%d val: 0x%08x", 1, c_pPWM->IDVER );
  159. mvwprintw( m_pWND, 4,42," Scheme: %d Func: %d",
  160. c_pPWM->IDVER_bit.SCHEME,
  161. c_pPWM->IDVER_bit.FUNC );
  162. mvwprintw( m_pWND, 5,42,"RTL: %d Revision ID: %d.%d Custom:%d",
  163. c_pPWM->IDVER_bit.R_RTL,
  164. c_pPWM->IDVER_bit.X_MAJOR,
  165. c_pPWM->IDVER_bit.Y_MINOR,
  166. c_pPWM->IDVER_bit.CUSTOM );
  167. mvwprintw( m_pWND, 7,42,"ID: \t0x%08x", c_pPWM->ECAP_REVID );
  168. mvwprintw( m_pWND, 8,42,"Polarity: %s",((c_pPWM->ECAP_ECCTL2_bit.APWMPOL==0)?"High":"Low") );
  169. mvwprintw( m_pWND, 9,42,"Time Stamp (TSCTR): %s",((c_pPWM->ECAP_ECCTL2_bit.TSCTRSTOP==0)?"Stoped":"Free-Run") );
  170. mvwprintw( m_pWND, 10,42,"Mode: %s", ((c_pPWM->ECAP_ECCTL2_bit.CAP_APWM==0)?"eCAP":"APWM") );
  171. mvwprintw( m_pWND, 11,42,"Period: \t%d (%d nSec)", c_pPWM->ECAP_CAP1, c_pPWM->ECAP_CAP1*10 );
  172. mvwprintw( m_pWND, 12,42,"PRESCALE: \t%d", c_pPWM->ECAP_ECCTL1_bit.PRESCALE );
  173. mvwprintw( m_pWND, 13,42,"Duty Cycle: \t%d (%d nSec)", c_pPWM->ECAP_CAP2, c_pPWM->ECAP_CAP2*10 );
  174. mvwprintw( m_pWND, 14,42,"S_Period: \t%d (%d nSec)", c_pPWM->ECAP_CAP3, c_pPWM->ECAP_CAP3*10 );
  175. mvwprintw( m_pWND, 15,42,"S_Duty Cycle: %d (%d nSec)", c_pPWM->ECAP_CAP4, c_pPWM->ECAP_CAP4*10 );
  176. } else {
  177. mvwprintw( m_pWND, 3,42,"Not Initialized");
  178. };
  179. wrefresh( m_pWND );
  180. #endif
  181. };