home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 9 / FreshFishVol9-CD2.bin / bbs / gnu / gdb-4.14-src.lha / gdb-4.14 / gdb / op50-rom.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-30  |  4.9 KB  |  167 lines

  1. /* Remote target glue for the Oki op50n based eval board.
  2.  
  3.    Copyright 1988, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
  4.  
  5. This file is part of GDB.
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21. #include "defs.h"
  22. #include "gdbcore.h"
  23. #include "target.h"
  24. #include "monitor.h"
  25.  
  26. void op50n_open();
  27. void monitor_open();
  28.  
  29. /*
  30.  * this array of registers need to match the indexes used by GDB. The
  31.  * whole reason this exists is cause the various ROM monitors use
  32.  * different strings than GDB does, and doesn't support all the
  33.  * registers either. So, typing "info reg sp" becomes a "r30".
  34.  */
  35. static char *op50n_regnames[] = {
  36.   "r0",  "r1",  "r2",  "r3",  "r4",  "r5",  "r6",
  37.   "r7",  "r8",  "r9",  "r10", "r11", "r12", "r13",
  38.   "r14", "r15", "r16", "r17", "r18", "r19", "r20",
  39.   "r21", "r22", "r23", "r24", "r25", "r26", "r27",
  40.   "r28", "r29", "r30", "r31", "",        "p",       "",
  41.   "",    "",    "",    "",    "",       "",       "",
  42.   "",    "",    "",    "",    "",       "",       "",
  43.   "",    "",    "",    "",    "",       "",       "",    "",
  44.   "",    "",    "",    "",    "",       "",       "",
  45.   "",    "",    "",    "",    "",       "",       "",    "",
  46.   "",    "",    "",    "",    "",       "",       "",    "",
  47.   "",    "",    "",    "",    "",       "",       "",    "",
  48.   "",    "",    "",    "",    "",       "",       "",    "",
  49.   "",    "",    "",    "",    "",       "",       "",    "",
  50.   "",    "",    "",    "",    "",       "",       "",    "",
  51.   "",    "",    "",    "",    "",       "",       "",    "",
  52.   "",    "",    "",    "",    "",       "",       "",    ""
  53. };
  54.  
  55. /*
  56.  * Define the monitor command strings. Since these are passed directly
  57.  * through to a printf style function, we need can include formatting
  58.  * strings. We also need a CR or LF on the end.
  59.  */
  60.  
  61. struct target_ops op50n_ops = {
  62.   "op50n",
  63.   "Oki's debug monitor for the Op50n Eval board",
  64.  
  65.   "Debug on a Oki OP50N eval board.\n\
  66. Specify the serial device it is connected to (e.g. /dev/ttya).",
  67.   op50n_open,
  68.   monitor_close, 
  69.   monitor_attach,
  70.   monitor_detach,
  71.   monitor_resume,
  72.   monitor_wait,
  73.   monitor_fetch_register,
  74.   monitor_store_register,
  75.   monitor_prepare_to_store,
  76.   monitor_xfer_inferior_memory,
  77.   monitor_files_info,
  78.   monitor_insert_breakpoint,
  79.   monitor_remove_breakpoint,    /* Breakpoints */
  80.   0,
  81.   0,
  82.   0,
  83.   0,
  84.   0,                /* Terminal handling */
  85.   monitor_kill,
  86.   monitor_load,            /* load */
  87.   0,                /* lookup_symbol */
  88.   monitor_create_inferior,
  89.   monitor_mourn_inferior,
  90.   0,                /* can_run */
  91.   0,                 /* notice_signals */
  92.   0,                /* to_stop */
  93.   process_stratum,
  94.   0,                /* next */
  95.   1,
  96.   1,
  97.   1,
  98.   1,
  99.   1,                /* all mem, mem, stack, regs, exec */
  100.   0,
  101.   0,                /* Section pointers */
  102.   OPS_MAGIC,            /* Always the last thing */
  103. };
  104.  
  105. struct monitor_ops op50n_cmds = {
  106.   1,                    /* 1 for ASCII, 0 for binary */
  107.   "\003.\n",                /* monitor init string */
  108.   "g %x\n",                /* execute or usually GO command */
  109.   "g\n",                /* continue command */
  110.   "t\n",                /* single step */
  111.   "b %x\n",                /* set a breakpoint */
  112.   "bx %x\n",                /* clear a breakpoint */
  113.   0,                    /* 0 for number, 1 for address */
  114.   {
  115.     "sx %x %x;.\n",            /* set memory */
  116.     "",                    /* delimiter  */
  117.     "",                    /* the result */
  118.   },
  119.   {
  120.     "sx %x\n",                /* get memory */
  121.     ": ",                /* delimiter */
  122.     " ",                /* the result */
  123.   },
  124.   {
  125.     "x %s %x\n",            /* set a register */
  126.     "",                        /* delimiter between registers */
  127.     "",                    /* the result */
  128.   },
  129.   {
  130.     "x %s\n",                /* get a register */
  131.     "=",                /* delimiter between registers */
  132.     "",                    /* the result */
  133.   },
  134.   "r 0\n",                /* download command */
  135.   "#",                    /* monitor command prompt */
  136.   " ",                    /* end-of-command delimitor */
  137.   ".\n",                /* optional command terminator */
  138.   &op50n_ops,                /* target operations */
  139.   "none,srec,default",            /* load types */
  140.   "none",                /* load types */
  141.   "2400,4800,9600,19200,exta,38400,extb", /* supported baud rates */
  142.   1,                    /* number of stop bits */
  143.   op50n_regnames
  144. };
  145.  
  146. void
  147. op50n_open(args, from_tty)
  148.      char *args;
  149.      int from_tty;
  150. {
  151.   target_preopen(from_tty);
  152.   push_target(&op50n_ops);
  153.   push_monitor (&op50n_cmds);
  154.   monitor_open (args, "op50n", from_tty);
  155. }
  156.  
  157. void
  158. _initialize_op50n ()
  159. {
  160.   add_target (&op50n_ops);
  161.  
  162.   /* this is the default, since it's that's how the board comes up after
  163.      power cycle. It can then be changed using set remotebaud
  164.    */
  165.   baud_rate = 9600;
  166. }
  167.