source: rtems/c/src/lib/libbsp/m68k/ods68302/startup/gdb-hooks.c @ cba474e

4.115
Last change on this file since cba474e was cba474e, checked in by Joel Sherrill <joel.sherrill@…>, on 10/13/14 at 19:50:12

m68k/ods68302: Fix warnings

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*
2 *  Hooks for GDB
3 *
4 */
5
6#include <bsp.h>
7#include <rtems/m68k/m68302.h>
8#include <m68302scc.h>
9
10static int initialised = 0;
11
12/*
13 * This file does not intend to make things part of the public interface.
14 * Methods here are only available to the GDB stub. So prototypes are
15 * needed to avoid warnings.
16 */
17void putDebugChar(char ch);
18char getDebugChar(void);
19void exceptionHandler(unsigned int vector, void *handler);
20
21void putDebugChar(char ch)
22{
23  if (!initialised)
24  {
25    scc_initialise(DEBUG_PORT, DEBUG_BAUD, 0);
26    initialised = 1;
27  }
28
29  scc_out(DEBUG_PORT, ch);
30}
31
32char getDebugChar(void)
33{
34  if (!initialised)
35  {
36    scc_initialise(DEBUG_PORT, DEBUG_BAUD, 0);
37    initialised = 1;
38  }
39
40  while (!scc_status(DEBUG_PORT, 0));
41
42  return scc_in(DEBUG_PORT);
43}
44
45/*
46 * Need to create yet another jump table for gdb this time
47 */
48
49void (*exceptionHook)(unsigned int) = 0;
50
51typedef struct {
52  uint16_t         move_a7;            /* move #FORMAT_ID,%a7@- */
53  uint16_t         format_id;
54  uint16_t         jmp;                /* jmp  _ISR_Handlers */
55  uint32_t         isr_handler;
56} GDB_HANDLER_ENTRY;
57
58#if !defined(M68K_MOVE_A7)
59#define M68K_MOVE_A7 0x3F3C
60#endif
61
62#if !defined(M68K_JMP)
63#define M68K_JMP     0x4EF9
64#endif
65
66/* points to jsr-exception-table in targets wo/ VBR register */
67static GDB_HANDLER_ENTRY gdb_jump_table[256];
68
69void exceptionHandler(unsigned int vector, void *handler)
70{
71  uint32_t         *interrupt_table = 0;
72
73  gdb_jump_table[vector].move_a7 = M68K_MOVE_A7;
74  gdb_jump_table[vector].format_id = vector;
75  gdb_jump_table[vector].jmp = M68K_JMP;
76  gdb_jump_table[vector].isr_handler = (uint32_t) handler;
77
78  interrupt_table[vector] = (uint32_t) &gdb_jump_table[vector];
79}
Note: See TracBrowser for help on using the repository browser.