io_device.hh (8832:247fee427324) | io_device.hh (8851:7e966326ef5b) |
---|---|
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; --- 178 unchanged lines hidden (view full) --- 187 */ 188class PioDevice : public MemObject 189{ 190 protected: 191 System *sys; 192 193 /** The pioPort that handles the requests for us and provides us requests 194 * that it sees. */ | 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; --- 178 unchanged lines hidden (view full) --- 187 */ 188class PioDevice : public MemObject 189{ 190 protected: 191 System *sys; 192 193 /** The pioPort that handles the requests for us and provides us requests 194 * that it sees. */ |
195 PioPort *pioPort; | 195 PioPort pioPort; |
196 197 /** 198 * Every PIO device is obliged to provide an implementation that 199 * returns the address ranges the device responds to. 200 * 201 * @return a list of non-overlapping address ranges 202 */ 203 virtual AddrRangeList getAddrRanges() = 0; --- 62 unchanged lines hidden (view full) --- 266 */ 267 virtual AddrRangeList getAddrRanges(); 268 269}; 270 271class DmaDevice : public PioDevice 272{ 273 protected: | 196 197 /** 198 * Every PIO device is obliged to provide an implementation that 199 * returns the address ranges the device responds to. 200 * 201 * @return a list of non-overlapping address ranges 202 */ 203 virtual AddrRangeList getAddrRanges() = 0; --- 62 unchanged lines hidden (view full) --- 266 */ 267 virtual AddrRangeList getAddrRanges(); 268 269}; 270 271class DmaDevice : public PioDevice 272{ 273 protected: |
274 DmaPort *dmaPort; | 274 DmaPort dmaPort; |
275 276 public: 277 typedef DmaDeviceParams Params; 278 DmaDevice(const Params *p); 279 virtual ~DmaDevice(); 280 281 const Params * 282 params() const 283 { 284 return dynamic_cast<const Params *>(_params); 285 } 286 | 275 276 public: 277 typedef DmaDeviceParams Params; 278 DmaDevice(const Params *p); 279 virtual ~DmaDevice(); 280 281 const Params * 282 params() const 283 { 284 return dynamic_cast<const Params *>(_params); 285 } 286 |
287 void dmaWrite(Addr addr, int size, Event *event, uint8_t *data, Tick delay = 0) | 287 void dmaWrite(Addr addr, int size, Event *event, uint8_t *data, 288 Tick delay = 0) |
288 { | 289 { |
289 dmaPort->dmaAction(MemCmd::WriteReq, addr, size, event, data, delay); | 290 dmaPort.dmaAction(MemCmd::WriteReq, addr, size, event, data, delay); |
290 } 291 | 291 } 292 |
292 void dmaRead(Addr addr, int size, Event *event, uint8_t *data, Tick delay = 0) | 293 void dmaRead(Addr addr, int size, Event *event, uint8_t *data, 294 Tick delay = 0) |
293 { | 295 { |
294 dmaPort->dmaAction(MemCmd::ReadReq, addr, size, event, data, delay); | 296 dmaPort.dmaAction(MemCmd::ReadReq, addr, size, event, data, delay); |
295 } 296 | 297 } 298 |
297 bool dmaPending() { return dmaPort->dmaPending(); } | 299 bool dmaPending() { return dmaPort.dmaPending(); } |
298 | 300 |
301 virtual void init(); 302 |
|
299 virtual unsigned int drain(Event *de); 300 | 303 virtual unsigned int drain(Event *de); 304 |
301 unsigned cacheBlockSize() const { return dmaPort->cacheBlockSize(); } | 305 unsigned cacheBlockSize() const { return dmaPort.cacheBlockSize(); } |
302 303 virtual Port *getPort(const std::string &if_name, int idx = -1); 304 305 friend class DmaPort; 306}; 307 308 309#endif // __DEV_IO_DEVICE_HH__ | 306 307 virtual Port *getPort(const std::string &if_name, int idx = -1); 308 309 friend class DmaPort; 310}; 311 312 313#endif // __DEV_IO_DEVICE_HH__ |