1 /* Interrupt controller.
2    Copyright 2001, 2002 Brian R. Gaeke.
3    Copyright 2002, 2003 Paul Twohey.
4 
5 This file is part of VMIPS.
6 
7 VMIPS is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 2 of the License, or (at your
10 option) any later version.
11 
12 VMIPS is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License along
18 with VMIPS; if not, write to the Free Software Foundation, Inc.,
19 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
20 
21 #include "deviceint.h"
22 #include "intctrl.h"
23 #include <cassert>
24 
calculateIP()25 uint32 IntCtrl::calculateIP()
26 {
27 	uint32 IP = 0;
28 	for (Devices::iterator i = devs.begin(); i != devs.end(); i++) {
29 		IP |= (*i)->lines_asserted;
30 	}
31 	return IP;
32 }
33 
connectLine(uint32 line,DeviceInt * dev)34 void IntCtrl::connectLine(uint32 line, DeviceInt *dev)
35 {
36 	assert(dev);
37 
38 	dev->lines_connected |= line;
39 
40 	for (Devices::iterator i = devs.begin(); i != devs.end(); i++) {
41 		if (dev == *i)
42 			return;
43 	}
44 
45 	devs.push_back(dev);
46 }
47