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"
31 /* #include "hw-instances.h" */
32 /* #include "hw-handles.h" */
35 typedef void (hw_finish_callback
)
38 struct hw_device_descriptor
{
40 hw_finish_callback
*to_finish
;
43 /* Create a primative device */
46 (struct sim_state
*sd
,
54 /* Complete the creation of that device (finish overrides methods
55 using the set_hw_* operations below) */
64 /* Delete the entire device */
70 /* Override device methods */
72 #define set_hw_data(hw, value) \
73 ((hw)->data_of_hw = (value))
75 #define set_hw_reset(hw, method) \
76 ((hw)->to_reset = method)
78 #define set_hw_io_read_buffer(hw, method) \
79 ((hw)->to_io_read_buffer = (method))
80 #define set_hw_io_write_buffer(hw, method) \
81 ((hw)->to_io_write_buffer = (method))
83 #define set_hw_dma_read_buffer(me, method) \
84 ((me)->to_dma_read_buffer = (method))
85 #define set_hw_dma_write_buffer(me, method) \
86 ((me)->to_dma_write_buffer = (method))
88 #define set_hw_attach_address(hw, method) \
89 ((hw)->to_attach_address = (method))
90 #define set_hw_detach_address(hw, method) \
91 ((hw)->to_detach_address = (method))
93 #define set_hw_unit_decode(hw, method) \
94 ((hw)->to_unit_decode = (method))
95 #define set_hw_unit_encode(hw, method) \
96 ((hw)->to_unit_encode = (method))
98 #define set_hw_unit_address_to_attach_address(hw, method) \
99 ((hw)->to_unit_address_to_attach_address = (method))
100 #define set_hw_unit_size_to_attach_size(hw, method) \
101 ((hw)->to_unit_size_to_attach_size = (method))
103 typedef void (hw_delete_callback
)
106 #define set_hw_delete(hw, method) \
107 ((hw)->base_of_hw->to_delete = (method))
110 /* Helper functions to make the implementation of a device easier */
112 /* Go through the devices reg properties and look for those specifying
113 an address to attach various registers to */
115 void do_hw_attach_regs (struct hw
*me
);
117 /* Perform a polling read on FD returning either the number of bytes
118 or a hw_io status code that indicates the reason for the read
122 HW_IO_EOF
= -1, HW_IO_NOT_READY
= -2, /* See: IEEE 1275 */
125 typedef int (do_hw_poll_read_method
)
126 (SIM_DESC sd
, int, char *, int);
130 do_hw_poll_read_method
*read
,
133 unsigned size_of_buf
);
138 extern void create_hw_port_data
140 extern void delete_hw_port_data
146 extern void create_hw_event_data
148 extern void delete_hw_event_data
This page took 0.032222 seconds and 4 git commands to generate.