/* Hardware ports.
|
/* Hardware ports.
|
Copyright (C) 1998, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
Copyright (C) 1998, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
Contributed by Andrew Cagney and Cygnus Solutions.
|
Contributed by Andrew Cagney and Cygnus Solutions.
|
|
|
This file is part of GDB, the GNU debugger.
|
This file is part of GDB, the GNU debugger.
|
|
|
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
the Free Software Foundation; either version 3 of the License, or
|
the Free Software Foundation; either version 3 of the License, or
|
(at your option) any later version.
|
(at your option) any later version.
|
|
|
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
GNU General Public License for more details.
|
GNU General Public License for more details.
|
|
|
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
|
#ifndef HW_PORTS_H
|
#ifndef HW_PORTS_H
|
#define HW_PORTS_H
|
#define HW_PORTS_H
|
|
|
/* Initialize a port */
|
/* Initialize a port */
|
|
|
struct hw_port_descriptor {
|
struct hw_port_descriptor {
|
const char *name;
|
const char *name;
|
int number;
|
int number;
|
int nr_ports;
|
int nr_ports;
|
port_direction direction;
|
port_direction direction;
|
};
|
};
|
|
|
void set_hw_ports (struct hw *hw, const struct hw_port_descriptor ports[]);
|
void set_hw_ports (struct hw *hw, const struct hw_port_descriptor ports[]);
|
|
|
typedef void (hw_port_event_method)
|
typedef void (hw_port_event_method)
|
(struct hw *me,
|
(struct hw *me,
|
int my_port,
|
int my_port,
|
struct hw *source,
|
struct hw *source,
|
int source_port,
|
int source_port,
|
int level);
|
int level);
|
|
|
void set_hw_port_event (struct hw *hw, hw_port_event_method *to_port_event);
|
void set_hw_port_event (struct hw *hw, hw_port_event_method *to_port_event);
|
|
|
|
|
/* Port source
|
/* Port source
|
|
|
A device drives its output ports using the call
|
A device drives its output ports using the call
|
|
|
*/
|
*/
|
|
|
void hw_port_event
|
void hw_port_event
|
(struct hw *me,
|
(struct hw *me,
|
int my_port,
|
int my_port,
|
int value);
|
int value);
|
|
|
/* This port event will then be propogated to any attached
|
/* This port event will then be propogated to any attached
|
destination ports.
|
destination ports.
|
|
|
Any interpretation of PORT and VALUE is model dependant. As a
|
Any interpretation of PORT and VALUE is model dependant. As a
|
guideline the following are recommended: PCI interrupts A-D should
|
guideline the following are recommended: PCI interrupts A-D should
|
correspond to ports 0-3; level sensative interrupts be requested
|
correspond to ports 0-3; level sensative interrupts be requested
|
with a value of one and withdrawn with a value of 0; edge sensative
|
with a value of one and withdrawn with a value of 0; edge sensative
|
interrupts always have a value of 1, the event its self is treated
|
interrupts always have a value of 1, the event its self is treated
|
as the interrupt.
|
as the interrupt.
|
|
|
|
|
Port destinations
|
Port destinations
|
|
|
Attached to each port of a device can be zero or more
|
Attached to each port of a device can be zero or more
|
desitinations. These destinations consist of a device/port pair.
|
desitinations. These destinations consist of a device/port pair.
|
A destination is attached/detached to a device line using the
|
A destination is attached/detached to a device line using the
|
attach and detach calls. */
|
attach and detach calls. */
|
|
|
void hw_port_attach
|
void hw_port_attach
|
(struct hw *me,
|
(struct hw *me,
|
int my_port,
|
int my_port,
|
struct hw *dest,
|
struct hw *dest,
|
int dest_port,
|
int dest_port,
|
object_disposition disposition);
|
object_disposition disposition);
|
|
|
void hw_port_detach
|
void hw_port_detach
|
(struct hw *me,
|
(struct hw *me,
|
int my_port,
|
int my_port,
|
struct hw *dest,
|
struct hw *dest,
|
int dest_port);
|
int dest_port);
|
|
|
|
|
/* Iterate over the list of ports attached to a device */
|
/* Iterate over the list of ports attached to a device */
|
|
|
typedef void (hw_port_traverse_function)
|
typedef void (hw_port_traverse_function)
|
(struct hw *me,
|
(struct hw *me,
|
int my_port,
|
int my_port,
|
struct hw *dest,
|
struct hw *dest,
|
int dest_port,
|
int dest_port,
|
void *data);
|
void *data);
|
|
|
void hw_port_traverse
|
void hw_port_traverse
|
(struct hw *me,
|
(struct hw *me,
|
hw_port_traverse_function *handler,
|
hw_port_traverse_function *handler,
|
void *data);
|
void *data);
|
|
|
|
|
/* DESTINATION is attached (detached) to LINE of the device ME
|
/* DESTINATION is attached (detached) to LINE of the device ME
|
|
|
|
|
Port conversion
|
Port conversion
|
|
|
Users refer to port numbers symbolically. For instance a device
|
Users refer to port numbers symbolically. For instance a device
|
may refer to its `INT' signal which is internally represented by
|
may refer to its `INT' signal which is internally represented by
|
port 3.
|
port 3.
|
|
|
To convert to/from the symbolic and internal representation of a
|
To convert to/from the symbolic and internal representation of a
|
port name/number. The following functions are available. */
|
port name/number. The following functions are available. */
|
|
|
int hw_port_decode
|
int hw_port_decode
|
(struct hw *me,
|
(struct hw *me,
|
const char *symbolic_name,
|
const char *symbolic_name,
|
port_direction direction);
|
port_direction direction);
|
|
|
int hw_port_encode
|
int hw_port_encode
|
(struct hw *me,
|
(struct hw *me,
|
int port_number,
|
int port_number,
|
char *buf,
|
char *buf,
|
int sizeof_buf,
|
int sizeof_buf,
|
port_direction direction);
|
port_direction direction);
|
|
|
|
|
#endif
|
#endif
|
|
|