2 * Copyright (c) 2003 The Regents of The University of Michigan
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 * Tsunami Fake I/O Space mapping including RTC/timer interrupts
33 #ifndef __TSUNAMI_DMA_HH__
34 #define __TSUNAMI_DMA_HH__
38 #include "mem/functional_mem/mmap_device.hh"
39 #include "dev/tsunami.hh"
44 class TsunamiIO : public MmapDevice
50 // In Tsunami RTC only has two i/o ports
51 // one for data and one for address, so you
52 // write the address and then read/write the data
57 class ClockEvent : public Event
67 virtual void process();
68 virtual const char *description();
69 void Program(int count);
70 void ChangeMode(uint8_t mode);
75 class RTCEvent : public Event
82 virtual void process();
83 virtual const char *description();
93 uint8_t picr; //Raw PIC interrput register, before masking
98 /* This timer is initilized, but after I wrote the code
99 it doesn't seem to be used again, and best I can tell
100 it too is not connected to any interrupt port */
103 /* This timer is used to control the speaker, which
104 we normally could care less about, however it is
105 also used to calculated the clockspeed and hense
106 bogomips which is kinda important to the scheduler
107 so we need to implemnt it although after boot I can't
108 imagine we would be playing with the PC speaker much */
117 uint32_t frequency() const { return RTC_RATE; }
119 TsunamiIO(const std::string &name, Tsunami *t, time_t init_time,
120 Addr addr, Addr mask, MemoryController *mmu);
122 void set_time(time_t t);
124 virtual Fault read(MemReqPtr &req, uint8_t *data);
125 virtual Fault write(MemReqPtr &req, const uint8_t *data);
127 void postPIC(uint8_t bitvector);
128 void clearPIC(uint8_t bitvector);
130 virtual void serialize(std::ostream &os);
131 virtual void unserialize(Checkpoint *cp, const std::string §ion);
134 #endif // __TSUNAMI_IO_HH__