io_device.hh (8742:9df38d259935) io_device.hh (8795:0909f8ed7aa0)
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;

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

204 {
205 return dynamic_cast<const Params *>(_params);
206 }
207
208 virtual void init();
209
210 virtual unsigned int drain(Event *de);
211
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;

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

204 {
205 return dynamic_cast<const Params *>(_params);
206 }
207
208 virtual void init();
209
210 virtual unsigned int drain(Event *de);
211
212 virtual Port *getPort(const std::string &if_name, int idx = -1)
213 {
214 if (if_name == "pio") {
215 if (pioPort != NULL)
216 fatal("%s: pio port already connected to %s",
217 name(), pioPort->getPeer()->name());
218 pioPort = new PioPort(this, sys);
219 return pioPort;
220 } else
221 return NULL;
222 }
212 virtual Port *getPort(const std::string &if_name, int idx = -1);
213
223 friend class PioPort;
224
225};
226
227class BasicPioDevice : public PioDevice
228{
229 protected:
230 /** Address that the device listens to. */

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

280 }
281
282 bool dmaPending() { return dmaPort->dmaPending(); }
283
284 virtual unsigned int drain(Event *de);
285
286 unsigned cacheBlockSize() const { return dmaPort->cacheBlockSize(); }
287
214 friend class PioPort;
215
216};
217
218class BasicPioDevice : public PioDevice
219{
220 protected:
221 /** Address that the device listens to. */

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

271 }
272
273 bool dmaPending() { return dmaPort->dmaPending(); }
274
275 virtual unsigned int drain(Event *de);
276
277 unsigned cacheBlockSize() const { return dmaPort->cacheBlockSize(); }
278
288 virtual Port *getPort(const std::string &if_name, int idx = -1)
289 {
290 if (if_name == "pio") {
291 if (pioPort != NULL)
292 fatal("%s: pio port already connected to %s",
293 name(), pioPort->getPeer()->name());
294 pioPort = new PioPort(this, sys);
295 return pioPort;
296 } else if (if_name == "dma") {
297 if (dmaPort != NULL)
298 fatal("%s: dma port already connected to %s",
299 name(), dmaPort->getPeer()->name());
300 dmaPort = new DmaPort(this, sys, params()->min_backoff_delay,
301 params()->max_backoff_delay);
302 return dmaPort;
303 } else
304 return NULL;
305 }
279 virtual Port *getPort(const std::string &if_name, int idx = -1);
306
307 friend class DmaPort;
308};
309
310
311#endif // __DEV_IO_DEVICE_HH__
280
281 friend class DmaPort;
282};
283
284
285#endif // __DEV_IO_DEVICE_HH__