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
185 lines
8.7 KiB
#include "pwmInfoWindow.h"
|
|
|
|
pwmInfoWindow::pwmInfoWindow() : WindowCLI( NULL ){
|
|
m_pSOC = classSOC::getInstance();
|
|
m_x = 26;
|
|
m_y = 3;
|
|
m_w = 80;
|
|
m_h = 17;
|
|
#ifdef NEWT_CLI
|
|
m_l1 = newtLabel( 3, 1, "PWMSS0 Config:");
|
|
m_l2 = newtLabel( 39, 1, "PWMSS1 Config:");
|
|
m_t1 = newtTextbox( 3, 2, 38, 1, 0 );
|
|
m_t2 = newtTextbox( 3, 3, 38, 1, 0 );
|
|
m_t3 = newtTextbox( 3, 4, 38, 1, 0 );
|
|
m_t4 = newtTextbox( 3, 5, 38, 1, 0 );
|
|
m_t5 = newtTextbox( 3, 6, 38, 1, 0 );
|
|
m_t6 = newtTextbox( 3, 7, 38, 1, 0 );
|
|
m_t7 = newtTextbox( 3, 8, 38, 1, 0 );
|
|
m_t8 = newtTextbox( 3, 9, 38, 1, 0 );
|
|
m_t9 = newtTextbox( 3, 10, 38, 1, 0 );
|
|
m_t10 = newtTextbox( 3, 11, 38, 1, 0 );
|
|
m_t11 = newtTextbox( 3, 12, 38, 1, 0 );
|
|
m_t12 = newtTextbox( 3, 13, 38, 1, 0 );
|
|
m_t13 = newtTextbox( 3, 14, 38, 1, 0 );
|
|
|
|
m_t14 = newtTextbox( 39, 2, 38, 1, 0 );
|
|
m_t15 = newtTextbox( 39, 3, 38, 1, 0 );
|
|
m_t16 = newtTextbox( 39, 4, 38, 1, 0 );
|
|
m_t17 = newtTextbox( 39, 5, 38, 1, 0 );
|
|
m_t18 = newtTextbox( 39, 6, 38, 1, 0 );
|
|
m_t19 = newtTextbox( 39, 7, 38, 1, 0 );
|
|
m_t20 = newtTextbox( 39, 8, 38, 1, 0 );
|
|
m_t21 = newtTextbox( 39, 9, 38, 1, 0 );
|
|
m_t22 = newtTextbox( 39, 10, 38, 1, 0 );
|
|
m_t23 = newtTextbox( 39, 11, 38, 1, 0 );
|
|
m_t24 = newtTextbox( 39, 12, 38, 1, 0 );
|
|
m_t25 = newtTextbox( 39, 13, 38, 1, 0 );
|
|
m_t26 = newtTextbox( 39, 14, 38, 1, 0 );
|
|
newtFormAddComponents( m_oForm, m_l1, m_l2, m_t1, m_t2, m_t3, m_t4,
|
|
m_t5, m_t6, m_t7, m_t8, m_t9, m_t10, m_t11,
|
|
m_t12, m_t13,m_t14,m_t15,m_t16,m_t17,m_t18,
|
|
m_t19,m_t20,m_t21,m_t22,m_t23,m_t24,m_t25,m_t26, NULL );
|
|
//paint();
|
|
#else
|
|
create( m_x, m_y, m_w, m_h );
|
|
#endif
|
|
};
|
|
|
|
pwmInfoWindow::~pwmInfoWindow(){
|
|
newtPopWindow();
|
|
};
|
|
|
|
void pwmInfoWindow::paint( void ){
|
|
volatile sysPwmss *c_pPWM = NULL;
|
|
#ifdef NEWT_CLI
|
|
char tBuffer[245];
|
|
//newtOpenWindow( m_x, m_y, m_w, m_h, "PWM Info" );
|
|
newtCenteredWindow( m_w, m_h, "PWM Info" );
|
|
c_pPWM = m_pSOC->getPWMSS_CTRL( 1 );
|
|
if( c_pPWM != NULL ) {
|
|
sprintf( tBuffer, "PWMSS0 Signature: 0x%08x",c_pPWM->IDVER );
|
|
newtTextboxSetText( m_t1, tBuffer );
|
|
sprintf( tBuffer, " Scheme: %d Func: %d",
|
|
c_pPWM->IDVER_bit.SCHEME,
|
|
c_pPWM->IDVER_bit.FUNC );
|
|
newtTextboxSetText( m_t2, tBuffer );
|
|
sprintf( tBuffer, "RTL: %d Revision ID: %d.%d Custom:%d",
|
|
c_pPWM->IDVER_bit.R_RTL,
|
|
c_pPWM->IDVER_bit.X_MAJOR,
|
|
c_pPWM->IDVER_bit.Y_MINOR,
|
|
c_pPWM->IDVER_bit.CUSTOM );
|
|
newtTextboxSetText( m_t4, tBuffer );
|
|
sprintf( tBuffer, "ID: \t0x%08X", c_pPWM->ECAP_REVID );
|
|
newtTextboxSetText( m_t5, tBuffer );
|
|
sprintf( tBuffer, "Polarity: \t%s",((c_pPWM->ECAP_ECCTL2_bit.APWMPOL==0)?"High":"Low") );
|
|
newtTextboxSetText( m_t6, tBuffer );
|
|
sprintf( tBuffer, "ECCTL1: \t0x%08X", c_pPWM->ECAP_ECCTL1 );
|
|
newtTextboxSetText( m_t7, tBuffer );
|
|
sprintf( tBuffer, "ECCTL2: \t0x%08X", c_pPWM->ECAP_ECCTL2 );
|
|
newtTextboxSetText( m_t8, tBuffer );
|
|
sprintf( tBuffer, "Period: \t%d (%d nSec)", c_pPWM->ECAP_CAP1, c_pPWM->ECAP_CAP1*10 );
|
|
newtTextboxSetText( m_t9, tBuffer );
|
|
sprintf( tBuffer, "PRESCALE: \t%d", c_pPWM->ECAP_ECCTL1_bit.PRESCALE );
|
|
newtTextboxSetText( m_t10, tBuffer );
|
|
sprintf( tBuffer, "Duty Cycle: \t\t%d (%d nSec)", c_pPWM->ECAP_CAP2, c_pPWM->ECAP_CAP2*10 );
|
|
newtTextboxSetText( m_t11, tBuffer );
|
|
sprintf( tBuffer, "S_Period: \t\t%d (%d nSec)", c_pPWM->ECAP_CAP3, c_pPWM->ECAP_CAP3*10 );
|
|
newtTextboxSetText( m_t12, tBuffer );
|
|
sprintf( tBuffer, "S_Duty Cycle: \t\t%d (%d nSec)", c_pPWM->ECAP_CAP4, c_pPWM->ECAP_CAP4*10 );
|
|
newtTextboxSetText( m_t13, tBuffer );
|
|
} else {
|
|
sprintf( tBuffer, "Not Initialized" );
|
|
newtTextboxSetText( m_t1, tBuffer );
|
|
};
|
|
c_pPWM = m_pSOC->getPWMSS_CTRL( 2 );
|
|
if( c_pPWM != NULL ) {
|
|
sprintf( tBuffer, "PWMSS1 Signature: 0x%08x", c_pPWM->IDVER );
|
|
newtTextboxSetText( m_t14, tBuffer );
|
|
sprintf( tBuffer, " Scheme: %d Func: %d",
|
|
c_pPWM->IDVER_bit.SCHEME,
|
|
c_pPWM->IDVER_bit.FUNC );
|
|
newtTextboxSetText( m_t15, tBuffer );
|
|
sprintf( tBuffer, "RTL: %d Revision ID: %d.%d Custom:%d",
|
|
c_pPWM->IDVER_bit.R_RTL,
|
|
c_pPWM->IDVER_bit.X_MAJOR,
|
|
c_pPWM->IDVER_bit.Y_MINOR,
|
|
c_pPWM->IDVER_bit.CUSTOM );
|
|
newtTextboxSetText( m_t17, tBuffer );
|
|
sprintf( tBuffer, "ID: \t0x%08x", c_pPWM->ECAP_REVID );
|
|
newtTextboxSetText( m_t18, tBuffer );
|
|
sprintf( tBuffer, "Polarity: %s",((c_pPWM->ECAP_ECCTL2_bit.APWMPOL==0)?"High":"Low") );
|
|
newtTextboxSetText( m_t19, tBuffer );
|
|
sprintf( tBuffer, "Time Stamp (TSCTR): %s",((c_pPWM->ECAP_ECCTL2_bit.TSCTRSTOP==0)?"Stoped":"Free-Run") );
|
|
newtTextboxSetText( m_t20, tBuffer );
|
|
sprintf( tBuffer, "Mode: %s", ((c_pPWM->ECAP_ECCTL2_bit.CAP_APWM==0)?"eCAP":"APWM") );
|
|
newtTextboxSetText( m_t21, tBuffer );
|
|
sprintf( tBuffer, "Period: \t%d (%d nSec)", c_pPWM->ECAP_CAP1, c_pPWM->ECAP_CAP1*10 );
|
|
newtTextboxSetText( m_t22, tBuffer );
|
|
sprintf( tBuffer, "PRESCALE: \t%d", c_pPWM->ECAP_ECCTL1_bit.PRESCALE );
|
|
newtTextboxSetText( m_t23, tBuffer );
|
|
sprintf( tBuffer, "Duty Cycle: \t%d (%d nSec)", c_pPWM->ECAP_CAP2, c_pPWM->ECAP_CAP2*10 );
|
|
newtTextboxSetText( m_t24, tBuffer );
|
|
sprintf( tBuffer, "S_Period: \t%d (%d nSec)", c_pPWM->ECAP_CAP3, c_pPWM->ECAP_CAP3*10 );
|
|
newtTextboxSetText( m_t25, tBuffer );
|
|
sprintf( tBuffer, "S_Duty Cycle: %d (%d nSec)", c_pPWM->ECAP_CAP4, c_pPWM->ECAP_CAP4*10 );
|
|
newtTextboxSetText( m_t26, tBuffer );
|
|
} else {
|
|
sprintf( tBuffer, "Not Initialized");
|
|
newtTextboxSetText( m_t14, tBuffer );
|
|
};
|
|
newtDrawForm( m_oForm );
|
|
newtRefresh();
|
|
#else
|
|
createBox( true );
|
|
mvwprintw( m_pWND, 2,2,"PWMSS%d Config at: \t%p", 0, 0 );
|
|
c_pPWM = m_pSOC->getPWMSS_CTRL( 1 );
|
|
if( c_pPWM != NULL ) {
|
|
mvwprintw( m_pWND, 3,2,"PWMSS%d val: 0x%08x", 0, c_pPWM->IDVER );
|
|
mvwprintw( m_pWND, 4,2," Scheme: %d Func: %d",
|
|
c_pPWM->IDVER_bit.SCHEME,
|
|
c_pPWM->IDVER_bit.FUNC );
|
|
mvwprintw( m_pWND, 5,2,"RTL: %d Revision ID: %d.%d Custom:%d",
|
|
c_pPWM->IDVER_bit.R_RTL,
|
|
c_pPWM->IDVER_bit.X_MAJOR,
|
|
c_pPWM->IDVER_bit.Y_MINOR,
|
|
c_pPWM->IDVER_bit.CUSTOM );
|
|
mvwprintw( m_pWND, 7,2,"ID: \t0x%08x", c_pPWM->ECAP_REVID );
|
|
mvwprintw( m_pWND, 8,2,"Polarity: %s",((c_pPWM->ECAP_ECCTL2_bit.APWMPOL==0)?"High":"Low") );
|
|
mvwprintw( m_pWND, 9,2,"ECCTL1: \t\t%08X", c_pPWM->ECAP_ECCTL1 );
|
|
mvwprintw( m_pWND, 10,2,"ECCTL2: \t\t%08X", c_pPWM->ECAP_ECCTL2 );
|
|
mvwprintw( m_pWND, 11,2,"Period: \t%d (%d nSec)", c_pPWM->ECAP_CAP1, c_pPWM->ECAP_CAP1*10 );
|
|
mvwprintw( m_pWND, 12,2,"PRESCALE: \t%d", c_pPWM->ECAP_ECCTL1_bit.PRESCALE );
|
|
mvwprintw( m_pWND, 13,2,"Duty Cycle: \t%d (%d nSec)", c_pPWM->ECAP_CAP2, c_pPWM->ECAP_CAP2*10 );
|
|
mvwprintw( m_pWND, 14,2,"S_Period: \t%d (%d nSec)", c_pPWM->ECAP_CAP3, c_pPWM->ECAP_CAP3*10 );
|
|
mvwprintw( m_pWND, 15,2,"S_Duty Cycle: %d (%d nSec)", c_pPWM->ECAP_CAP4, c_pPWM->ECAP_CAP4*10 );
|
|
} else {
|
|
mvwprintw( m_pWND, 3,2,"Not Initialized");
|
|
}
|
|
c_pPWM = m_pSOC->getPWMSS_CTRL( 2 );
|
|
mvwprintw( m_pWND, 2,42,"PWMSS%d Config at: \t%p", 1, 0 );
|
|
if( c_pPWM != NULL ) {
|
|
mvwprintw( m_pWND, 3,42,"PWMSS%d val: 0x%08x", 1, c_pPWM->IDVER );
|
|
mvwprintw( m_pWND, 4,42," Scheme: %d Func: %d",
|
|
c_pPWM->IDVER_bit.SCHEME,
|
|
c_pPWM->IDVER_bit.FUNC );
|
|
mvwprintw( m_pWND, 5,42,"RTL: %d Revision ID: %d.%d Custom:%d",
|
|
c_pPWM->IDVER_bit.R_RTL,
|
|
c_pPWM->IDVER_bit.X_MAJOR,
|
|
c_pPWM->IDVER_bit.Y_MINOR,
|
|
c_pPWM->IDVER_bit.CUSTOM );
|
|
mvwprintw( m_pWND, 7,42,"ID: \t0x%08x", c_pPWM->ECAP_REVID );
|
|
mvwprintw( m_pWND, 8,42,"Polarity: %s",((c_pPWM->ECAP_ECCTL2_bit.APWMPOL==0)?"High":"Low") );
|
|
mvwprintw( m_pWND, 9,42,"Time Stamp (TSCTR): %s",((c_pPWM->ECAP_ECCTL2_bit.TSCTRSTOP==0)?"Stoped":"Free-Run") );
|
|
mvwprintw( m_pWND, 10,42,"Mode: %s", ((c_pPWM->ECAP_ECCTL2_bit.CAP_APWM==0)?"eCAP":"APWM") );
|
|
mvwprintw( m_pWND, 11,42,"Period: \t%d (%d nSec)", c_pPWM->ECAP_CAP1, c_pPWM->ECAP_CAP1*10 );
|
|
mvwprintw( m_pWND, 12,42,"PRESCALE: \t%d", c_pPWM->ECAP_ECCTL1_bit.PRESCALE );
|
|
mvwprintw( m_pWND, 13,42,"Duty Cycle: \t%d (%d nSec)", c_pPWM->ECAP_CAP2, c_pPWM->ECAP_CAP2*10 );
|
|
mvwprintw( m_pWND, 14,42,"S_Period: \t%d (%d nSec)", c_pPWM->ECAP_CAP3, c_pPWM->ECAP_CAP3*10 );
|
|
mvwprintw( m_pWND, 15,42,"S_Duty Cycle: %d (%d nSec)", c_pPWM->ECAP_CAP4, c_pPWM->ECAP_CAP4*10 );
|
|
} else {
|
|
mvwprintw( m_pWND, 3,42,"Not Initialized");
|
|
};
|
|
wrefresh( m_pWND );
|
|
#endif
|
|
};
|