io_device.hh (7607:e75d877c8557) io_device.hh (8598:c7fec2cb91cb)
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;

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

210 {
211 return dynamic_cast<const Params *>(_params);
212 }
213
214 virtual void init();
215
216 virtual unsigned int drain(Event *de);
217
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;

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

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

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

286 }
287
288 bool dmaPending() { return dmaPort->dmaPending(); }
289
290 virtual unsigned int drain(Event *de);
291
292 unsigned cacheBlockSize() const { return dmaPort->cacheBlockSize(); }
293
220 friend class PioPort;
221
222};
223
224class BasicPioDevice : public PioDevice
225{
226 protected:
227 /** Address that the device listens to. */

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

277 }
278
279 bool dmaPending() { return dmaPort->dmaPending(); }
280
281 virtual unsigned int drain(Event *de);
282
283 unsigned cacheBlockSize() const { return dmaPort->cacheBlockSize(); }
284
294 virtual Port *getPort(const std::string &if_name, int idx = -1)
295 {
296 if (if_name == "pio") {
297 if (pioPort != NULL)
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 }
285 virtual Port *getPort(const std::string &if_name, int idx = -1);
312
313 friend class DmaPort;
314};
315
316
317#endif // __DEV_IO_DEVICE_HH__
286
287 friend class DmaPort;
288};
289
290
291#endif // __DEV_IO_DEVICE_HH__