Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump to latest GR4.0-alpha #140

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ if (NOT DEFINED GR_DIGITIZERS_TOPLEVEL_PROJECT)
endif ()
endif ()

if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") # set default C++ STL to Clang's libc++ when using Clang
add_compile_options(-stdlib=libc++ -fcolor-diagnostics)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++")
set(CLANG true)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-fdiagnostics-color=always)
endif()

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)

include(cmake/CMakeRC.cmake)
Expand All @@ -21,7 +29,7 @@ set(ENABLE_TESTING OFF)
FetchContent_Declare(
graph-prototype
GIT_REPOSITORY https://github.com/fair-acc/graph-prototype.git
GIT_TAG c9b2dd33dcfaf7ab56dc6b1c42b73f46e7dfc001 # main as of 2024-02-01
GIT_TAG ed9738d809d4f89ddbbee49fd9a3bbd87c27bfab # main as of 2024-02-20
)

FetchContent_Declare(
Expand Down
11 changes: 5 additions & 6 deletions blocklib/picoscope/Picoscope.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,7 @@ struct Picoscope : public gr::Block<TPSImpl, gr::BlockingIO<true>, gr::Supported
}

if (ps_state.data_finished) {
std::atomic_store_explicit(&this->state, gr::lifecycle::State::STOPPED, std::memory_order_release);
this->state.notify_all();
this->requestStop();
this->publishTag({ { gr::tag::END_OF_STREAM, true } }, 0);
return { 0, 0, DONE };
}
Expand Down Expand Up @@ -495,14 +494,14 @@ struct Picoscope : public gr::Block<TPSImpl, gr::BlockingIO<true>, gr::Supported
processDriverData(std::size_t nrSamples, std::size_t offset) {
std::vector<std::size_t> triggerOffsets;

using ChannelOutputRange = decltype(ps_state.channels[0].data_writer.reserve_output_range(1));
using ChannelOutputRange = decltype(ps_state.channels[0].data_writer.reserve(1));
std::vector<ChannelOutputRange> channelOutputs;
channelOutputs.reserve(ps_state.channels.size());

for (std::size_t channelIdx = 0; channelIdx < ps_state.channels.size(); ++channelIdx) {
auto &channel = ps_state.channels[channelIdx];

channelOutputs.push_back(channel.data_writer.reserve_output_range(nrSamples));
channelOutputs.push_back(channel.data_writer.reserve(nrSamples));
auto &output = channelOutputs[channelIdx];

const auto driverData = std::span(channel.driver_buffer).subspan(offset, nrSamples);
Expand Down Expand Up @@ -543,7 +542,7 @@ struct Picoscope : public gr::Block<TPSImpl, gr::BlockingIO<true>, gr::Supported
if (tagsToWrite == 0) {
continue;
}
auto writeTags = channel.tag_writer.reserve_output_range(tagsToWrite);
auto writeTags = channel.tag_writer.reserve(tagsToWrite);
if (writeSignalInfo) {
// raw index is index - 1
writeTags[0].index = static_cast<int64_t>(ps_state.produced_worker - 1);
Expand Down Expand Up @@ -652,7 +651,7 @@ struct Picoscope : public gr::Block<TPSImpl, gr::BlockingIO<true>, gr::Supported

void
reportError(Error ec) {
auto out = ps_state.errors.writer.reserve_output_range(1);
auto out = ps_state.errors.writer.reserve(1);
out[0] = { ps_state.produced_worker, ec };
out.publish(1);
}
Expand Down
2 changes: 1 addition & 1 deletion blocklib/timing/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if (NOT EMSCRIPTEN)
if (NOT EMSCRIPTEN AND NOT CLANG)
add_library(timing INTERFACE)
target_include_directories(timing INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include/)

Expand Down
4 changes: 2 additions & 2 deletions blocklib/timing/include/timing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ class Timing {
static_assert(position + bitsize <= 64); // assert that we only consider existing bits
static_assert(std::numeric_limits<ReturnType>::max() >= ((1UL << bitsize) - 1)); // make sure the data fits into the return type
return static_cast<ReturnType>((value >> position) & ((1UL << bitsize) - 1));
};
}

template <std::size_t position, std::size_t bitsize, typename FieldType>
static constexpr uint64_t fromField(FieldType value) {
static_assert(position + bitsize <= 64);
static_assert(std::numeric_limits<FieldType>::max() >= ((1UL << bitsize) - 1));
return ((value & ((1UL << bitsize) - 1)) << position);
};
}

explicit Event(uint64_t timestamp = 0, uint64_t id = 1UL << 60, uint64_t param= 0, uint16_t _flags = 0, uint64_t _executed = 0) :
// id
Expand Down
7 changes: 4 additions & 3 deletions blocklib/timing/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function(add_ut_test TEST_NAME)
add_test(NAME ${TEST_NAME} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME})
endfunction()

add_ut_test(qa_timing)
target_link_libraries(qa_timing PRIVATE timing PkgConfig::saftlib PkgConfig::etherbone)

if(NOT EMSCRIPTEN AND NOT CLANG) ## clang/libc++ does not support the require <chrono> features to convert from TAI to UTC and 'std::views::enumerate'
add_ut_test(qa_timing)
target_link_libraries(qa_timing PRIVATE timing PkgConfig::saftlib PkgConfig::etherbone)
endif()
Loading