Blame opae-libs/plugins/xfpga/xfpga.h

Packit 534379
// Copyright(c) 2018, 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
#ifndef __XFPGA_XFPGA_H__
Packit 534379
#define __XFPGA_XFPGA_H__
Packit 534379
Packit 534379
#include <stdint.h>
Packit 534379
Packit 534379
#include <opae/types.h>
Packit 534379
Packit 534379
#ifdef __cplusplus
Packit 534379
extern "C" {
Packit 534379
#endif // __cplusplus
Packit 534379
Packit 534379
fpga_result xfpga_fpgaOpen(fpga_token token, fpga_handle *handle, int flags);
Packit 534379
fpga_result xfpga_fpgaClose(fpga_handle handle);
Packit 534379
fpga_result xfpga_fpgaReset(fpga_handle handle);
Packit 534379
fpga_result xfpga_fpgaGetPropertiesFromHandle(fpga_handle handle,
Packit 534379
					      fpga_properties *prop);
Packit 534379
fpga_result xfpga_fpgaGetProperties(fpga_token token, fpga_properties *prop);
Packit 534379
fpga_result xfpga_fpgaUpdateProperties(fpga_token token, fpga_properties prop);
Packit 534379
fpga_result xfpga_fpgaWriteMMIO64(fpga_handle handle, uint32_t mmio_num,
Packit 534379
				  uint64_t offset, uint64_t value);
Packit 534379
fpga_result xfpga_fpgaReadMMIO64(fpga_handle handle, uint32_t mmio_num,
Packit 534379
				 uint64_t offset, uint64_t *value);
Packit 534379
fpga_result xfpga_fpgaWriteMMIO32(fpga_handle handle, uint32_t mmio_num,
Packit 534379
				  uint64_t offset, uint32_t value);
Packit 534379
fpga_result xfpga_fpgaReadMMIO32(fpga_handle handle, uint32_t mmio_num,
Packit 534379
				 uint64_t offset, uint32_t *value);
Packit 534379
fpga_result xfpga_fpgaWriteMMIO512(fpga_handle handle, uint32_t mmio_num,
Packit 534379
				  uint64_t offset, const void *value);
Packit 534379
fpga_result xfpga_fpgaMapMMIO(fpga_handle handle, uint32_t mmio_num,
Packit 534379
			      uint64_t **mmio_ptr);
Packit 534379
fpga_result xfpga_fpgaUnmapMMIO(fpga_handle handle, uint32_t mmio_num);
Packit 534379
fpga_result xfpga_fpgaEnumerate(const fpga_properties *filters,
Packit 534379
				uint32_t num_filters, fpga_token *tokens,
Packit 534379
				uint32_t max_tokens, uint32_t *num_matches);
Packit 534379
fpga_result xfpga_fpgaCloneToken(fpga_token src, fpga_token *dst);
Packit 534379
fpga_result xfpga_fpgaDestroyToken(fpga_token *token);
Packit 534379
fpga_result xfpga_fpgaGetNumUmsg(fpga_handle handle, uint64_t *value);
Packit 534379
fpga_result xfpga_fpgaSetUmsgAttributes(fpga_handle handle, uint64_t value);
Packit 534379
fpga_result xfpga_fpgaTriggerUmsg(fpga_handle handle, uint64_t value);
Packit 534379
fpga_result xfpga_fpgaGetUmsgPtr(fpga_handle handle, uint64_t **umsg_ptr);
Packit 534379
fpga_result xfpga_fpgaPrepareBuffer(fpga_handle handle, uint64_t len,
Packit 534379
				    void **buf_addr, uint64_t *wsid, int flags);
Packit 534379
fpga_result xfpga_fpgaReleaseBuffer(fpga_handle handle, uint64_t wsid);
Packit 534379
fpga_result xfpga_fpgaGetIOAddress(fpga_handle handle, uint64_t wsid,
Packit 534379
				   uint64_t *ioaddr);
Packit 534379
fpga_result xfpga_fpgaGetOPAECVersion(fpga_version *version);
Packit 534379
fpga_result xfpga_fpgaGetOPAECVersionString(char *version_str, size_t len);
Packit 534379
fpga_result xfpga_fpgaGetOPAECBuildString(char *build_str, size_t len);
Packit 534379
fpga_result xfpga_fpgaReadError(fpga_token token, uint32_t error_num,
Packit 534379
				uint64_t *value);
Packit 534379
fpga_result xfpga_fpgaClearError(fpga_token token, uint32_t error_num);
Packit 534379
fpga_result xfpga_fpgaClearAllErrors(fpga_token token);
Packit 534379
fpga_result xfpga_fpgaGetErrorInfo(fpga_token token, uint32_t error_num,
Packit 534379
				   struct fpga_error_info *error_info);
Packit 534379
fpga_result xfpga_fpgaCreateEventHandle(fpga_event_handle *event_handle);
Packit 534379
fpga_result xfpga_fpgaDestroyEventHandle(fpga_event_handle *event_handle);
Packit 534379
fpga_result xfpga_fpgaGetOSObjectFromEventHandle(const fpga_event_handle eh,
Packit 534379
						 int *fd);
Packit 534379
fpga_result xfpga_fpgaRegisterEvent(fpga_handle handle,
Packit 534379
				    fpga_event_type event_type,
Packit 534379
				    fpga_event_handle event_handle,
Packit 534379
				    uint32_t flags);
Packit 534379
fpga_result xfpga_fpgaUnregisterEvent(fpga_handle handle,
Packit 534379
				      fpga_event_type event_type,
Packit 534379
				      fpga_event_handle event_handle);
Packit 534379
fpga_result xfpga_fpgaAssignPortToInterface(fpga_handle fpga,
Packit 534379
					    uint32_t interface_num,
Packit 534379
					    uint32_t slot_num, int flags);
Packit 534379
fpga_result xfpga_fpgaAssignToInterface(fpga_handle fpga,
Packit 534379
					fpga_token accelerator,
Packit 534379
					uint32_t host_interface, int flags);
Packit 534379
fpga_result xfpga_fpgaReleaseFromInterface(fpga_handle fpga,
Packit 534379
					   fpga_token accelerator);
Packit 534379
fpga_result xfpga_fpgaReconfigureSlot(fpga_handle fpga, uint32_t slot,
Packit 534379
				      const uint8_t *bitstream,
Packit 534379
				      size_t bitstream_len, int flags);
Packit 534379
fpga_result xfpga_fpgaTokenGetObject(fpga_token token, const char *name,
Packit 534379
				     fpga_object *object, int flags);
Packit 534379
fpga_result xfpga_fpgaHandleGetObject(fpga_token handle, const char *name,
Packit 534379
				      fpga_object *object, int flags);
Packit 534379
fpga_result xfpga_fpgaObjectGetObject(fpga_object parent, const char *name,
Packit 534379
				      fpga_object *object, int flags);
Packit 534379
fpga_result xfpga_fpgaObjectGetObjectAt(fpga_object parent, size_t idx,
Packit 534379
					fpga_object *object);
Packit 534379
fpga_result xfpga_fpgaDestroyObject(fpga_object *obj);
Packit 534379
fpga_result xfpga_fpgaObjectGetType(fpga_object obj,
Packit 534379
				    enum fpga_sysobject_type *type);
Packit 534379
fpga_result xfpga_fpgaObjectGetName(fpga_object obj, char *name,
Packit 534379
				    size_t max_len);
Packit 534379
fpga_result xfpga_fpgaObjectGetSize(fpga_object obj, uint32_t *value,
Packit 534379
				    int flags);
Packit 534379
fpga_result xfpga_fpgaObjectRead(fpga_object obj, uint8_t *buffer,
Packit 534379
				 size_t offset, size_t len, int flags);
Packit 534379
fpga_result xfpga_fpgaObjectRead64(fpga_object obj, uint64_t *value, int flags);
Packit 534379
fpga_result xfpga_fpgaObjectWrite64(fpga_object obj, uint64_t value, int flags);
Packit 534379
fpga_result xfpga_fpgaSetUserClock(fpga_handle handle, uint64_t low_clk,
Packit 534379
				   uint64_t high_clk, int flags);
Packit 534379
fpga_result xfpga_fpgaGetUserClock(fpga_handle handle, uint64_t *low_clk,
Packit 534379
				   uint64_t *high_clk, int flags);
Packit 534379
Packit 534379
fpga_result xfpga_fpgaGetNumMetrics(fpga_handle handle,
Packit 534379
				   uint64_t *num_metrics);
Packit 534379
Packit 534379
fpga_result xfpga_fpgaGetMetricsInfo(fpga_handle handle,
Packit 534379
				   fpga_metric_info *metric_info,
Packit 534379
				   uint64_t *num_metrics);
Packit 534379
Packit 534379
fpga_result xfpga_fpgaGetMetricsByIndex(fpga_handle handle,
Packit 534379
				    uint64_t *metric_num,
Packit 534379
				    uint64_t num_metric_indexes,
Packit 534379
				    fpga_metric *metrics);
Packit 534379
Packit 534379
fpga_result xfpga_fpgaGetMetricsByName(fpga_handle handle,
Packit 534379
				    char **metrics_names,
Packit 534379
				    uint64_t num_metric_names,
Packit 534379
				    fpga_metric *metrics);
Packit 534379
Packit 534379
fpga_result xfpga_fpgaGetMetricsThresholdInfo(fpga_handle handle,
Packit 534379
			metric_threshold *metric_threshold,
Packit 534379
			uint32_t *num_thresholds);
Packit 534379
Packit 534379
#ifdef __cplusplus
Packit 534379
}
Packit 534379
#endif // __cplusplus
Packit 534379
Packit 534379
#endif // __XFPGA_XFPGA_H__