|
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 __OPAE_ADAPTER_H__
|
|
Packit |
534379 |
#define __OPAE_ADAPTER_H__
|
|
Packit |
534379 |
#include <stdbool.h>
|
|
Packit |
534379 |
|
|
Packit |
534379 |
#include <opae/types.h>
|
|
Packit |
534379 |
|
|
Packit |
534379 |
typedef struct _opae_plugin {
|
|
Packit |
534379 |
char *path; // location on file system
|
|
Packit |
534379 |
void *dl_handle; // handle to the loaded library instance
|
|
Packit |
534379 |
} opae_plugin;
|
|
Packit |
534379 |
|
|
Packit |
534379 |
typedef struct _opae_api_adapter_table {
|
|
Packit |
534379 |
|
|
Packit |
534379 |
struct _opae_api_adapter_table *next;
|
|
Packit |
534379 |
opae_plugin plugin;
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaOpen)(fpga_token token, fpga_handle *handle,
|
|
Packit |
534379 |
int flags);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaClose)(fpga_handle handle);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaReset)(fpga_handle handle);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaGetPropertiesFromHandle)(fpga_handle handle,
|
|
Packit |
534379 |
fpga_properties *prop);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaGetProperties)(fpga_token token,
|
|
Packit |
534379 |
fpga_properties *prop);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaUpdateProperties)(fpga_token token,
|
|
Packit |
534379 |
fpga_properties prop);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaWriteMMIO64)(fpga_handle handle, uint32_t mmio_num,
|
|
Packit |
534379 |
uint64_t offset, uint64_t value);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaReadMMIO64)(fpga_handle handle, uint32_t mmio_num,
|
|
Packit |
534379 |
uint64_t offset, uint64_t *value);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaWriteMMIO32)(fpga_handle handle, uint32_t mmio_num,
|
|
Packit |
534379 |
uint64_t offset, uint32_t value);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaReadMMIO32)(fpga_handle handle, uint32_t mmio_num,
|
|
Packit |
534379 |
uint64_t offset, uint32_t *value);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaWriteMMIO512)(fpga_handle handle, uint32_t mmio_num,
|
|
Packit |
534379 |
uint64_t offset, void *value);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaMapMMIO)(fpga_handle handle, uint32_t mmio_num,
|
|
Packit |
534379 |
uint64_t **mmio_ptr);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaUnmapMMIO)(fpga_handle handle, uint32_t mmio_num);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaEnumerate)(const fpga_properties *filters,
|
|
Packit |
534379 |
uint32_t num_filters, fpga_token *tokens,
|
|
Packit |
534379 |
uint32_t max_tokens,
|
|
Packit |
534379 |
uint32_t *num_matches);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaCloneToken)(fpga_token src, fpga_token *dst);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaDestroyToken)(fpga_token *token);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaGetNumUmsg)(fpga_handle handle, uint64_t *value);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaSetUmsgAttributes)(fpga_handle handle,
|
|
Packit |
534379 |
uint64_t value);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaTriggerUmsg)(fpga_handle handle, uint64_t value);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaGetUmsgPtr)(fpga_handle handle, uint64_t **umsg_ptr);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaPrepareBuffer)(fpga_handle handle, uint64_t len,
|
|
Packit |
534379 |
void **buf_addr, uint64_t *wsid,
|
|
Packit |
534379 |
int flags);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaReleaseBuffer)(fpga_handle handle, uint64_t wsid);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaGetIOAddress)(fpga_handle handle, uint64_t wsid,
|
|
Packit |
534379 |
uint64_t *ioaddr);
|
|
Packit |
534379 |
/*
|
|
Packit |
534379 |
** fpga_result (*fpgaGetOPAECVersion)(fpga_version *version);
|
|
Packit |
534379 |
**
|
|
Packit |
534379 |
** fpga_result (*fpgaGetOPAECVersionString)(char *version_str,
|
|
Packit |
534379 |
** size_t len);
|
|
Packit |
534379 |
**
|
|
Packit |
534379 |
** fpga_result (*fpgaGetOPAECBuildString)(char *build_str, size_t
|
|
Packit |
534379 |
** len);
|
|
Packit |
534379 |
*/
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaReadError)(fpga_token token, uint32_t error_num,
|
|
Packit |
534379 |
uint64_t *value);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaClearError)(fpga_token token, uint32_t error_num);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaClearAllErrors)(fpga_token token);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaGetErrorInfo)(fpga_token token, uint32_t error_num,
|
|
Packit |
534379 |
struct fpga_error_info *error_info);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
/*
|
|
Packit |
534379 |
** const char *(*fpgaErrStr)(fpga_result e);
|
|
Packit |
534379 |
*/
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaCreateEventHandle)(fpga_event_handle *event_handle);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaDestroyEventHandle)(fpga_event_handle *event_handle);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaGetOSObjectFromEventHandle)(
|
|
Packit |
534379 |
const fpga_event_handle eh, int *fd);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*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 |
|
|
Packit |
534379 |
fpga_result (*fpgaUnregisterEvent)(fpga_handle handle,
|
|
Packit |
534379 |
fpga_event_type event_type,
|
|
Packit |
534379 |
fpga_event_handle event_handle);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaAssignPortToInterface)(fpga_handle fpga,
|
|
Packit |
534379 |
uint32_t interface_num,
|
|
Packit |
534379 |
uint32_t slot_num, int flags);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaAssignToInterface)(fpga_handle fpga,
|
|
Packit |
534379 |
fpga_token accelerator,
|
|
Packit |
534379 |
uint32_t host_interface,
|
|
Packit |
534379 |
int flags);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaReleaseFromInterface)(fpga_handle fpga,
|
|
Packit |
534379 |
fpga_token accelerator);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaReconfigureSlot)(fpga_handle fpga, uint32_t slot,
|
|
Packit |
534379 |
const uint8_t *bitstream,
|
|
Packit |
534379 |
size_t bitstream_len, int flags);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaTokenGetObject)(fpga_token token, const char *name,
|
|
Packit |
534379 |
fpga_object *object, int flags);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaHandleGetObject)(fpga_handle handle, const char *name,
|
|
Packit |
534379 |
fpga_object *object, int flags);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaObjectGetObject)(fpga_object parent, const char *name,
|
|
Packit |
534379 |
fpga_object *object, int flags);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaObjectGetObjectAt)(fpga_object parent, size_t index,
|
|
Packit |
534379 |
fpga_object *object);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaDestroyObject)(fpga_object *obj);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaObjectRead)(fpga_object obj, uint8_t *buffer,
|
|
Packit |
534379 |
size_t offset, size_t len, int flags);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaObjectRead64)(fpga_object obj, uint64_t *value,
|
|
Packit |
534379 |
int flags);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaObjectGetSize)(fpga_object obj, uint64_t *value,
|
|
Packit |
534379 |
int flags);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaObjectGetType)(fpga_object obj,
|
|
Packit |
534379 |
enum fpga_sysobject_type *type);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaObjectWrite64)(fpga_object obj, uint64_t value,
|
|
Packit |
534379 |
int flags);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaSetUserClock)(fpga_handle handle, uint64_t high_clk,
|
|
Packit |
534379 |
uint64_t low_clk, int flags);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaGetUserClock)(fpga_handle handle, uint64_t *high_clk,
|
|
Packit |
534379 |
uint64_t *low_clk, int flags);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaGetNumMetrics)(fpga_handle handle, uint64_t *num_metrics);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*fpgaGetMetricsInfo)(fpga_handle handle,
|
|
Packit |
534379 |
fpga_metric_info *metric_info,
|
|
Packit |
534379 |
uint64_t *num_metrics);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
fpga_result (*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(*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(*fpgaGetMetricsThresholdInfo)(fpga_handle handle,
|
|
Packit |
534379 |
metric_threshold *metric_thresholds,
|
|
Packit |
534379 |
uint32_t *num_thresholds);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
// configuration functions
|
|
Packit |
534379 |
int (*initialize)(void);
|
|
Packit |
534379 |
int (*finalize)(void);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
// first-level query
|
|
Packit |
534379 |
bool (*supports_device)(const char *device_type);
|
|
Packit |
534379 |
bool (*supports_host)(const char *hostname);
|
|
Packit |
534379 |
|
|
Packit |
534379 |
} opae_api_adapter_table;
|
|
Packit |
534379 |
|
|
Packit |
534379 |
#endif /* __OPAE_ADAPTER_H__ */
|