void bsp_fatal_extension( rtems_fatal_source source, bool always_set_to_false, rtems_fatal_code code ) { #if (BSP_PRINT_EXCEPTION_CONTEXT) if ( source == RTEMS_FATAL_SOURCE_EXCEPTION ) { rtems_exception_frame_print( (const rtems_exception_frame *) code ); } #endif #if (BSP_PRESS_KEY_FOR_RESET) printk( "\nFATAL ERROR - Executive shutdown! Any key to reboot..." ); /* * Wait for a key to be pressed */ while ( getchark() == -1 ) ; printk("\n"); #endif /* * Check both conditions -- if you want to ask for reboot, then * you must have meant to reset the board. */ #if (BSP_PRESS_KEY_FOR_RESET) || (BSP_RESET_BOARD_AT_EXIT) bsp_reset(); #endif }
/****************************************************** Name: _dbug_dump Input parameters: - Output parameters: - Description: display microcontroler state. Registers values are stored in _boot_panic_registers which is filled in _uhoh ASM routine *****************************************************/ void _dbug_dumpanic(void) { int c; void *faultedAddr, *pc; unsigned short vector, status; unsigned char frametype, *stack; #define ESCAPE 27 stack = (unsigned char*)(_boot_panic_registers.a7); do { status = _boot_panic_registers.sr; pc = (void*)_boot_panic_registers.pc; faultedAddr = *(void**)(stack+4); vector = (_boot_panic_registers.format_id&0x0FFF)>>2; frametype = (_boot_panic_registers.format_id&0xF000)>>12; printk("\n---------------------------------------------\n"); if (vector<64) printk("%s",exceptionName[vector]); else { printk("RESERVED USER"); } printk(" exception (vector %x, type %x)\n",vector,frametype); printk("---------------------------------------------\n"); printk("PC : %p ",pc); printk("A7 : 0x%lx ",_boot_panic_registers.a7); printk("SR : 0x%x\n",status); if (frametype==0x0c) { printk("\nfaulted address = %p\n",faultedAddr); } printk("---------------------------------------------\n"); printk(" panic regs\n"); printk("---------------------------------------------\n"); printk("D[0..3] : %lx \t%lx \t%lx \t%lx\n", _boot_panic_registers.d0,_boot_panic_registers.d1, _boot_panic_registers.d2,_boot_panic_registers.d3); printk("D[4..7] : %lx \t%lx \t%lx \t%lx\n", _boot_panic_registers.d4,_boot_panic_registers.d5, _boot_panic_registers.d6,_boot_panic_registers.d7); printk("A[0..3] : %lx \t%lx \t%lx \t%lx\n", _boot_panic_registers.a0,_boot_panic_registers.a1, _boot_panic_registers.a2,_boot_panic_registers.a3); printk("A[4..7] : %lx \t%lx \t%lx \t%lx\n", _boot_panic_registers.a4,_boot_panic_registers.a5, _boot_panic_registers.a6,_boot_panic_registers.a7); printk(" SFC : %lx",_boot_panic_registers.sfc); printk(" DFC : %lx\n",_boot_panic_registers.dfc); printk(" VBR : %lx\n",_boot_panic_registers.vbr); printk("---------------------------------------------\n"); printk(" panic stack\n"); printk("---------------------------------------------\n"); _dbug_dump(status, pc, (unsigned short*)stack,64*2); printk("---------------------------------------------\n"); printk("press escape to reboot\n"); } while ((c=getchark())!=ESCAPE); }
void do_getchark(void) { int sc; BSP_polling_getchar_function_type poll_char; poll_char = BSP_poll_char; BSP_poll_char = NULL; putk( "getchark - NULL getchar method - return -1" ); sc = getchark(); rtems_test_assert( sc == -1 ); putk( "getchark - test getchar method - returns 0x35" ); BSP_poll_char = test_getchar; sc = getchark(); rtems_test_assert( sc == 0x35 ); BSP_poll_char = poll_char; }
void bsp_cleanup( uint32_t status ) { #if (BSP_PRESS_KEY_FOR_RESET) printk( "\nEXECUTIVE SHUTDOWN! Any key to reboot..." ); /* * Wait for a key to be pressed */ while ( getchark() == -1 ) ; printk("\n"); #endif /* * Check both conditions -- if you want to ask for reboot, then * you must have meant to reset the board. */ #if (BSP_PRESS_KEY_FOR_RESET) || (BSP_RESET_BOARD_AT_EXIT) bsp_reset(); #endif }