int rtems_gdb_tgt_install_ehandler(int action) { int rval = 0, i; /* initialize breakpoint table */ for ( i=0; i<NUM_BPNTS-1; i++ ) bpntTab[i].next = bpntTab+i+1; bpntsFree = bpntTab; if ( action ) { /* install */ for ( i = 0; i<sizeof(origHandlerTbl)/sizeof(origHandlerTbl[0]); i++ ) { if ( rtems_interrupt_catch(_m68k_gdb_exception_wrapper, origHandlerTbl[i].vec, &origHandlerTbl[i].hdl) ) { origHandlerTbl[i].hdl = 0; isr_restore(i); rval = -1; break; } } } else { /* uninstall */ rval = isr_restore(sizeof(origHandlerTbl)/sizeof(origHandlerTbl[0])); } if ( rval ) { ERRMSG("ERROR: exception handler %s\n", action ? "already installed" : "cannot be removed; uninstall failed"); } return rval; }
/* * debug_send_byte() * Send a character to the debug port. */ void debug_send_byte(unsigned char data) { u8_t *p = (u8_t *)0x000b8000; fast_u8_t sreg; int x; sreg = isr_save_disable(); if (data == '\r') { cx = 0; } else if (data == '\n') { cy++; } else if (data == '\f') { cx = 0; cy = 0; for (x = 0; x < (80 * 24); x++) { *p = ' '; p += 2; } } else { if (cx >= 80) { cx = 0; cy++; } if (cy >= 24) { u8_t *src = (u8_t *)(0x000b8000 + 160); for (x = 160; x < (160 * 24); x++) { *p++ = *src++; } for (x = 0; x < 160; x += 2) { *p = ' '; p += 2; } p = (u8_t *)0x000b8000; cy = 23; } *(p + (((cy * 80) + cx) * 2)) = data; cx++; } isr_restore(sreg); }