Ensō 0.4.6
Software API reference
Loading...
Searching...
No Matches
ixy_helpers.cpp File Reference

Helper functions adapted from the ixy driver More...

#include <enso/consts.h>
#include <enso/ixy_helpers.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>
#include <cstdint>
#include <cstdio>
#include <iostream>
#include <string>

Go to the source code of this file.

Functions

uint64_t enso::virt_to_phys (void *virt)
 
void * enso::get_huge_page (const std::string &path, size_t size=0, bool mirror=false)
 

Detailed Description

Helper functions adapted from the ixy driver

Definition in file ixy_helpers.cpp.

Function Documentation

◆ get_huge_page()

void * enso::get_huge_page ( const std::string &  path,
size_t  size = 0,
bool  mirror = false 
)

Allocates a huge page and returns a pointer to it.

Huge pages are allocated to be kBufPageSize bytes in size.

Parameters
pathPath to huge page file.
sizeThe size of the huge page to be allocated. If 0, defaults to kBufPageSize.
mirrorWhether to mirror the huge page or not. Mirroring means that the same page is mapped again right after the allocated memory. This is useful to handle wrap-around in the buffers. Defaults to false.
Returns
A pointer to the allocated huge page.

Definition at line 82 of file ixy_helpers.cpp.

◆ virt_to_phys()

uint64_t enso::virt_to_phys ( void *  virt)

Converts a virtual address to a physical address.

Parameters
virtThe virtual address to convert.
Returns
The physical address.

Definition at line 51 of file ixy_helpers.cpp.