mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
commit
47379f0374
11 changed files with 29 additions and 25 deletions
|
@ -72,7 +72,9 @@ test:cppcheck:
|
|||
gpu/
|
||||
src/
|
||||
lib/
|
||||
tests/unit/ | tee cppcheck.log
|
||||
tests/unit/
|
||||
--suppress=unmatchedSuppression
|
||||
-igpu/thirdparty | tee cppcheck.log
|
||||
image: ${DOCKER_IMAGE_DEV}:${DOCKER_TAG_DEV}
|
||||
dependencies:
|
||||
- build:source
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 1912f2106453cea3a20358942ad7f360b2129bc3
|
||||
Subproject commit 51e32a4b9164b176da5ba3843b645ad6b49b3ec2
|
|
@ -54,12 +54,12 @@ class InterruptController;
|
|||
class IpIdentifier {
|
||||
public:
|
||||
|
||||
IpIdentifier(Vlnv vlnv = Vlnv::getWildcard(), std::string name = "") :
|
||||
IpIdentifier(const Vlnv &vlnv = Vlnv::getWildcard(), const std::string &name = "") :
|
||||
vlnv(vlnv),
|
||||
name(name)
|
||||
{ }
|
||||
|
||||
IpIdentifier(std::string vlnvString, std::string name = "") :
|
||||
IpIdentifier(const std::string &vlnvString, const std::string &name = "") :
|
||||
vlnv(vlnvString),
|
||||
name(name)
|
||||
{ }
|
||||
|
|
|
@ -43,7 +43,6 @@ public:
|
|||
virtual
|
||||
bool init() override;
|
||||
|
||||
virtual
|
||||
bool reset() override;
|
||||
|
||||
// Memory-mapped to stream (MM2S)
|
||||
|
|
|
@ -56,8 +56,6 @@ public:
|
|||
doorbellRegister = 0;
|
||||
}
|
||||
|
||||
static constexpr const char* registerMemory = "Reg";
|
||||
|
||||
std::list<MemoryBlockName> getMemoryBlocks() const
|
||||
{
|
||||
return {
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
version("")
|
||||
{ }
|
||||
|
||||
Vlnv(std::string s)
|
||||
Vlnv(const std::string &s)
|
||||
{
|
||||
parseFromString(s);
|
||||
}
|
||||
|
|
|
@ -207,7 +207,7 @@ bool Dma::reset()
|
|||
|
||||
Dma::~Dma()
|
||||
{
|
||||
reset();
|
||||
Dma::reset();
|
||||
}
|
||||
|
||||
bool Dma::memcpy(const MemoryBlock &src, const MemoryBlock &dst, size_t len)
|
||||
|
|
|
@ -113,13 +113,12 @@ EMC::flash(uint32_t offset, uint32_t length, uint8_t *data)
|
|||
int ret = XST_FAILURE;
|
||||
uint32_t start = offset;
|
||||
|
||||
uint8_t *verify_data = new uint8_t[length];
|
||||
|
||||
/* Reset the Flash Device. This clears the ret registers and puts
|
||||
* the device in Read mode. */
|
||||
ret = XFlash_Reset(&xflash);
|
||||
if (ret != XST_SUCCESS)
|
||||
if (ret != XST_SUCCESS){
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Perform an unlock operation before the erase operation for the Intel
|
||||
* Flash. The erase operation will result in an error if the block is
|
||||
|
@ -128,30 +127,37 @@ EMC::flash(uint32_t offset, uint32_t length, uint8_t *data)
|
|||
(xflash.CommandSet == XFL_CMDSET_INTEL_EXTENDED) ||
|
||||
(xflash.CommandSet == XFL_CMDSET_INTEL_G18)) {
|
||||
ret = XFlash_Unlock(&xflash, offset, 0);
|
||||
if(ret != XST_SUCCESS)
|
||||
if(ret != XST_SUCCESS){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Perform the Erase operation.
|
||||
ret = XFlash_Erase(&xflash, start, length);
|
||||
if (ret != XST_SUCCESS)
|
||||
if (ret != XST_SUCCESS){;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Perform the Write operation.
|
||||
ret = XFlash_Write(&xflash, start, length, data);
|
||||
if (ret != XST_SUCCESS)
|
||||
if (ret != XST_SUCCESS){
|
||||
return false;
|
||||
}
|
||||
|
||||
// Perform the read operation.
|
||||
uint8_t *verify_data = new uint8_t[length];
|
||||
ret = XFlash_Read(&xflash, start, length, verify_data);
|
||||
if(ret != XST_SUCCESS) {
|
||||
delete[] verify_data;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Compare the data read against the data Written.
|
||||
for (unsigned i = 0; i < length; i++) {
|
||||
if (verify_data[i] != data[i])
|
||||
if (verify_data[i] != data[i]){
|
||||
delete[] verify_data;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
delete[] verify_data;
|
||||
|
|
|
@ -75,14 +75,14 @@ int main(int argc, char **argv) {
|
|||
PRINT_ERROR;
|
||||
|
||||
printf("%s opened.\n", filename);
|
||||
printf("Target offset is %#jx, page size is %lu\n", (intmax_t) target, sysconf(_SC_PAGE_SIZE));
|
||||
printf("Target offset is %#jx, page size is %lu\n", (uintmax_t) target, sysconf(_SC_PAGE_SIZE));
|
||||
|
||||
fflush(stdout);
|
||||
|
||||
// Map one page
|
||||
printf("mmap(%d, %lu, %#x, %#x, %d, %#jx)\n", 0,
|
||||
MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
|
||||
fd, (intmax_t) target);
|
||||
fd, (uintmax_t) target);
|
||||
|
||||
map_base = mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, target & ~MAP_MASK);
|
||||
|
||||
|
@ -92,7 +92,7 @@ int main(int argc, char **argv) {
|
|||
printf("PCI Memory mapped to address %p.\n", map_base);
|
||||
fflush(stdout);
|
||||
|
||||
virt_addr = map_base + (target & MAP_MASK);
|
||||
virt_addr = (uint8_t*) map_base + (target & MAP_MASK);
|
||||
|
||||
switch(access_type) {
|
||||
case 'b':
|
||||
|
@ -109,7 +109,7 @@ int main(int argc, char **argv) {
|
|||
exit(2);
|
||||
}
|
||||
|
||||
printf("Value at offset %#jx (%p): %#x\n", (intmax_t) target, virt_addr, read_result);
|
||||
printf("Value at offset %#jx (%p): %#x\n", (uintmax_t) target, virt_addr, read_result);
|
||||
fflush(stdout);
|
||||
|
||||
if (argc > 4) {
|
||||
|
|
|
@ -135,7 +135,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
for (size_t i = 0; i*4 < bytesRead; i++) {
|
||||
int32_t ival = mem[cur][i];
|
||||
float fval = *((float*)(&ival));
|
||||
float fval = *((float*)(&ival)); // cppcheck-suppress invalidPointerCast
|
||||
//std::cerr << std::hex << ival << ",";
|
||||
std::cerr << fval << std::endl;
|
||||
/*int64_t ival = (int64_t)(mem[1] & 0xFFFF) << 48 |
|
||||
|
|
|
@ -118,11 +118,10 @@ Test(fpga, gpu_dma, .description = "GPU DMA tests")
|
|||
|
||||
if (dma != nullptr and dma->connectLoopback()) {
|
||||
memcpyFuncs.push_back({
|
||||
"DMA memcpy", [&]() {
|
||||
"DMA memcpy", [&] (){
|
||||
dma->makeAccesibleFromVA(src.getMemoryBlock());
|
||||
dma->makeAccesibleFromVA(dst.getMemoryBlock()));
|
||||
|
||||
dma->memcpy(src.getMemoryBlock(), dst.getMemoryBlock(), len);
|
||||
dma->makeAccesibleFromVA(dst.getMemoryBlock());
|
||||
dma->memcpy(src.getMemoryBlock(), dst.getMemoryBlock(), len);
|
||||
}});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue