[0074691a] | 1 | /*****************************************************************************/ |
---|
| 2 | /* |
---|
| 3 | $Id$ |
---|
| 4 | |
---|
| 5 | Hooks for GDB |
---|
| 6 | |
---|
| 7 | */ |
---|
| 8 | /*****************************************************************************/ |
---|
| 9 | |
---|
| 10 | |
---|
| 11 | #include <bsp.h> |
---|
| 12 | #include <m68302.h> |
---|
| 13 | #include <m68302scc.h> |
---|
| 14 | |
---|
| 15 | static int initialised = 0; |
---|
| 16 | |
---|
| 17 | void putDebugChar(char ch) |
---|
| 18 | { |
---|
| 19 | if (!initialised) |
---|
| 20 | { |
---|
| 21 | scc_initialise(DEBUG_PORT, DEBUG_BAUD, 0); |
---|
| 22 | initialised = 1; |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | scc_out(DEBUG_PORT, ch); |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | char getDebugChar(void) |
---|
| 29 | { |
---|
| 30 | if (!initialised) |
---|
| 31 | { |
---|
| 32 | scc_initialise(DEBUG_PORT, DEBUG_BAUD, 0); |
---|
| 33 | initialised = 1; |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | while (!scc_status(DEBUG_PORT, 0)); |
---|
| 37 | |
---|
| 38 | return scc_in(DEBUG_PORT); |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | /* |
---|
| 42 | * Need to create yet another jump table for gdb this time |
---|
| 43 | */ |
---|
| 44 | |
---|
| 45 | void (*exceptionHook)(unsigned int) = 0; |
---|
| 46 | |
---|
| 47 | typedef struct { |
---|
| 48 | rtems_unsigned16 move_a7; /* move #FORMAT_ID,%a7@- */ |
---|
| 49 | rtems_unsigned16 format_id; |
---|
| 50 | rtems_unsigned16 jmp; /* jmp _ISR_Handlers */ |
---|
| 51 | rtems_unsigned32 isr_handler; |
---|
| 52 | } GDB_HANDLER_ENTRY; |
---|
| 53 | |
---|
| 54 | #if !defined(M68K_MOVE_A7) |
---|
| 55 | #define M68K_MOVE_A7 0x3F3C |
---|
| 56 | #endif |
---|
| 57 | |
---|
| 58 | #if !defined(M68K_JMP) |
---|
| 59 | #define M68K_JMP 0x4EF9 |
---|
| 60 | #endif |
---|
| 61 | |
---|
| 62 | /* points to jsr-exception-table in targets wo/ VBR register */ |
---|
| 63 | static GDB_HANDLER_ENTRY gdb_jump_table[256]; |
---|
| 64 | |
---|
| 65 | void exceptionHandler(unsigned int vector, void *handler) |
---|
| 66 | { |
---|
| 67 | rtems_unsigned32 *interrupt_table = 0; |
---|
| 68 | |
---|
| 69 | gdb_jump_table[vector].move_a7 = M68K_MOVE_A7; |
---|
| 70 | gdb_jump_table[vector].format_id = vector; |
---|
| 71 | gdb_jump_table[vector].jmp = M68K_JMP; |
---|
| 72 | gdb_jump_table[vector].isr_handler = (rtems_unsigned32) handler; |
---|
| 73 | |
---|
| 74 | interrupt_table[vector] = (rtems_unsigned32) &gdb_jump_table[vector]; |
---|
| 75 | } |
---|
| 76 | |
---|