1/*
2 * Copyright (c) 2012 ARM Limited
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
13 *
14 * Copyright (c) 2006 The Regents of The University of Michigan
15 * All rights reserved.
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions are
19 * met: redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer;
21 * redistributions in binary form must reproduce the above copyright

--- 11 unchanged lines hidden (view full) ---

33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 *
40 * Authors: Ali Saidi
41 * Andreas Hansson
42 */
43
44#ifndef __MEM_TPORT_HH__
45#define __MEM_TPORT_HH__
46
47/**
48 * @file
49 *

--- 34 unchanged lines hidden (view full) ---

84
85 typedef std::list<DeferredPacket> DeferredPacketList;
86 typedef std::list<DeferredPacket>::iterator DeferredPacketIterator;
87
88 /** A list of outgoing timing response packets that haven't been
89 * serviced yet. */
90 DeferredPacketList transmitList;
91
92 /** Label to use for print request packets label stack. */
93 const std::string label;
94
95 /** This function attempts to send deferred packets. Scheduled to
96 * be called in the future via SendEvent. */
97 void processSendEvent();
98
99 /**
100 * This class is used to implemented sendTiming() with a delay. When
101 * a delay is requested a the event is scheduled if it isn't already.
102 * When the event time expires it attempts to send the packet.
103 * If it cannot, the packet sent when recvRetry() is called.
104 **/
89 Event *sendEvent;
105 EventWrapper<SimpleTimingPort,
106 &SimpleTimingPort::processSendEvent> sendEvent;
107
108 /** If we need to drain, keep the drain event around until we're done
109 * here.*/
110 Event *drainEvent;
111
112 /** Remember whether we're awaiting a retry from the bus. */
113 bool waitingOnRetry;
114
98 /** Check the list of buffered packets against the supplied
99 * functional request. */
100 bool checkFunctional(PacketPtr funcPkt);
101
115 /** Check whether we have a packet ready to go on the transmit list. */
116 bool deferredPacketReady()
117 { return !transmitList.empty() && transmitList.front().tick <= curTick(); }
118
119 Tick deferredPacketReadyTime()
120 { return transmitList.empty() ? MaxTick : transmitList.front().tick; }
121
122 /**

--- 11 unchanged lines hidden (view full) ---

134 */
135 void schedSendTiming(PacketPtr pkt, Tick when);
136
137 /** Attempt to send the packet at the head of the deferred packet
138 * list. Caller must guarantee that the deferred packet list is
139 * non-empty and that the head packet is scheduled for curTick() (or
140 * earlier).
141 */
129 void sendDeferredPacket();
142 virtual void sendDeferredPacket();
143
144 /**
145 * Attempt to send the packet at the front of the transmit list,
146 * and set waitingOnRetry accordingly. The packet is temporarily
147 * taken off the list, but put back at the front if not
148 * successfully sent.
149 */
150 void trySendTiming();
151
152 /**
153 * Based on the transmit list, or the provided time, schedule a
154 * send event if there are packets to send. If we are idle and
155 * asked to drain then do so.
156 *
157 * @param time an alternative time for the next send event
158 */
159 void scheduleSend(Tick time = MaxTick);
160
161 /** This function is notification that the device should attempt to send a
162 * packet again. */
163 virtual void recvRetry();
164
165 /** Implemented using recvAtomic(). */
166 void recvFunctional(PacketPtr pkt);
167
168 /** Implemented using recvAtomic(). */

--- 5 unchanged lines hidden (view full) ---

174 * range changes (as the neighbouring port has a master role and
175 * do not have any address ranges. A subclass can override the
176 * default behaviuor if needed.
177 */
178 virtual void recvRangeChange() { }
179
180
181 public:
152 SimpleTimingPort(std::string pname, MemObject *_owner);
182 SimpleTimingPort(const std::string &_name, MemObject *_owner,
183 const std::string _label = "SimpleTimingPort");
184 ~SimpleTimingPort();
185
186 /** Check the list of buffered packets against the supplied
187 * functional request. */
188 bool checkFunctional(PacketPtr pkt);
189
190 /** Hook for draining timing accesses from the system. The
191 * associated SimObject's drain() functions should be implemented
192 * something like this when this class is used:
193 \code
194 PioDevice::drain(Event *de)
195 {
196 unsigned int count;
197 count = SimpleTimingPort->drain(de);

--- 12 unchanged lines hidden ---