1169691Skan/* Memory attributes support, for GDB.
2169691Skan   Copyright 2001 Free Software Foundation, Inc.
3169691Skan
4169691Skan   This file is part of GDB.
5169691Skan
6169691Skan   This program is free software; you can redistribute it and/or modify
7169691Skan   it under the terms of the GNU General Public License as published by
8169691Skan   the Free Software Foundation; either version 2 of the License, or
9169691Skan   (at your option) any later version.
10169691Skan
11169691Skan   This program is distributed in the hope that it will be useful,
12169691Skan   but WITHOUT ANY WARRANTY; without even the implied warranty of
13169691Skan   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14169691Skan   GNU General Public License for more details.
15169691Skan
16169691Skan   You should have received a copy of the GNU General Public License
17169691Skan   along with this program; if not, write to the Free Software
18169691Skan   Foundation, Inc., 59 Temple Place - Suite 330,
19169691Skan   Boston, MA 02111-1307, USA.  */
20169691Skan
21169691Skan#ifndef MEMATTR_H
22169691Skan#define MEMATTR_H
23169691Skan
24169691Skanenum mem_access_mode
25169691Skan{
26169691Skan  MEM_RW,			/* read/write */
27169691Skan  MEM_RO,			/* read only */
28169691Skan  MEM_WO			/* write only */
29169691Skan};
30169691Skan
31169691Skanenum mem_access_width
32169691Skan{
33169691Skan  MEM_WIDTH_UNSPECIFIED,
34169691Skan  MEM_WIDTH_8,			/*  8 bit accesses */
35169691Skan  MEM_WIDTH_16,			/* 16  "      "    */
36169691Skan  MEM_WIDTH_32,			/* 32  "      "    */
37169691Skan  MEM_WIDTH_64			/* 64  "      "    */
38169691Skan};
39169691Skan
40169691Skan/* The set of all attributes that can be set for a memory region.
41169691Skan
42169691Skan   This structure was created so that memory attributes can be passed
43169691Skan   to target_ functions without exposing the details of memory region
44169691Skan   list, which would be necessary if these fields were simply added to
45169691Skan   the mem_region structure.
46169691Skan
47169691Skan   FIXME: It would be useful if there was a mechanism for targets to
48169691Skan   add their own attributes.  For example, the number of wait states. */
49169691Skan
50169691Skanstruct mem_attrib
51169691Skan{
52169691Skan  /* read/write, read-only, or write-only */
53169691Skan  enum mem_access_mode mode;
54169691Skan
55169691Skan  enum mem_access_width width;
56169691Skan
57169691Skan  /* enables hardware breakpoints */
58169691Skan  int hwbreak;
59169691Skan
60169691Skan  /* enables host-side caching of memory region data */
61169691Skan  int cache;
62169691Skan
63169691Skan  /* enables memory verification.  after a write, memory is re-read
64169691Skan     to verify that the write was successful. */
65169691Skan  int verify;
66169691Skan};
67169691Skan
68169691Skanstruct mem_region
69169691Skan{
70169691Skan  /* FIXME: memory regions are stored in an unsorted singly-linked
71169691Skan     list.  This probably won't scale to handle hundreds of memory
72169691Skan     regions --- that many could be needed to describe the allowed
73169691Skan     access modes for memory mapped i/o device registers. */
74169691Skan  struct mem_region *next;
75169691Skan
76169691Skan  CORE_ADDR lo;
77169691Skan  CORE_ADDR hi;
78169691Skan
79169691Skan  /* Item number of this memory region. */
80169691Skan  int number;
81169691Skan
82169691Skan  /* Status of this memory region (enabled if non-zero, otherwise disabled) */
83169691Skan  int enabled_p;
84169691Skan
85169691Skan  /* Attributes for this region */
86169691Skan  struct mem_attrib attrib;
87169691Skan};
88169691Skan
89169691Skanextern struct mem_region *lookup_mem_region(CORE_ADDR);
90169691Skan
91169691Skan#endif	/* MEMATTR_H */
92169691Skan