VCLinux Library Documentation  3.13.0

Contiguous Memory

Contiguous Memory

These functions provide allocation and handling of contiguous memory needed for FPGA Operations like memory for images written by the sensor, etc. Cause is, in difference to our TI DSP based cameras, the memory handling at the ARM platform over a memory management unit (MMU). More...

+ Collaboration diagram for Contiguous Memory:

Functions

I32 vc_memctg_init (I32 *fdMem, char *memCtgDev)
 Opens the VCMemCtg Device for Memory Allocations. More...
 
I32 vc_memctg_deinit (I32 *fdMem)
 Closes the VCMemCtg Device for Memory Allocations. More...
 
I32 vc_memctg_baseinfo (U8 **zeroAddr, U32 *totalBytes, I32 fdMem)
 Overall Contiguous Memory Information over the VCMemCtg Device. More...
 
I32 vc_memctg_alloc (U8 **ptr, U32 requestByteSize, U32 *allocatedByteSize, I32 fdMem)
 Allocates Contiguous Memory over the VCMemCtg Device. More...
 
I32 vc_memctg_free (U8 **ptr, U32 requestByteSize, I32 fdMem)
 Frees Contiguous Memory over the VCMemCtg Device. More...
 
I32 vc_memctg_invalidate (U8 *ptr, U32 requestByteSize, I32 fdMem)
 Invalidate Contiguous Memory over the VCMemCtg Device. More...
 
I32 vc_memctg_flush (U8 *ptr, U32 requestByteSize, I32 fdMem)
 Flushes Cache Data to Contiguous Memory over the VCMemCtg Device. More...
 
I32 vc_memctg_containment_check (U8 *stPtr, U32 byteCount, I32 fdMem)
 Checks if Pointer and Range lies fully in the Contiguous Memory Area. More...
 
I32 vc_memctg_map (U8 toDeviceIff1, U8 *ptr, U32 requestByteSize, I32 fdMem)
 Map Contiguous Memory to Hardware over the VCMemCtg Device. More...
 

Detailed Description

On a positive note is the controlled termination of a program by a so-called segmentation fault if memory access is undefined, e.g. if one accesses an array element over an index which is out of bounds; and the ability to allocate large blocks in a fragmented memory. On a negative note is the overhead of sharing memory between independent processes and the not-guaranteed physically contiguous memory.

MMU Adressing and IPC

The image visualizes two behaviours of the MMU:

The first mentioned behaviour is bad for transferring image data from the sensor to the user accessible memory, since the FPGA Hardware needs one contiguous block of memory. So you have to use the address pointers initialized, for example, by the vc_capt_init() routine for image acquisition since they point to contiguously allocated memory. The second mentioned behaviour is important for sharing memory between, for example, the image transfer server and the image processing program. By using the address returned by vc_imgnet_attach(), you use memory which can be accessed by both, the image transfer server and your program, at any time, since it is declared as shared memory. Note, that shared memory for inter-process-communication does not need to be contiguous!

Function Documentation

◆ vc_memctg_init()

I32 vc_memctg_init ( I32 fdMem,
char *  memCtgDev 
)

This function opens the VCMem Device for Memory Allocations.

Parameters
memCtgDevYou may use the default define VCMemDev_Default.

◆ vc_memctg_deinit()

I32 vc_memctg_deinit ( I32 fdMem)

This function closes the VCMem Device for Memory Allocations.

◆ vc_memctg_baseinfo()

I32 vc_memctg_baseinfo ( U8 **  zeroAddr,
U32 totalBytes,
I32  fdMem 
)

This function returns the total contiguous memory area and the byte size over the VCMemCtg device.

◆ vc_memctg_alloc()

I32 vc_memctg_alloc ( U8 **  ptr,
U32  requestByteSize,
U32 allocatedByteSize,
I32  fdMem 
)

This function allocates contiguous memory over the VCMemCtg device. Due to its behaviour, the size is rounded to the next memory manager block size.

◆ vc_memctg_free()

I32 vc_memctg_free ( U8 **  ptr,
U32  requestByteSize,
I32  fdMem 
)

This function frees contiguous memory over the VCMemCtg device.

◆ vc_memctg_invalidate()

I32 vc_memctg_invalidate ( U8 ptr,
U32  requestByteSize,
I32  fdMem 
)

This function invalidates contiguous memory over the VCMemCtg device.

◆ vc_memctg_flush()

I32 vc_memctg_flush ( U8 ptr,
U32  requestByteSize,
I32  fdMem 
)

This function flushes cache data to contiguous memory over the VCMemCtg device.

◆ vc_memctg_containment_check()

I32 vc_memctg_containment_check ( U8 stPtr,
U32  byteCount,
I32  fdMem 
)

This function checks, if a given pointer and range lies fully in the contiguous memory area. However it does not check the Allocation state, or the membership to a specific block.

◆ vc_memctg_map()

I32 vc_memctg_map ( U8  toDeviceIff1,
U8 ptr,
U32  requestByteSize,
I32  fdMem 
)

This function maps contiguous memory to the hardware over the VCMemCtg device.