io_device.hh (2632:1bb2f91485ea) io_device.hh (2641:6d9d837e2032)
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;

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

110
111 public:
112 PioPort(PioDevice *dev, Platform *p);
113
114 friend class PioPort::SendEvent;
115};
116
117
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;

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

110
111 public:
112 PioPort(PioDevice *dev, Platform *p);
113
114 friend class PioPort::SendEvent;
115};
116
117
118struct DmaReqState
118struct DmaReqState : public Packet::SenderState
119{
120 Event *completionEvent;
121 bool final;
122 DmaReqState(Event *ce, bool f)
123 : completionEvent(ce), final(f)
124 {}
125};
126

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

168 friend class DmaPort;
169 };
170
171 void sendDma(Packet *pkt);
172
173 public:
174 DmaPort(DmaDevice *dev, Platform *p);
175
119{
120 Event *completionEvent;
121 bool final;
122 DmaReqState(Event *ce, bool f)
123 : completionEvent(ce), final(f)
124 {}
125};
126

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

168 friend class DmaPort;
169 };
170
171 void sendDma(Packet *pkt);
172
173 public:
174 DmaPort(DmaDevice *dev, Platform *p);
175
176 void dmaAction(Command cmd, Addr addr, int size, Event *event,
177 uint8_t *data = NULL);
176 void dmaAction(Packet::Command cmd, Addr addr, int size, Event *event,
177 uint8_t *data = NULL);
178
179 bool dmaPending() { return pendingCount > 0; }
180
181 friend class DmaPort::SendEvent;
182
183};
184
185/**

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

202 * that it sees. */
203 PioPort *pioPort;
204
205 virtual void addressRanges(AddrRangeList &range_list) = 0;
206
207 /** As far as the devices are concerned they only accept atomic transactions
208 * which are converted to either a write or a read. */
209 Tick recvAtomic(Packet *pkt)
178
179 bool dmaPending() { return pendingCount > 0; }
180
181 friend class DmaPort::SendEvent;
182
183};
184
185/**

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

202 * that it sees. */
203 PioPort *pioPort;
204
205 virtual void addressRanges(AddrRangeList &range_list) = 0;
206
207 /** As far as the devices are concerned they only accept atomic transactions
208 * which are converted to either a write or a read. */
209 Tick recvAtomic(Packet *pkt)
210 { return pkt->cmd == Read ? this->read(pkt) : this->write(pkt); }
210 { return pkt->isRead() ? this->read(pkt) : this->write(pkt); }
211
212 /** Pure virtual function that the device must implement. Called when a read
213 * command is recieved by the port.
214 * @param pkt Packet describing this request
215 * @return number of ticks it took to complete
216 */
217 virtual Tick read(Packet *pkt) = 0;
218

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

300 protected:
301 DmaPort *dmaPort;
302
303 public:
304 DmaDevice(Params *p);
305 virtual ~DmaDevice();
306
307 void dmaWrite(Addr addr, int size, Event *event, uint8_t *data)
211
212 /** Pure virtual function that the device must implement. Called when a read
213 * command is recieved by the port.
214 * @param pkt Packet describing this request
215 * @return number of ticks it took to complete
216 */
217 virtual Tick read(Packet *pkt) = 0;
218

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

300 protected:
301 DmaPort *dmaPort;
302
303 public:
304 DmaDevice(Params *p);
305 virtual ~DmaDevice();
306
307 void dmaWrite(Addr addr, int size, Event *event, uint8_t *data)
308 { dmaPort->dmaAction(Write, addr, size, event, data) ; }
308 { dmaPort->dmaAction(Packet::WriteReq, addr, size, event, data) ; }
309
310 void dmaRead(Addr addr, int size, Event *event, uint8_t *data = NULL)
309
310 void dmaRead(Addr addr, int size, Event *event, uint8_t *data = NULL)
311 { dmaPort->dmaAction(Read, addr, size, event, data); }
311 { dmaPort->dmaAction(Packet::ReadReq, addr, size, event, data); }
312
313 bool dmaPending() { return dmaPort->dmaPending(); }
314
315 virtual Port *getPort(const std::string &if_name)
316 {
317 if (if_name == "pio") {
318 if (pioPort != NULL)
319 panic("pio port already connected to.");

--- 16 unchanged lines hidden ---
312
313 bool dmaPending() { return dmaPort->dmaPending(); }
314
315 virtual Port *getPort(const std::string &if_name)
316 {
317 if (if_name == "pio") {
318 if (pioPort != NULL)
319 panic("pio port already connected to.");

--- 16 unchanged lines hidden ---