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.

109 lines
4.6 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #include "adc1Window.h"
  2. //#include "../../source/lib/hardware/soc/modules/adc/adc_ss.h"
  3. #ifdef NEWT_CLI
  4. adc1Window::adc1Window(){
  5. m_pSOC = classSOC::getInstance();
  6. m_x = 81;
  7. m_y = 18;
  8. m_w = 44;
  9. m_h = 17;
  10. m_l1 = newtLabel( 3, 1, "ADC1 Config:" );
  11. m_t1 = newtTextbox( 3, 3, 38, 1, 0 );
  12. m_t2 = newtTextbox( 3, 4, 38, 1, 0 );
  13. m_t3 = newtTextbox( 3, 5, 38, 1, 0 );
  14. m_t4 = newtTextbox( 3, 6, 38, 1, 0 );
  15. m_t5 = newtTextbox( 3, 7, 38, 1, 0 );
  16. m_t6 = newtTextbox( 3, 8, 38, 1, 0 );
  17. m_t7 = newtTextbox( 3, 9, 38, 1, 0 );
  18. m_t8 = newtTextbox( 3, 10, 38, 1, 0 );
  19. m_t9 = newtTextbox( 3, 11, 38, 1, 0 );
  20. m_t10 = newtTextbox( 3, 12, 38, 1, 0 );
  21. m_t11 = newtTextbox( 3, 13, 38, 1, 0 );
  22. m_b1 = newtCompactButton( 3, 15, "Close" );
  23. newtFormAddComponents( m_oForm, m_l1, m_t1, m_t2, m_t3, m_t4, m_t5, m_t6, m_t7, m_t8, m_t9, m_t10, m_t11, m_b1, NULL );
  24. //newtFormSetBackground( m_oForm, NEWT_COLORSET_CHECKBOX );
  25. //paint();
  26. };
  27. adc1Window::~adc1Window(){
  28. newtPopWindow();
  29. };
  30. void adc1Window::paint(){
  31. volatile sysAdc1MagSs *c_pADC = NULL;
  32. char tBuffer[245];
  33. c_pADC = m_pSOC->getADC1_CTRL();
  34. //newtOpenWindow( m_x, m_y, m_w, m_h, "ADC Info" );
  35. newtCenteredWindow( m_w, m_h, "ADC Info" );
  36. if( c_pADC != NULL ) {
  37. sprintf( tBuffer, "ADC1 Revision ID: \t0x%08x", c_pADC->REVISION );
  38. newtTextboxSetText( m_t1, tBuffer );
  39. sprintf( tBuffer, "ADC CTRL: \t\t%08x", c_pADC->CTRL );
  40. newtTextboxSetText( m_t2, tBuffer );
  41. sprintf( tBuffer, "ADC STEPEN: \t\t%08x", c_pADC->STEPEN );
  42. newtTextboxSetText( m_t3, tBuffer );
  43. sprintf( tBuffer, "Seq[0]: \t\t%08x", c_pADC->STEPCONFIG1 );
  44. newtTextboxSetText( m_t4, tBuffer );
  45. sprintf( tBuffer, "Seq[1]: \t\t%08x", c_pADC->STEPCONFIG2 );
  46. newtTextboxSetText( m_t5, tBuffer );
  47. sprintf( tBuffer, "Seq[2]: \t\t%08x", c_pADC->STEPCONFIG3 );
  48. newtTextboxSetText( m_t6, tBuffer );
  49. sprintf( tBuffer, "Seq[3]: \t\t%08x", c_pADC->STEPCONFIG4 );
  50. newtTextboxSetText( m_t7, tBuffer );
  51. sprintf( tBuffer, "Seq[4]: \t\t%08x", c_pADC->STEPCONFIG5 );
  52. newtTextboxSetText( m_t8, tBuffer );
  53. sprintf( tBuffer, "Seq[5]: \t\t%08x", c_pADC->STEPCONFIG6 );
  54. newtTextboxSetText( m_t9, tBuffer );
  55. sprintf( tBuffer, "Seq[6]: \t\t%08x", c_pADC->STEPCONFIG7 );
  56. newtTextboxSetText( m_t10, tBuffer );
  57. sprintf( tBuffer, "Seq[7]: \t\t%08x", c_pADC->STEPCONFIG8 );
  58. newtTextboxSetText( m_t11, tBuffer );
  59. } else {
  60. sprintf( tBuffer, "Not Initialized" );
  61. newtTextboxSetText( m_t1, tBuffer );
  62. }
  63. newtDrawForm( m_oForm );
  64. newtRefresh();
  65. };
  66. #else
  67. // Constructor implementation
  68. adc1Window::adc1Window() : WindowCLI( NULL ){
  69. m_pSOC = classSOC::getInstance();
  70. create( 81, 18, 40, 17 );
  71. };
  72. void adc1Window::paint( void ){
  73. volatile sysAdc1MagSs *c_pADC = NULL;
  74. c_pADC = m_pSOC->getADC1_CTRL();
  75. createBox( true );
  76. mvwprintw( m_pWND, 2,2, " ADC%d Config at: \t%p", 1, c_pADC );
  77. if( c_pADC != NULL ) {
  78. mvwprintw( m_pWND, 3,2, " ADC%d Revision ID: \t0x%08x", 1, c_pADC->REVISION );
  79. } else {
  80. mvwprintw( m_pWND, 3,2, " Not Init" );
  81. }
  82. if( c_pADC != NULL ) {
  83. mvwprintw( m_pWND, 4,2, " ADC%d INFO:", 1 );
  84. mvwprintw( m_pWND, 6,2, " ADC CTRL: \t\t%08x", c_pADC->CTRL );
  85. mvwprintw( m_pWND, 7,2, " ADC STEPEN: \t\t%08x", c_pADC->STEPEN );
  86. mvwprintw( m_pWND, 8,2, " Seq[0]: \t\t%08x", c_pADC->STEPCONFIG[0].CONFIG );
  87. mvwprintw( m_pWND, 9,2, " Seq[1]: \t\t%08x", c_pADC->STEPCONFIG[1].CONFIG );
  88. mvwprintw( m_pWND, 10,2, " Seq[2]: \t\t%08x", c_pADC->STEPCONFIG[2].CONFIG );
  89. mvwprintw( m_pWND, 11,2, " Seq[3]: \t\t%08x", c_pADC->STEPCONFIG[3].CONFIG );
  90. mvwprintw( m_pWND, 12,2, " Seq[4]: \t\t%08x", c_pADC->STEPCONFIG[4].CONFIG );
  91. mvwprintw( m_pWND, 13,2, " Seq[5]: \t\t%08x", c_pADC->STEPCONFIG[5].CONFIG );
  92. mvwprintw( m_pWND, 14,2, " Seq[6]: \t\t%08x", c_pADC->STEPCONFIG[6].CONFIG );
  93. mvwprintw( m_pWND, 15,2, " Seq[7]: \t\t%08x", c_pADC->STEPCONFIG[7].CONFIG );
  94. } else {
  95. mvwprintw( m_pWND, 4,2, " NO ADC INFO" );
  96. }
  97. wrefresh( m_pWND );
  98. };
  99. #endif