1/* 2 * Copyright (c) 2004-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 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; --- 78 unchanged lines hidden (view full) --- 87 Addr totBytes; 88 89 /** Number of bytes that have been acked for this transaction. */ 90 Addr numBytes; 91 92 /** Amount to delay completion of dma by */ 93 Tick delay; 94 |
95 |
96 DmaReqState(Event *ce, Port *p, Addr tb, Tick _delay) 97 : completionEvent(ce), outPort(p), totBytes(tb), numBytes(0), 98 delay(_delay) 99 {} 100 }; 101 |
102 MemObject *device; |
103 std::list<PacketPtr> transmitList; 104 105 /** The system that device/port are in. This is used to select which mode 106 * we are currently operating in. */ 107 System *sys; 108 109 /** Number of outstanding packets the dma port has. */ 110 int pendingCount; --- 4 unchanged lines hidden (view full) --- 115 /** If we need to drain, keep the drain event around until we're done 116 * here.*/ 117 Event *drainEvent; 118 119 /** time to wait between sending another packet, increases as NACKs are 120 * recived, decreases as responses are recived. */ 121 Tick backoffTime; 122 |
123 /** Minimum time that device should back off for after failed sendTiming */ 124 Tick minBackoffDelay; 125 126 /** Maximum time that device should back off for after failed sendTiming */ 127 Tick maxBackoffDelay; 128 |
129 /** If the port is currently waiting for a retry before it can send whatever 130 * it is that it's sending. */ 131 bool inRetry; 132 133 virtual bool recvTiming(PacketPtr pkt); 134 virtual Tick recvAtomic(PacketPtr pkt) 135 { panic("dma port shouldn't be used for pio access."); M5_DUMMY_RETURN } 136 virtual void recvFunctional(PacketPtr pkt) --- 10 unchanged lines hidden (view full) --- 147 148 void queueDma(PacketPtr pkt, bool front = false); 149 void sendDma(); 150 151 /** event to give us a kick every time we backoff time is reached. */ 152 EventWrapper<DmaPort, &DmaPort::sendDma> backoffEvent; 153 154 public: |
155 DmaPort(MemObject *dev, System *s, Tick min_backoff, Tick max_backoff); |
156 157 void dmaAction(Packet::Command cmd, Addr addr, int size, Event *event, 158 uint8_t *data, Tick delay); 159 160 bool dmaPending() { return pendingCount > 0; } 161 162 unsigned cacheBlockSize() const { return peerBlockSize(); } 163 unsigned int drain(Event *de); --- 94 unchanged lines hidden (view full) --- 258 void addressRanges(AddrRangeList &range_list); 259 260}; 261 262class DmaDevice : public PioDevice 263{ 264 protected: 265 DmaPort *dmaPort; |
266 267 public: 268 typedef DmaDeviceParams Params; 269 DmaDevice(const Params *p); 270 virtual ~DmaDevice(); 271 272 const Params * 273 params() const --- 24 unchanged lines hidden (view full) --- 298 fatal("%s: pio port already connected to %s", 299 name(), pioPort->getPeer()->name()); 300 pioPort = new PioPort(this, sys); 301 return pioPort; 302 } else if (if_name == "dma") { 303 if (dmaPort != NULL) 304 fatal("%s: dma port already connected to %s", 305 name(), dmaPort->getPeer()->name()); |
306 dmaPort = new DmaPort(this, sys, params()->min_backoff_delay, 307 params()->max_backoff_delay); |
308 return dmaPort; 309 } else 310 return NULL; 311 } 312 313 friend class DmaPort; 314}; 315 316 317#endif // __DEV_IO_DEVICE_HH__ |