rendered paste body/*------------------------------------------------------------------------*/
/* Idle thread action */
#include <cyg/infra/diag.h>
void hal_idle_thread_action( cyg_uint32 count )
{
#if 0 //def CYGPKG_HAL_MIPS_SIM
if( (count % 1000) == 0 )
{
// This code causes a fake interrupt.
asm volatile (
"xor $24,$24,$24;"
"mtc0 $24,$13;"
"lui $25,%%hi(1f);"
"ori $25,$25,%%lo(1f);"
"j other_vector;"
"nop;"
"1:"
:
:
: "t8", "t9"
);
}
#endif
#if 0 //def CYGPKG_HAL_MIPS_TX39_JMR3904
if( (count % 100000 ) == 0 )
{
// cyg_uint32 tval, isr, imr, ilr;
cyg_uint32 sr = 0, cr = 0, ctr = 0, cpr = 0;
// HAL_CLOCK_READ( &tval );
// HAL_READ_UINT32( 0xFFFFC000, isr );
// HAL_READ_UINT32( 0xFFFFC004, imr );
// HAL_READ_UINT32( 0xFFFFC01C, ilr );
// CYG_TRACE2(1, "Timer value, ISR ",tval, isr);
// CYG_TRACE2(1, "IMR ILR0 ", imr, ilr);
// asm volatile (
// "mfc0 %0,$12;"
// "nop; nop; nop;"
// "mfc0 %1,$13;"
// "nop; nop; nop;"
// "mfc0 %2,$9;"
// "nop; nop; nop;"
// "mfc0 %3,$11;"
// "nop; nop; nop;"
// : "=r"(sr), "=r"(cr), "=r"(ctr), "=r"(cpr)
// );
// diag_printf("Status %08x ", sr );
// diag_printf("Cause %08x ", cr );
// diag_printf("Counter %08x ", ctr );
// diag_printf("Compare %08x\n", cpr);
#if 0
asm volatile (
"mfc0 %0,$12;"
"nop; nop; nop;"
: "=r"(sr)
);
diag_write_string("Status "); diag_write_hex( sr );
asm volatile (
"mfc0 %0,$13;"
"nop; nop; nop;"
: "=r"(cr)
);
diag_write_string(" Cause "); diag_write_hex( cr );
asm volatile (
"mfc0 %0,$9;"
"nop; nop; nop;"
: "=r"(ctr)
);
diag_write_string(" Counter "); diag_write_hex( ctr );
asm volatile (
"mfc0 %0,$11;"
"nop; nop; nop;"
: "=r"(cpr)
);
diag_write_string(" Compare "); diag_write_hex( cpr );
diag_write_string( "\n" );
#endif
#if 1
asm volatile (
"mfc0 %0,$12;"
"nop; nop; nop;"
: "=r"(sr)
);
asm volatile (
"mfc0 %0,$13;"
"nop; nop; nop;"
: "=r"(cr)
);
CYG_INSTRUMENT_USER( 1, sr, cr );
asm volatile (
"mfc0 %0,$9;"
"nop; nop; nop;"
: "=r"(ctr)
);
asm volatile (
"mfc0 %0,$11;"
"nop; nop; nop;"
: "=r"(cpr)
);
CYG_INSTRUMENT_USER( 2, ctr, cpr );
#endif
// if( count == 4 )
// {
// HAL_ENABLE_INTERRUPTS();
// }
// if( count >= 10 )
// for(;;);
}
#endif
#if 0
{
static CYG_WORD32 istat[3] = { 0xffffffff,0xffffffff,0xffffffff };
int i;
for( i = 0; i < 3; i++ )
{
CYG_WORD32 reg, sr;
HAL_READ_UINT32( CYGHWR_HAL_MIPS_VRC4373_INTC_STAT0 + i * CYGHWR_HAL_MIPS_VRC4373_INTC_MASK_OFF, reg );
if( reg != istat[i] )
{
hal_diag_ai_write_char('~');
hal_diag_ai_write_char('0'+i);
hal_diag_ai_write_hex8( reg );
istat[i] = reg;
HAL_READ_UINT32( CYGHWR_HAL_MIPS_VRC4373_INTC_MASK0 + i * CYGHWR_HAL_MIPS_VRC4373_INTC_MASK_OFF, reg );
hal_diag_ai_write_char('.');
hal_diag_ai_write_hex8( reg );
#if 0
asm volatile (
"mfc0 %0,$12;"
"nop; nop; nop;"
: "=r"(sr)
);
hal_diag_ai_write_char('.');
hal_diag_ai_write_hex8( sr );
#endif
}
}
}
{
static CYG_WORD32 old_pins = 0;
CYG_WORD32 reg;
HAL_READ_UINT32( CYGHWR_HAL_MIPS_VRC4373_INTC_PINS, reg );
if( reg != old_pins )
{
hal_diag_ai_write_char('%');
hal_diag_ai_write_hex8( reg );
old_pins = reg;
}
}
#endif
#if 0 //def CYGPKG_HAL_MIPS_VR4300_VRC4373
// Wiggle one of the leds to show we are running
if( (count % 50000 ) == 0 )
{
cyg_uint8 lr;
{ int i; for( i = 0; i < 200; i++ ); }
HAL_READ_UINT8( 0xc2000008, lr );
lr ^= 2;
{ int i; for( i = 0; i < 200; i++ ); }
HAL_WRITE_UINT8( 0xc2000008, lr );
}
#endif
}
/*------------------------------------------------------------------------*/
/* End of hal_misc.c */