src/runtime_src/driver/zynq/user/shim.cpp
// This function is for internal mapping CU and debug IP only.
// For the future, this could be used to support any address aperture.
This function is for internal mapping CU and debug IP only.
For the future, this could be used to support any address aperture.
This function is for internal mapping CU and debug IP only . For the future this could be used to support any address aperture .
int ZYNQShim::mapKernelControl(const std::vector<std::pair<uint64_t, size_t>>& offsets) {
  void *ptr = NULL;
  if (offsets.size() == 0) {
    return 0;
  }
  auto offset_it = offsets.begin();
  auto end = offsets.end();
  while (offset_it != end) {
    auto it = mKernelControl.find(offset_it->first);
    if (it == mKernelControl.end()) {
      ptr = mmap(0, offset_it->second, PROT_READ | PROT_WRITE, MAP_SHARED, mKernelFD, offset_it->first);
      if (!ptr) {
          printf("Map failed for aperture 0x%lx, size 0x%x\n", offset_it->first, offset_it->second);
          return -1;
      }
      mKernelControl.insert(it, std::pair<uint64_t, uint32_t *>(offset_it->first, (uint32_t *)ptr));
    }
    offset_it++;
  }
  return 0;
}
int ZYNQShim :: mapKernelControl ( const std :: vector < std :: pair < uint64_t , size_t > > & offsets ) { void * ptr = NULL ; if ( offsets . size ( ) == 0 ) { return 0 ; } auto offset_it = offsets . begin ( ) ; auto end = offsets . end ( ) ; while ( offset_it != end ) { auto it = mKernelControl . find ( offset_it -> first ) ; if ( it == mKernelControl . end ( ) ) { ptr = mmap ( 0 , offset_it -> second , PROT_READ | PROT_WRITE , MAP_SHARED , mKernelFD , offset_it -> first ) ; if ( ! ptr ) { printf ( " \n " , offset_it -> first , offset_it -> second ) ; return -1 ; } mKernelControl . insert ( it , std :: pair < uint64_t , uint32_t * > ( offset_it -> first , ( uint32_t * ) ptr ) ) ; } offset_it ++ ; } return 0 ; }
This function is for internal mapping CU and debug IP only.
This function is for internal mapping CU and debug IP only .
// The offsets list is empty. Just skip mapping.