/* The common simulator framework for GDB, the GNU Debugger.
- Copyright 2002, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+ Copyright 2002-2022 Free Software Foundation, Inc.
Contributed by Andrew Cagney and Red Hat.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+/* This must come before any other includes. */
+#include "defs.h"
+#include <stdlib.h>
+#include <string.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "sim-main.h"
#include "hw-main.h"
#include "sim-io.h"
its immediate domain */
#include "hw-tree.h"
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
/* DEVICE
-
+
pal - glue logic device containing assorted junk
-
+
DESCRIPTION
-
+
Typical hardware dependant hack. This device allows the firmware
to gain access to all the things the firmware needs (but the OS
doesn't).
RESET (write): halts the simulator. The value written to the
register is used as an exit status.
-
+
PROCESSOR ID (read): returns the processor identifier (0 .. N-1) of
the processor performing the read.
-
+
INTERRUPT (write): This register must be written using a two byte
store. The low byte specifies a port and the upper byte specifies
the a level. LEVEL is driven on the specified port. By
PROPERTIES
-
+
reg = <address> <size> (required)
typedef struct _hw_pal_counter {
struct hw_event *handler;
- signed64 start;
- unsigned32 delta;
+ int64_t start;
+ uint32_t delta;
int periodic_p;
} hw_pal_counter;
hw_pal_device *pal,
const char *reg,
hw_pal_counter *counter,
- unsigned32 *word,
+ uint32_t *word,
unsigned nr_bytes)
{
- unsigned32 val;
+ uint32_t val;
if (nr_bytes != 4)
hw_abort (me, "%s - bad read size must be 4 bytes", reg);
val = counter->delta;
hw_pal_device *pal,
const char *reg,
hw_pal_counter *counter,
- unsigned32 *word,
+ uint32_t *word,
unsigned nr_bytes)
{
- unsigned32 val;
+ uint32_t val;
if (nr_bytes != 4)
hw_abort (me, "%s - bad read size must be 4 bytes", reg);
if (counter->delta != 0)
hw_pal_device *pal,
const char *reg,
hw_pal_counter *counter,
- const unsigned32 *word,
+ const uint32_t *word,
unsigned nr_bytes)
{
if (nr_bytes != 4)
hw_pal_device *hw_pal = (hw_pal_device *)hw_data (me);
char c;
int count;
- count = do_hw_poll_read (me, hw_pal->reader, 0/*STDIN*/, &c, sizeof(c));
+ count = do_hw_poll_read (me, hw_pal->reader, 0/*STDIN*/, &c, sizeof (c));
switch (count)
{
case HW_IO_NOT_READY:
{
case hw_pal_cpu_nr_register:
-#ifdef CPU_INDEX
*byte = CPU_INDEX (hw_system_cpu (me));
-#else
- *byte = 0;
-#endif
HW_TRACE ((me, "read - cpu-nr %d\n", *byte));
break;
{
hw_pal_device *hw_pal = (hw_pal_device*) hw_data (me);
unsigned_1 *byte = (unsigned_1 *) source;
-
+
switch (addr & hw_pal_address_mask)
{
do_counter_write (me, hw_pal, "countdown",
&hw_pal->countdown, source, nr_bytes);
break;
-
+
case hw_pal_timer:
do_counter_write (me, hw_pal, "timer",
&hw_pal->timer, source, nr_bytes);
break;
-
+
}
return nr_bytes;
}
#if NOT_YET
static void
-hw_pal_instance_delete_callback(hw_instance *instance)
+hw_pal_instance_delete_callback (hw_instance *instance)
{
/* nothing to delete, the hw_pal is attached to the struct hw */
return;