hw-device.h
hw-events.c
hw-events.h
+hw-main.h
hw-ports.c
hw-ports.h
hw-properties.c
sim-fpu.h
sim-hload.c
sim-hrw.c
+sim-hw.c
+sim-hw.h
sim-info.c
sim-inline.c
sim-inline.h
+Mon May 25 18:55:35 1998 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * dv-core.c: Include hw-main.h and sim-main.h.
+ * dv-pal.c: Include hw-main.h and sim-io.h.
+ * dv-glue.c: Include hw-main.h.
+
+ * hw-main.h: New file. Move list of includes to here.
+ * hw-base.h: From here.
+ * Make-common.in (hw_base_headers): Rename to hw_main_headers.
+ (hw-*.o, dv-*.o): Update.
+ * hw-tree.c, hw-base.c, hw-properties.c, hw-ports.c, hw-device.c,
+ hw-events.c, hw-alloc.c, sim-hw.c: Include hw-main.h instead of
+ sim-main.h.
+
+ * hw-base.h (do_hw_attach_regs, do_hw_poll_read_method,
+ do_hw_poll_read): Move declarations from here.
+ * hw-main.h: To here.
+
+ * hw-base.h (struct hw_device_descriptor, hw_finish_callback):
+ Move from here.
+ * hw-main.h (struct hw_descriptor, hw_finish_method): To here,
+ rename.
+ * Make-common.in (hw-config.h): Update
+ * hw-base.c, dv-pal.c, dv-glue.c: Update
+
+ * dv-glue.c, hw-device.h, hw-base.h, hw-ports.c: Rename
+ `*_callback' to `*_method.
+
Mon May 25 18:41:18 1998 Andrew Cagney <cagney@b1.cygnus.com>
* hw-base.h (set_*): Move set method macros from here.
hw-properties_h = $(srccom)/hw-properties.h
hw-tree_h = $(srccom)/hw-tree.h
-hw_base_headers = \
+hw_main_headers = \
+ $(srccom)/hw-main.h \
$(hw-alloc_h) \
$(hw-base_h) \
$(hw-device_h) \
rm -f tmp-hw.h
echo "/* generated by Makefile */" > tmp-hw.h
for hw in $(SIM_HW) ; do \
- echo "extern const struct hw_device_descriptor dv_$${hw}_descriptor[];" ; \
+ echo "extern const struct hw_descriptor dv_$${hw}_descriptor[];" ; \
done >> tmp-hw.h
- echo "const struct hw_device_descriptor *hw_descriptors[] = {" >> tmp-hw.h
+ echo "const struct hw_descriptor *hw_descriptors[] = {" >> tmp-hw.h
for hw in $(SIM_HW) ; do \
echo " dv_$${hw}_descriptor," ; \
done >> tmp-hw.h
echo "};" >> tmp-hw.h
mv tmp-hw.h hw-config.h
-hw-alloc.o: $(srccom)/hw-alloc.c $(sim_main_headers) \
- $(hw-alloc_h)
+hw-alloc.o: $(srccom)/hw-alloc.c $(hw_main_headers)
$(CC) -c $(srccom)/hw-alloc.c $(ALL_CFLAGS)
-hw-base.o: $(srccom)/hw-base.c $(sim_main_headers) \
- $(hw_base_headers) hw-config.h
+hw-base.o: $(srccom)/hw-base.c $(hw_main_headers) hw-config.h
$(CC) -c $(srccom)/hw-base.c $(ALL_CFLAGS)
-hw-device.o: $(srccom)/hw-device.c $(sim_main_headers) \
- $(hw-device_h)
+hw-device.o: $(srccom)/hw-device.c $(hw_main_headers)
$(CC) -c $(srccom)/hw-device.c $(ALL_CFLAGS)
-hw-events.o: $(srccom)/hw-events.c $(sim_main_headers) \
- $(hw-events_h)
+hw-events.o: $(srccom)/hw-events.c $(hw_main_headers) $(sim_main_headers)
$(CC) -c $(srccom)/hw-events.c $(ALL_CFLAGS)
-hw-instances.o: $(srccom)/hw-instances.c $(sim_main_headers) \
- $(hw_base_headers)
+hw-instances.o: $(srccom)/hw-instances.c $(hw_main_headers)
$(CC) -c $(srccom)/hw-instances.c $(ALL_CFLAGS)
-hw-handles.o: $(srccom)/hw-handles.c $(sim_main_headers) \
- $(hw_base_headers)
+hw-handles.o: $(srccom)/hw-handles.c $(hw_main_headers)
$(CC) -c $(srccom)/hw-handles.c $(ALL_CFLAGS)
-hw-ports.o: $(srccom)/hw-ports.c $(sim_main_headers) \
- $(hw-ports_h)
+hw-ports.o: $(srccom)/hw-ports.c $(hw_main_headers)
$(CC) -c $(srccom)/hw-ports.c $(ALL_CFLAGS)
-hw-properties.o: $(srccom)/hw-properties.c $(sim_main_headers) \
- $(hw-properties_h)
+hw-properties.o: $(srccom)/hw-properties.c $(hw_main_headers)
$(CC) -c $(srccom)/hw-properties.c $(ALL_CFLAGS)
-hw-tree.o: $(srccom)/hw-tree.c $(sim_main_headers) \
- $(hw-tree_h) $(hw_base_headers)
+hw-tree.o: $(srccom)/hw-tree.c $(hw_main_headers) $(hw-tree_h)
$(CC) -c $(srccom)/hw-tree.c $(ALL_CFLAGS)
-dv-core.o: $(srccom)/dv-core.c $(sim_main_headers) \
- $(sim-main_h) $(hw_base_headers)
+dv-core.o: $(srccom)/dv-core.c $(hw_main_headers) $(sim_main_headers)
$(CC) -c $(srccom)/dv-core.c $(ALL_CFLAGS)
-dv-glue.o: $(srccom)/dv-glue.c $(sim_main_headers) \
- $(sim-main_h) $(hw_base_headers)
+dv-glue.o: $(srccom)/dv-glue.c $(hw_main_headers) $(sim_main_headers)
$(CC) -c $(srccom)/dv-glue.c $(ALL_CFLAGS)
-dv-pal.o: $(srccom)/dv-pal.c $(sim_main_headers) \
- $(sim-main_h) $(hw_base_headers)
+dv-pal.o: $(srccom)/dv-pal.c $(hw_main_headers) $(sim_main_headers)
$(CC) -c $(srccom)/dv-pal.c $(ALL_CFLAGS)
*/
-#include "sim-main.h"
+#include "hw-main.h"
#include "hw-base.h"
struct hw_base_data {
int finished_p;
- const struct hw_device_descriptor *descriptor;
+ const struct hw_descriptor *descriptor;
hw_delete_callback *to_delete;
};
/* locate a descriptor */
{
- const struct hw_device_descriptor **table;
+ const struct hw_descriptor **table;
for (table = hw_descriptors;
*table != NULL;
table++)
{
- const struct hw_device_descriptor *entry;
+ const struct hw_descriptor *entry;
for (entry = *table;
entry->family != NULL;
entry++)
*/
-#ifndef HW_ROOT
-#define HW_ROOT
-
-/* A root device from which dv-* devices can be built */
-
-#include "hw-device.h"
-
-#include "hw-properties.h"
-#include "hw-events.h"
-#include "hw-alloc.h"
-/* #include "hw-instances.h" */
-/* #include "hw-handles.h" */
-#include "hw-ports.h"
-
-typedef void (hw_finish_callback)
- (struct hw *me);
-
-struct hw_device_descriptor {
- const char *family;
- hw_finish_callback *to_finish;
-};
+#ifndef HW_BASE
+#define HW_BASE
/* Create a primative device */
((hw)->base_of_hw->to_delete = (method))
-/* Helper functions to make the implementation of a device easier */
-
-/* Go through the devices reg properties and look for those specifying
- an address to attach various registers to */
-
-void do_hw_attach_regs (struct hw *me);
-
-/* Perform a polling read on FD returning either the number of bytes
- or a hw_io status code that indicates the reason for the read
- failure */
-
-enum {
- HW_IO_EOF = -1, HW_IO_NOT_READY = -2, /* See: IEEE 1275 */
-};
-
-typedef int (do_hw_poll_read_method)
- (SIM_DESC sd, int, char *, int);
-
-int do_hw_poll_read
-(struct hw *me,
- do_hw_poll_read_method *read,
- int sim_io_fd,
- void *buf,
- unsigned size_of_buf);
-
-
/* ALLOC */
extern void create_hw_alloc_data
\f
/* Perform a soft reset of the device */
-typedef unsigned (hw_reset_callback)
+typedef unsigned (hw_reset_method)
(struct hw *me);
#define hw_reset(hw) ((hw)->to_reset (hw))
The SPACE:ADDR pair specify an address on the common bus that
connects the parent and child devices. */
-typedef void (hw_attach_address_callback)
+typedef void (hw_attach_address_method)
(struct hw *me,
int level,
int space,
#define set_hw_attach_address(hw, method) \
((hw)->to_attach_address = (method))
-typedef void (hw_detach_address_callback)
+typedef void (hw_detach_address_method)
(struct hw *me,
int level,
int space,
The SPACE:ADDR pair specify an address on the bus shared between
the parent and child devices. */
-typedef unsigned (hw_io_read_buffer_callback)
+typedef unsigned (hw_io_read_buffer_method)
(struct hw *me,
void *dest,
int space,
#define set_hw_io_read_buffer(hw, method) \
((hw)->to_io_read_buffer = (method))
-typedef unsigned (hw_io_write_buffer_callback)
+typedef unsigned (hw_io_write_buffer_method)
(struct hw *me,
const void *source,
int space,
The SPACE:ADDR pair specify an address on the common bus connecting
the parent and child devices. */
-typedef unsigned (hw_dma_read_buffer_callback)
+typedef unsigned (hw_dma_read_buffer_method)
(struct hw *bus,
void *dest,
int space,
#define set_hw_dma_read_buffer(me, method) \
((me)->to_dma_read_buffer = (method))
-typedef unsigned (hw_dma_write_buffer_callback)
+typedef unsigned (hw_dma_write_buffer_method)
(struct hw *bus,
const void *source,
int space,
textual representation. This is because the textual address of a
device is specified using the parent busses notation. */
-typedef int (hw_unit_decode_callback)
+typedef int (hw_unit_decode_method)
(struct hw *bus,
const char *encoded,
hw_unit *unit);
#define set_hw_unit_decode(hw, method) \
((hw)->to_unit_decode = (method))
-typedef int (hw_unit_encode_callback)
+typedef int (hw_unit_encode_method)
(struct hw *bus,
const hw_unit *unit,
char *encoded,
Return a zero result if the address should be ignored when looking
for attach addresses. */
-typedef int (hw_unit_address_to_attach_address_callback)
+typedef int (hw_unit_address_to_attach_address_method)
(struct hw *bus,
const hw_unit *unit_addr,
int *attach_space,
#define set_hw_unit_address_to_attach_address(hw, method) \
((hw)->to_unit_address_to_attach_address = (method))
-typedef int (hw_unit_size_to_attach_size_callback)
+typedef int (hw_unit_size_to_attach_size_method)
(struct hw *bus,
const hw_unit *unit_size,
unsigned *attach_size,
nr_hw_ioctl_requests,
} hw_ioctl_request;
-typedef int (hw_ioctl_callback)
+typedef int (hw_ioctl_method)
(struct hw *me,
hw_ioctl_request request,
va_list ap);
int nr_size_cells_of_hw_unit;
/* Soft reset */
- hw_reset_callback *to_reset;
+ hw_reset_method *to_reset;
/* Basic callbacks */
- hw_io_read_buffer_callback *to_io_read_buffer;
- hw_io_write_buffer_callback *to_io_write_buffer;
- hw_dma_read_buffer_callback *to_dma_read_buffer;
- hw_dma_write_buffer_callback *to_dma_write_buffer;
- hw_attach_address_callback *to_attach_address;
- hw_detach_address_callback *to_detach_address;
+ hw_io_read_buffer_method *to_io_read_buffer;
+ hw_io_write_buffer_method *to_io_write_buffer;
+ hw_dma_read_buffer_method *to_dma_read_buffer;
+ hw_dma_write_buffer_method *to_dma_write_buffer;
+ hw_attach_address_method *to_attach_address;
+ hw_detach_address_method *to_detach_address;
/* More complicated callbacks */
- hw_ioctl_callback *to_ioctl;
+ hw_ioctl_method *to_ioctl;
int trace_of_hw_p;
/* address callbacks */
- hw_unit_decode_callback *to_unit_decode;
- hw_unit_encode_callback *to_unit_encode;
- hw_unit_address_to_attach_address_callback *to_unit_address_to_attach_address;
- hw_unit_size_to_attach_size_callback *to_unit_size_to_attach_size;
+ hw_unit_decode_method *to_unit_decode;
+ hw_unit_encode_method *to_unit_encode;
+ hw_unit_address_to_attach_address_method *to_unit_address_to_attach_address;
+ hw_unit_size_to_attach_size_method *to_unit_size_to_attach_size;
/* related data */
struct hw_property_data *properties_of_hw;
--- /dev/null
+/* Common hardware header file.
+ Copyright (C) 1998 Free Software Foundation, Inc.
+ Contributed by Andrew Cagney and Cygnus Support.
+
+This file is part of GDB, the GNU debugger.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+
+#ifndef HW_MAIN
+#define HW_MAIN
+
+/* establish a type system */
+#include "sim-basics.h"
+
+/* construct a hw device */
+#include "hw-device.h"
+#include "hw-properties.h"
+#include "hw-events.h"
+#include "hw-alloc.h"
+/* #include "hw-instances.h" */
+/* #include "hw-handles.h" */
+#include "hw-ports.h"
+
+/* Description of a hardware device */
+
+typedef void (hw_finish_method)
+ (struct hw *me);
+
+struct hw_descriptor {
+ const char *family;
+ hw_finish_method *to_finish;
+};
+
+/* Helper functions to make the implementation of a device easier */
+
+/* Go through the devices reg properties and look for those specifying
+ an address to attach various registers to */
+
+void do_hw_attach_regs (struct hw *me);
+
+/* Perform a polling read on FD returning either the number of bytes
+ or a hw_io status code that indicates the reason for the read
+ failure */
+
+enum {
+ HW_IO_EOF = -1, HW_IO_NOT_READY = -2, /* See: IEEE 1275 */
+};
+
+typedef int (do_hw_poll_read_method)
+ (SIM_DESC sd, int, char *, int);
+
+int do_hw_poll_read
+(struct hw *me,
+ do_hw_poll_read_method *read,
+ int sim_io_fd,
+ void *buf,
+ unsigned size_of_buf);
+
+
+#endif