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
285 lines
11 KiB
#include "pruCoresWindow.h"
|
|
#include "../../source/lib/hardware/soc/modules/pru/pru_ss.h"
|
|
|
|
pruCoresWindow::pruCoresWindow() : WindowCLI( NULL ){
|
|
m_pSOC = classSOC::getInstance();
|
|
m_x = 6;
|
|
m_y = 3;
|
|
m_w = 80;
|
|
m_h = 32;
|
|
#ifdef NEWT_CLI
|
|
m_l1 = newtLabel( 3, 1, "--- PRU0 [Pulse Control] ---");
|
|
m_l2 = newtLabel( 3, 2, "TUPUS[0,0]:");
|
|
|
|
m_t1 = newtTextbox( 3, 3, 32, 1, 0 );
|
|
m_t2 = newtTextbox( 3, 4, 32, 1, 0 );
|
|
m_t3 = newtTextbox( 3, 5, 32, 1, 0 );
|
|
m_t4 = newtTextbox( 3, 6, 32, 1, 0 );
|
|
m_t5 = newtTextbox( 3, 7, 32, 1, 0 );
|
|
m_t6 = newtTextbox( 3, 8, 32, 1, 0 );
|
|
m_t7 = newtTextbox( 3, 9, 32, 1, 0 );
|
|
m_t8 = newtTextbox( 3, 10, 32, 1, 0 );
|
|
m_t38 = newtTextbox( 3, 11, 32, 1, 0 );
|
|
|
|
m_l3 = newtLabel( 3, 12, "Core Status:");
|
|
|
|
m_t9 = newtTextbox( 3, 13, 32, 1, 0 );
|
|
|
|
m_l4 = newtLabel( 3, 15, "--- PRU1 [Motors Control]---");
|
|
m_l5 = newtLabel( 3, 16, "TUPUS[0,1]:");
|
|
|
|
m_t10 = newtTextbox( 3, 17, 32, 1, 0 );
|
|
m_t11 = newtTextbox( 3, 18, 32, 1, 0 );
|
|
m_t12 = newtTextbox( 3, 19, 32, 1, 0 );
|
|
m_t13 = newtTextbox( 3, 20, 32, 1, 0 );
|
|
m_t14 = newtTextbox( 3, 21, 32, 1, 0 );
|
|
m_t15 = newtTextbox( 3, 22, 32, 1, 0 );
|
|
m_t16 = newtTextbox( 3, 23, 32, 1, 0 );
|
|
m_t17 = newtTextbox( 3, 24, 32, 1, 0 );
|
|
m_t39 = newtTextbox( 3, 25, 32, 1, 0 );
|
|
|
|
m_l6 = newtLabel( 3, 26, "Core Status:");
|
|
|
|
m_t18 = newtTextbox( 3, 27, 32, 1, 0 );
|
|
|
|
m_l7 = newtLabel( 39, 1, "--- PRU2 [ADC Control] ---");
|
|
m_l8 = newtLabel( 39, 2, "TUPUS[1,0]:");
|
|
|
|
m_t19 = newtTextbox( 39, 3, 32, 1, 0 );
|
|
m_t20 = newtTextbox( 39, 4, 32, 1, 0 );
|
|
m_t21 = newtTextbox( 39, 5, 32, 1, 0 );
|
|
m_t22 = newtTextbox( 39, 6, 32, 1, 0 );
|
|
m_t23 = newtTextbox( 39, 7, 32, 1, 0 );
|
|
m_t24 = newtTextbox( 39, 8, 32, 1, 0 );
|
|
m_t25 = newtTextbox( 39, 9, 32, 1, 0 );
|
|
m_t26 = newtTextbox( 39, 10, 32, 1, 0 );
|
|
m_t40 = newtTextbox( 39, 11, 32, 1, 0 );
|
|
|
|
m_l9 = newtLabel( 39,12, "Core Status:");
|
|
|
|
m_t27 = newtTextbox( 39, 13, 32, 1, 0 );
|
|
|
|
m_l10 = newtLabel(39,15, "--- PRU3 [Detector] ---");
|
|
m_l11 = newtLabel(39,16, "TUPUS[1,1]:");
|
|
|
|
m_t28 = newtTextbox( 39, 17, 32, 1, 0 );
|
|
m_t29 = newtTextbox( 39, 18, 32, 1, 0 );
|
|
m_t30 = newtTextbox( 39, 19, 32, 1, 0 );
|
|
m_t31 = newtTextbox( 39, 20, 32, 1, 0 );
|
|
m_t32 = newtTextbox( 39, 21, 32, 1, 0 );
|
|
m_t33 = newtTextbox( 39, 22, 32, 1, 0 );
|
|
m_t34 = newtTextbox( 39, 23, 32, 1, 0 );
|
|
m_t35 = newtTextbox( 39, 24, 32, 1, 0 );
|
|
m_t41 = newtTextbox( 39, 25, 32, 1, 0 );
|
|
|
|
m_l12 = newtLabel( 39, 26, "Core Status:");
|
|
m_t36 = newtTextbox( 39, 27, 32, 1, 0 );
|
|
m_l13 = newtLabel( 39,28, "Detector Parameters:");
|
|
m_t37 = newtTextbox( 39, 29, 38, 1, 0 );
|
|
|
|
m_b1 = newtCompactButton( 35, 30, "Close" );
|
|
|
|
newtFormAddComponents( m_oForm, m_l1, m_l2,
|
|
m_t1, m_t2, m_t3, m_t4, m_t5, m_t6, m_t7, m_t8,
|
|
m_l3,
|
|
m_t9,
|
|
m_l4, m_l5,
|
|
m_l6,
|
|
m_t10,
|
|
m_l7, m_l8,
|
|
m_t11, m_t12, m_t13, m_t14, m_l9, m_t15,
|
|
m_l10, m_l11, m_t16, m_t17, m_t18, m_t19, m_l12, m_t20, m_b1,
|
|
m_t21, m_t22, m_t23, m_t24, m_t25, m_t26, m_t27, m_t28, m_t29, m_t30,
|
|
m_t31, m_t32, m_t33, m_t34, m_t35, m_t36, m_l13, m_t37,
|
|
m_t38, m_t39, m_t40, m_t41,
|
|
NULL );
|
|
|
|
#else
|
|
create( 40, 18, 40, 17 );
|
|
#endif
|
|
};
|
|
|
|
pruCoresWindow::~pruCoresWindow(){
|
|
#ifdef NEWT_CLI
|
|
newtPopWindow();
|
|
#else
|
|
#endif
|
|
};
|
|
|
|
void pruCoresWindow::paint( void ){
|
|
volatile structTUPUS *tTUPUS;
|
|
|
|
#ifdef NEWT_CLI
|
|
char tBuffer[245];
|
|
newtCenteredWindow( m_w, m_h, "PRU Cores Info" );
|
|
tTUPUS = m_pSOC->getTUPUS( 0 , 0 );
|
|
if( tTUPUS != NULL ) {
|
|
sprintf( tBuffer, "Host status: 0x%08X", tTUPUS->HOST_status );
|
|
newtTextboxSetText( m_t1, tBuffer );
|
|
sprintf( tBuffer, "Host cmd: 0x%08X", tTUPUS->HOST_command );
|
|
newtTextboxSetText( m_t2, tBuffer );
|
|
sprintf( tBuffer, "Host address: 0x%08X", tTUPUS->HOST_address );
|
|
newtTextboxSetText( m_t3, tBuffer );
|
|
sprintf( tBuffer, "Host data: 0x%08X", tTUPUS->HOST_data );
|
|
newtTextboxSetText( m_t4, tBuffer );
|
|
sprintf( tBuffer, "PRU ID: 0x%08X", tTUPUS->PRU_id );
|
|
newtTextboxSetText( m_t5, tBuffer );
|
|
sprintf( tBuffer, "PRU status: 0x%08X", tTUPUS->PRU_status );
|
|
newtTextboxSetText( m_t6, tBuffer );
|
|
sprintf( tBuffer, "PRU address: 0x%08X", tTUPUS->PRU_address );
|
|
newtTextboxSetText( m_t7, tBuffer );
|
|
sprintf( tBuffer, "PRU data: 0x%08X", tTUPUS->PRU_data );
|
|
newtTextboxSetText( m_t8, tBuffer );
|
|
sprintf( tBuffer, "Build Type: 0x%08X", tTUPUS->CORE_id );
|
|
newtTextboxSetText( m_t38, tBuffer );
|
|
|
|
MO_STATUS tT;
|
|
*((uint32_t *)&tT) = m_pSOC->getMotorStatus();
|
|
sprintf( tBuffer, "O[%s]L[%s]I[%d]M[%d:%d]M[%d:%d]S[%d]E[%d]",
|
|
(tT.online?"A":"D"),
|
|
(tT.lrf_en?"A":"D"),
|
|
tT.inter_mode,
|
|
tT.v_motor_en,
|
|
tT.v_motor_ok,
|
|
tT.h_motor_en,
|
|
tT.h_motor_ok,
|
|
tT.simulate,
|
|
tT.param_err );
|
|
newtTextboxSetText( m_t9, tBuffer );
|
|
|
|
} else {
|
|
sprintf( tBuffer, "Not Initialized");
|
|
newtTextboxSetText( m_t1, tBuffer );
|
|
};
|
|
tTUPUS = m_pSOC->getTUPUS( 0 , 1 );
|
|
if( tTUPUS != NULL ) {
|
|
sprintf( tBuffer, "Host status: 0x%08X", tTUPUS->HOST_status );
|
|
newtTextboxSetText( m_t10, tBuffer );
|
|
sprintf( tBuffer, "Host cmd: 0x%08X", tTUPUS->HOST_command );
|
|
newtTextboxSetText( m_t11, tBuffer );
|
|
sprintf( tBuffer, "Host address: 0x%08X", tTUPUS->HOST_address );
|
|
newtTextboxSetText( m_t12, tBuffer );
|
|
sprintf( tBuffer, "Host data: 0x%08X", tTUPUS->HOST_data );
|
|
newtTextboxSetText( m_t13, tBuffer );
|
|
sprintf( tBuffer, "PRU ID: 0x%08X", tTUPUS->PRU_id );
|
|
newtTextboxSetText( m_t14, tBuffer );
|
|
sprintf( tBuffer, "PRU status: 0x%08X", tTUPUS->PRU_status );
|
|
newtTextboxSetText( m_t15, tBuffer );
|
|
sprintf( tBuffer, "PRU address: 0x%08X", tTUPUS->PRU_address );
|
|
newtTextboxSetText( m_t16, tBuffer );
|
|
sprintf( tBuffer, "PRU data: 0x%08X", tTUPUS->PRU_data );
|
|
newtTextboxSetText( m_t17, tBuffer );
|
|
sprintf( tBuffer, "Build Type: 0x%08X", tTUPUS->CORE_id );
|
|
newtTextboxSetText( m_t39, tBuffer );
|
|
|
|
sprintf( tBuffer, "-- No Status of This Core --" );
|
|
newtTextboxSetText( m_t18, tBuffer );
|
|
} else {
|
|
sprintf( tBuffer, "Not Initialized");
|
|
newtTextboxSetText( m_t10, tBuffer );
|
|
};
|
|
tTUPUS = m_pSOC->getTUPUS( 1 , 0 );
|
|
if( tTUPUS != NULL ) {
|
|
sprintf( tBuffer, "Host status: 0x%08X", tTUPUS->HOST_status );
|
|
newtTextboxSetText( m_t19, tBuffer );
|
|
sprintf( tBuffer, "Host cmd: 0x%08X", tTUPUS->HOST_command );
|
|
newtTextboxSetText( m_t20, tBuffer );
|
|
sprintf( tBuffer, "Host address: 0x%08X", tTUPUS->HOST_address );
|
|
newtTextboxSetText( m_t21, tBuffer );
|
|
sprintf( tBuffer, "Host data: 0x%08X", tTUPUS->HOST_data );
|
|
newtTextboxSetText( m_t22, tBuffer );
|
|
sprintf( tBuffer, "PRU ID: 0x%08X", tTUPUS->PRU_id );
|
|
newtTextboxSetText( m_t23, tBuffer );
|
|
sprintf( tBuffer, "PRU status: 0x%08X", tTUPUS->PRU_status );
|
|
newtTextboxSetText( m_t24, tBuffer );
|
|
sprintf( tBuffer, "PRU address: 0x%08X", tTUPUS->PRU_address );
|
|
newtTextboxSetText( m_t25, tBuffer );
|
|
sprintf( tBuffer, "PRU data: 0x%08X", tTUPUS->PRU_data );
|
|
newtTextboxSetText( m_t26, tBuffer );
|
|
sprintf( tBuffer, "Build Type: 0x%08X", tTUPUS->CORE_id );
|
|
newtTextboxSetText( m_t40, tBuffer );
|
|
|
|
sprintf( tBuffer, "Base Shift: %d Mirror Shift: %d", m_pSOC->getBaseShift(), m_pSOC->getMirrorShift());
|
|
newtTextboxSetText( m_t27, tBuffer );
|
|
} else {
|
|
sprintf( tBuffer, "Not Initialized");
|
|
newtTextboxSetText( m_t19, tBuffer );
|
|
};
|
|
tTUPUS = m_pSOC->getTUPUS( 1 , 1 );
|
|
if( tTUPUS != NULL ) {
|
|
sprintf( tBuffer, "Host status: 0x%08X", tTUPUS->HOST_status );
|
|
newtTextboxSetText( m_t28, tBuffer );
|
|
sprintf( tBuffer, "Host cmd: 0x%08X", tTUPUS->HOST_command );
|
|
newtTextboxSetText( m_t29, tBuffer );
|
|
sprintf( tBuffer, "Host address: 0x%08X", tTUPUS->HOST_address );
|
|
newtTextboxSetText( m_t30, tBuffer );
|
|
sprintf( tBuffer, "Host data: 0x%08X", tTUPUS->HOST_data );
|
|
newtTextboxSetText( m_t31, tBuffer );
|
|
sprintf( tBuffer, "PRU ID: 0x%08X", tTUPUS->PRU_id );
|
|
newtTextboxSetText( m_t32, tBuffer );
|
|
sprintf( tBuffer, "PRU status: 0x%08X", tTUPUS->PRU_status );
|
|
newtTextboxSetText( m_t33, tBuffer );
|
|
sprintf( tBuffer, "PRU address: 0x%08X", tTUPUS->PRU_address );
|
|
newtTextboxSetText( m_t34, tBuffer );
|
|
sprintf( tBuffer, "PRU data: 0x%08X", tTUPUS->PRU_data );
|
|
newtTextboxSetText( m_t35, tBuffer );
|
|
sprintf( tBuffer, "Build Type: 0x%08X", tTUPUS->CORE_id );
|
|
newtTextboxSetText( m_t41, tBuffer );
|
|
|
|
DT_STATUS tT;
|
|
TH_PARAMS tP;
|
|
uint32_t tVal;
|
|
tVal = m_pSOC->getThCoreStatus();
|
|
memcpy( &tT, &tVal, sizeof(DT_STATUS));
|
|
sprintf( tBuffer, "O[%s]W[%s]M[%d]R[%d]E[%d]",
|
|
(tT.online?"A":"D"),
|
|
(tT.work_en?"A":"D"),
|
|
tT.mode,
|
|
tT.req,
|
|
tT.param_err );
|
|
newtTextboxSetText( m_t36, tBuffer );
|
|
tVal = m_pSOC->getThCoreParams();
|
|
memcpy( &tP, &tVal, sizeof(TH_PARAMS));
|
|
sprintf( tBuffer, "Flip:%d GP:%d Off:%d Ord:%d A_TH:%d",
|
|
tP.flip_size,
|
|
tP.good_points,
|
|
tP.offset,
|
|
tP.order,
|
|
tP.self_build_ena );
|
|
newtTextboxSetText( m_t37, tBuffer );
|
|
} else {
|
|
sprintf( tBuffer, "Not Initialized");
|
|
newtTextboxSetText( m_t28, tBuffer );
|
|
};
|
|
newtDrawForm( m_oForm );
|
|
newtRefresh();
|
|
#else
|
|
volatile pruCfg *c_pPRUSS = NULL;
|
|
volatile pruCtrl *c_pPRU = NULL;
|
|
c_pPRUSS = m_pSOC->getPRUSS_GFG( 1 );
|
|
c_pPRU = m_pSOC->getPRU_CTRL( 1, 0 );
|
|
createBox( true );
|
|
mvwprintw( m_pWND, 2,2, " PRUSS%d Config at: \t%p", 1, c_pPRUSS );
|
|
if( c_pPRUSS != NULL ) {
|
|
mvwprintw( m_pWND, 3,2, " PRUSS%d Revision ID: \t0x%08x", 1, c_pPRUSS->REVID );
|
|
} else {
|
|
mvwprintw( m_pWND, 3,2, " Not Init" );
|
|
}
|
|
if( c_pPRU != NULL ) {
|
|
mvwprintw( m_pWND, 4,2, " PRUSS%d_PRU%d INFO:", 1, 0 );
|
|
mvwprintw( m_pWND, 6,2, " soft reset bit: \t%d", c_pPRU->CTRL_bit.SOFT_RST_N );
|
|
mvwprintw( m_pWND, 7,2, " enable bit: \t\t%d", c_pPRU->CTRL_bit.ENABLE );
|
|
mvwprintw( m_pWND, 8,2, " sleeping bit: \t%d", c_pPRU->CTRL_bit.SLEEPING );
|
|
mvwprintw( m_pWND, 9,2, " counter enable bit: \t%d", c_pPRU->CTRL_bit.COUNTER_ENABLE );
|
|
mvwprintw( m_pWND, 10,2, " single step bit: \t%d", c_pPRU->CTRL_bit.SINGLE_STEP );
|
|
mvwprintw( m_pWND, 11,2, " run state bit: \t%d", c_pPRU->CTRL_bit.RUNSTATE );
|
|
mvwprintw( m_pWND, 12,2, " PC counter init val: x%08x", c_pPRU->CTRL_bit.PCOUNTER_RST_VAL );
|
|
mvwprintw( m_pWND, 13,2, " PC counter value: \t%d", c_pPRU->STS_bit.PCOUNTER );
|
|
mvwprintw( m_pWND, 14,2, " cycle count value: \t%d", c_pPRU->CYCLE_bit.CYCLECOUNT );
|
|
mvwprintw( m_pWND, 15,2, " stall count value: \t%d", c_pPRU->STALL_bit.STALLCOUNT );
|
|
} else {
|
|
mvwprintw( m_pWND, 4,2, " NO PRU INFO" );
|
|
}
|
|
wrefresh( m_pWND );
|
|
#endif
|
|
};
|