minor updates to opae runtime

This commit is contained in:
Blaise Tine 2024-07-25 12:38:17 -07:00
parent b9328754bc
commit 20ce870b1b
4 changed files with 14 additions and 29 deletions

View file

@ -25,15 +25,9 @@ SRCS = $(SRC_DIR)/vortex.cpp $(SRC_DIR)/driver.cpp
# set up target types
ifeq ($(TARGET), opaesim)
OPAESIM = $(DESTDIR)/libopae-c-sim.so
CXXFLAGS += -DOPAESIM -I$(SIM_DIR)/opaesim
LDFLAGS += -L$(DESTDIR) -lopae-c-sim
CXXFLAGS += -I$(SIM_DIR)/opaesim
else
CXXFLAGS += -I$(SYN_DIR)
ifeq ($(TARGET), asesim)
CXXFLAGS += -DASESIM
else
CXXFLAGS += -DFPGA
endif
endif
# Debugigng

View file

@ -22,13 +22,7 @@
#include <vector>
#include <sstream>
#ifdef OPAESIM
#define DEFAULT_OPAE_DRV_PATHS "libopae-c-sim.so"
#elif ASESIM
#define DEFAULT_OPAE_DRV_PATHS "libopae-c-ase.so"
#else
#define DEFAULT_OPAE_DRV_PATHS "libopae-c.so"
#endif
#define SET_API(func) \
opae_drv_funcs->func = (pfn_##func)dlsym(dl_handle, #func); \
@ -64,7 +58,7 @@ int drv_init(opae_drv_api_t* opae_drv_funcs) {
if (dl_handle)
break;
}
if (dl_handle == nullptr) {
printf("dlopen failed: %s\n", dlerror());
return -1;

View file

@ -1,10 +1,10 @@
// Copyright © 2019-2023
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -13,12 +13,7 @@
#pragma once
#ifndef OPAESIM
#include <opae/fpga.h>
#include <uuid/uuid.h>
#else
#include <fpga.h>
#endif
typedef fpga_result (*pfn_fpgaGetProperties)(fpga_token token, fpga_properties *prop);
typedef fpga_result (*pfn_fpgaPropertiesSetObjectType)(fpga_properties prop, fpga_objtype objtype);
@ -38,7 +33,7 @@ typedef fpga_result (*pfn_fpgaReadMMIO64)(fpga_handle handle, uint32_t mmio_num,
typedef const char *(*pfn_fpgaErrStr)(fpga_result e);
struct opae_drv_api_t {
pfn_fpgaGetProperties fpgaGetProperties;
pfn_fpgaGetProperties fpgaGetProperties;
pfn_fpgaPropertiesSetObjectType fpgaPropertiesSetObjectType;
pfn_fpgaPropertiesSetGUID fpgaPropertiesSetGUID;
pfn_fpgaDestroyProperties fpgaDestroyProperties;
@ -46,14 +41,14 @@ struct opae_drv_api_t {
pfn_fpgaDestroyToken fpgaDestroyToken;
pfn_fpgaPropertiesGetLocalMemorySize fpgaPropertiesGetLocalMemorySize;
pfn_fpgaOpen fpgaOpen;
pfn_fpgaClose fpgaClose;
pfn_fpgaPrepareBuffer fpgaPrepareBuffer;
pfn_fpgaReleaseBuffer fpgaReleaseBuffer;
pfn_fpgaOpen fpgaOpen;
pfn_fpgaClose fpgaClose;
pfn_fpgaPrepareBuffer fpgaPrepareBuffer;
pfn_fpgaReleaseBuffer fpgaReleaseBuffer;
pfn_fpgaGetIOAddress fpgaGetIOAddress;
pfn_fpgaWriteMMIO64 fpgaWriteMMIO64;
pfn_fpgaReadMMIO64 fpgaReadMMIO64;
pfn_fpgaErrStr fpgaErrStr;
pfn_fpgaReadMMIO64 fpgaReadMMIO64;
pfn_fpgaErrStr fpgaErrStr;
};
int drv_init(opae_drv_api_t* opae_drv_funcs);

View file

@ -12,9 +12,11 @@
// limitations under the License.
#include <common.h>
#include <vortex_afu.h>
#include "driver.h"
#include <vortex_afu.h>
#ifdef SCOPE
#include "scope.h"
#endif