1 /* This file is part of the program psim.
3 Copyright (C) 1994-1998, Andrew Cagney <cagney@highland.com.au>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 /* A root device from which dv-* devices can be built */
27 #include "hw-device.h"
29 #include "hw-properties.h"
30 #include "hw-events.h"
32 /* #include "hw-instances.h" */
33 /* #include "hw-handles.h" */
36 typedef void (hw_finish_callback
)
39 struct hw_device_descriptor
{
41 hw_finish_callback
*to_finish
;
44 /* Create a primative device */
47 (struct sim_state
*sd
,
55 /* Complete the creation of that device (finish overrides methods
56 using the set_hw_* operations below) */
65 /* Delete the entire device */
71 /* Override device methods */
73 #define set_hw_data(hw, value) \
74 ((hw)->data_of_hw = (value))
76 #define set_hw_reset(hw, method) \
77 ((hw)->to_reset = method)
79 #define set_hw_io_read_buffer(hw, method) \
80 ((hw)->to_io_read_buffer = (method))
81 #define set_hw_io_write_buffer(hw, method) \
82 ((hw)->to_io_write_buffer = (method))
84 #define set_hw_dma_read_buffer(me, method) \
85 ((me)->to_dma_read_buffer = (method))
86 #define set_hw_dma_write_buffer(me, method) \
87 ((me)->to_dma_write_buffer = (method))
89 #define set_hw_attach_address(hw, method) \
90 ((hw)->to_attach_address = (method))
91 #define set_hw_detach_address(hw, method) \
92 ((hw)->to_detach_address = (method))
94 #define set_hw_unit_decode(hw, method) \
95 ((hw)->to_unit_decode = (method))
96 #define set_hw_unit_encode(hw, method) \
97 ((hw)->to_unit_encode = (method))
99 #define set_hw_unit_address_to_attach_address(hw, method) \
100 ((hw)->to_unit_address_to_attach_address = (method))
101 #define set_hw_unit_size_to_attach_size(hw, method) \
102 ((hw)->to_unit_size_to_attach_size = (method))
104 typedef void (hw_delete_callback
)
107 #define set_hw_delete(hw, method) \
108 ((hw)->base_of_hw->to_delete = (method))
111 /* Helper functions to make the implementation of a device easier */
113 /* Go through the devices reg properties and look for those specifying
114 an address to attach various registers to */
116 void do_hw_attach_regs (struct hw
*me
);
118 /* Perform a polling read on FD returning either the number of bytes
119 or a hw_io status code that indicates the reason for the read
123 HW_IO_EOF
= -1, HW_IO_NOT_READY
= -2, /* See: IEEE 1275 */
126 typedef int (do_hw_poll_read_method
)
127 (SIM_DESC sd
, int, char *, int);
131 do_hw_poll_read_method
*read
,
134 unsigned size_of_buf
);
139 extern void create_hw_alloc_data
141 extern void delete_hw_alloc_data
147 extern void create_hw_port_data
149 extern void delete_hw_port_data
155 extern void create_hw_event_data
157 extern void delete_hw_event_data
This page took 0.032858 seconds and 4 git commands to generate.