|
Packit |
534379 |
// Copyright(c) 2017, Intel Corporation
|
|
Packit |
534379 |
//
|
|
Packit |
534379 |
// Redistribution and use in source and binary forms, with or without
|
|
Packit |
534379 |
// modification, are permitted provided that the following conditions are met:
|
|
Packit |
534379 |
//
|
|
Packit |
534379 |
// * Redistributions of source code must retain the above copyright notice,
|
|
Packit |
534379 |
// this list of conditions and the following disclaimer.
|
|
Packit |
534379 |
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
Packit |
534379 |
// this list of conditions and the following disclaimer in the documentation
|
|
Packit |
534379 |
// and/or other materials provided with the distribution.
|
|
Packit |
534379 |
// * Neither the name of Intel Corporation nor the names of its contributors
|
|
Packit |
534379 |
// may be used to endorse or promote products derived from this software
|
|
Packit |
534379 |
// without specific prior written permission.
|
|
Packit |
534379 |
//
|
|
Packit |
534379 |
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
Packit |
534379 |
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
Packit |
534379 |
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
Packit |
534379 |
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
Packit |
534379 |
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
Packit |
534379 |
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
Packit |
534379 |
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
Packit |
534379 |
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
Packit |
534379 |
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
Packit |
534379 |
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
Packit |
534379 |
// POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
534379 |
|
|
Packit |
534379 |
/**
|
|
Packit |
534379 |
* @file access.h
|
|
Packit |
534379 |
* @brief Functions to acquire, release, and reset OPAE FPGA resources
|
|
Packit |
534379 |
*/
|
|
Packit |
534379 |
|
|
Packit |
534379 |
#ifndef __FPGA_ACCESS_H__
|
|
Packit |
534379 |
#define __FPGA_ACCESS_H__
|
|
Packit |
534379 |
|
|
Packit |
534379 |
#include <opae/types.h>
|
|
Packit |
534379 |
|
|
Packit |
534379 |
#ifdef __cplusplus
|
|
Packit |
534379 |
extern "C" {
|
|
Packit |
534379 |
#endif
|
|
Packit |
534379 |
|
|
Packit |
534379 |
/**
|
|
Packit |
534379 |
* Open an FPGA object
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* Acquires ownership of the FPGA resource referred to by 'token'.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* Most often this will be used to open an accelerator object to directly interact
|
|
Packit |
534379 |
* with an accelerator function, or to open an FPGA object to perform
|
|
Packit |
534379 |
* management functions.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @param[in] token Pointer to token identifying resource to acquire
|
|
Packit |
534379 |
* ownership of
|
|
Packit |
534379 |
* @param[out] handle Pointer to preallocated memory to place a handle in.
|
|
Packit |
534379 |
* This handle will be used in subsequent API calls.
|
|
Packit |
534379 |
* @param[in] flags One of the following flags:
|
|
Packit |
534379 |
* * FPGA_OPEN_SHARED allows the resource to be opened
|
|
Packit |
534379 |
* multiple times (not supported in ASE)
|
|
Packit |
534379 |
* Shared resources (including buffers) are released
|
|
Packit |
534379 |
* when all associated handles have been closed
|
|
Packit |
534379 |
* (either explicitly with fpgaClose() or by process
|
|
Packit |
534379 |
* termination).
|
|
Packit |
534379 |
* @returns FPGA_OK on success. FPGA_NOT_FOUND if the resource for
|
|
Packit |
534379 |
* 'token' could not be found. FPGA_INVALID_PARAM if
|
|
Packit |
534379 |
* 'token' does not refer to a resource that can be
|
|
Packit |
534379 |
* opened, or if either argument is NULL or invalid.
|
|
Packit |
534379 |
* FPGA_EXCEPTION if an internal exception occurred while
|
|
Packit |
534379 |
* creating the handle. FPGA_NO_DRIVER if the driver is
|
|
Packit |
534379 |
* not loaded. FPGA_BUSY if trying to open a resource that
|
|
Packit |
534379 |
* has already been opened in exclusive mode.
|
|
Packit |
534379 |
* FPGA_NO_ACCESS if the current process' privileges are
|
|
Packit |
534379 |
* not sufficient to open the resource.
|
|
Packit |
534379 |
*/
|
|
Packit |
534379 |
fpga_result fpgaOpen(fpga_token token, fpga_handle *handle,
|
|
Packit |
534379 |
int flags);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
/**
|
|
Packit |
534379 |
* Close a previously opened FPGA object
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* Relinquishes ownership of a previously fpgaOpen()ed resource. This enables
|
|
Packit |
534379 |
* others to acquire ownership if the resource was opened exclusively.
|
|
Packit |
534379 |
* Also deallocates / unmaps MMIO and UMsg memory areas.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @param[in] handle Handle to previously opened FPGA object
|
|
Packit |
534379 |
* @returns FPGA_OK on success. FPGA_INVALID_PARAM if handle does
|
|
Packit |
534379 |
* not refer to an acquired resource, or if handle is NULL.
|
|
Packit |
534379 |
* FPGA_EXCEPTION if an internal error occurred while
|
|
Packit |
534379 |
* accessing the handle.
|
|
Packit |
534379 |
*/
|
|
Packit |
534379 |
fpga_result fpgaClose(fpga_handle handle);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
/**
|
|
Packit |
534379 |
* Reset an FPGA object
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* Performs an accelerator reset.
|
|
Packit |
534379 |
*
|
|
Packit |
534379 |
* @param[in] handle Handle to previously opened FPGA object
|
|
Packit |
534379 |
* @returns FPGA_OK on success. FPGA_INVALID_PARAM if handle does
|
|
Packit |
534379 |
* not refer to an acquired resource or to a resource that
|
|
Packit |
534379 |
* cannot be reset. FPGA_EXCEPTION if an internal error
|
|
Packit |
534379 |
* occurred while trying to access the handle or resetting
|
|
Packit |
534379 |
* the resource.
|
|
Packit |
534379 |
*/
|
|
Packit |
534379 |
fpga_result fpgaReset(fpga_handle handle);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
#ifdef __cplusplus
|
|
Packit |
534379 |
} // extern "C"
|
|
Packit |
534379 |
#endif // __cplusplus
|
|
Packit |
534379 |
|
|
Packit |
534379 |
#endif // __FPGA_ACCESS_H__
|