port_proxy.cc (10564:a8c16e2d466a) port_proxy.cc (10653:e3fc6bc7f97e)
1/*
2 * Copyright (c) 2012 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

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

38 */
39
40#include "base/chunk_generator.hh"
41#include "mem/port_proxy.hh"
42
43void
44PortProxy::readBlob(Addr addr, uint8_t *p, int size) const
45{
1/*
2 * Copyright (c) 2012 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

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

38 */
39
40#include "base/chunk_generator.hh"
41#include "mem/port_proxy.hh"
42
43void
44PortProxy::readBlob(Addr addr, uint8_t *p, int size) const
45{
46 Request req;
47
48 for (ChunkGenerator gen(addr, size, _cacheLineSize); !gen.done();
49 gen.next()) {
46 for (ChunkGenerator gen(addr, size, _cacheLineSize); !gen.done();
47 gen.next()) {
50 req.setPhys(gen.addr(), gen.size(), 0, Request::funcMasterId);
48 Request req(gen.addr(), gen.size(), 0, Request::funcMasterId);
51 Packet pkt(&req, MemCmd::ReadReq);
52 pkt.dataStatic(p);
53 _port.sendFunctional(&pkt);
54 p += gen.size();
55 }
56}
57
58void
59PortProxy::writeBlob(Addr addr, const uint8_t *p, int size) const
60{
49 Packet pkt(&req, MemCmd::ReadReq);
50 pkt.dataStatic(p);
51 _port.sendFunctional(&pkt);
52 p += gen.size();
53 }
54}
55
56void
57PortProxy::writeBlob(Addr addr, const uint8_t *p, int size) const
58{
61 Request req;
62
63 for (ChunkGenerator gen(addr, size, _cacheLineSize); !gen.done();
64 gen.next()) {
59 for (ChunkGenerator gen(addr, size, _cacheLineSize); !gen.done();
60 gen.next()) {
65 req.setPhys(gen.addr(), gen.size(), 0, Request::funcMasterId);
61 Request req(gen.addr(), gen.size(), 0, Request::funcMasterId);
66 Packet pkt(&req, MemCmd::WriteReq);
67 pkt.dataStaticConst(p);
68 _port.sendFunctional(&pkt);
69 p += gen.size();
70 }
71}
72
73void
74PortProxy::memsetBlob(Addr addr, uint8_t v, int size) const
75{
76 // quick and dirty...
77 uint8_t *buf = new uint8_t[size];
78
79 std::memset(buf, v, size);
80 PortProxy::writeBlob(addr, buf, size);
81
82 delete [] buf;
83}
62 Packet pkt(&req, MemCmd::WriteReq);
63 pkt.dataStaticConst(p);
64 _port.sendFunctional(&pkt);
65 p += gen.size();
66 }
67}
68
69void
70PortProxy::memsetBlob(Addr addr, uint8_t v, int size) const
71{
72 // quick and dirty...
73 uint8_t *buf = new uint8_t[size];
74
75 std::memset(buf, v, size);
76 PortProxy::writeBlob(addr, buf, size);
77
78 delete [] buf;
79}