Skip to content

Commit

Permalink
1st
Browse files Browse the repository at this point in the history
  • Loading branch information
nclack committed Aug 30, 2023
1 parent d4ebdfe commit b5203c9
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.cache
build
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "acquire-core-libs"]
path = acquire-core-libs
url = ../acquire-core-libs
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.5)
project(driver-tester)

set(NOTEST "TRUE")
add_subdirectory(acquire-core-libs)
set(NOTEST "FALSE")

add_subdirectory(src)
1 change: 1 addition & 0 deletions acquire-core-libs
Submodule acquire-core-libs added at edb33c
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set(tgt aq_drv_tester)
add_executable(${tgt} main.c)
target_link_libraries(${tgt} acquire-core-platform acquire-device-kit)
31 changes: 31 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "platform.h"
#include <printf.h>

#define L(lvl, file, line, func, ...) (printf(__VA_ARGS__))
#define LOG(...) L(0, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
#define LOGE(...) L(1, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
#define EXPECT(e, ...) \
do { \
if (!(e)) { \
LOGE(__VA_ARGS__); \
goto Error; \
} \
} while (0)
#define CHECK(e) EXPECT(e, "Expression evaluated as false:\n\t%s", #e)

void reporter(int is_error, const char *file, int line, const char *function,
const char *msg) {
printf("%5s: %s:%d - %s", is_error ? "Error" : "", file, line, function, msg);
}

typedef struct Driver *(*acquire_driver_init_v0)(
void (*reporter)(int is_error, const char *file, int line,
const char *function, const char *msg));

int main(int argc, char *argv[]) {
struct lib lib = {};
CHECK(lib_open_by_name(&lib, "acquire-driver-pvcam"));
lib_load(&lib, "acquire_driver_init_v0");
Error:
return 1;
}

0 comments on commit b5203c9

Please sign in to comment.