Intel® FPGA SDK for OpenCL™ Standard Edition: Custom Platform Toolkit User Guide

ID 683398
Date 9/24/2018
Public
Document Table of Contents

2.3.11. aocl_mmd_shared_mem_alloc

The aocl_mmd_shared_mem_alloc function allocates shared memory between the host and the FPGA. The host accesses the shared memory via the pointer returned by aocl_mmd_shared_mem_alloc. The FPGA accesses the shared memory via device_ptr_out. If shared memory is not available, aocl_mmd_shared_mem_alloc returns NULL. If you do not reboot the CPU after you reprogram the FPGA, the shared memory will persist.

Syntax

void * aocl_mmd_shared_mem_alloc( int handle,
                                  size_t size,
                                  unsigned long long *device_ptr_out );

Function Arguments

  1. handle—A positive int value representing the handle to the board obtained from the aocl_mmd_open() call.

  2. size—The size of the shared memory that the function allocates. Declare size with the type size_t.

  3. device_ptr_out—The argument that receives the pointer value the device uses to access shared memory. The device_ptr_out is of type unsigned long long to handle cases where the host has a smaller pointer size than the device. The device_ptr_out argument cannot have a NULL value.

Return Value

If aocl_mmd_shared_mem_alloc executes successfully, the return value is the pointer value that the host uses to access the shared memory. Otherwise, the return value is NULL.