2 * Copyright (c) 2024 Hailo Technologies Ltd. All rights reserved.
3 * Distributed under the MIT license (https://opensource.org/licenses/MIT)
6 * @file ddr_action_list_buffer_builder.hpp
7 * @brief Class used to build the action list sent to the firmware through DDR.
9 #ifndef _HAILO_DDR_ACTION_LIST_BUFFER_BUILDER_HPP_
10 #define _HAILO_DDR_ACTION_LIST_BUFFER_BUILDER_HPP_
12 #include "hailo/hailort.h"
13 #include "context_switch_defs.h"
14 #include "core_op/resource_manager/action_list_buffer_builder/action_list_buffer_builder.hpp"
15 #include "vdma/memory/continuous_buffer.hpp"
17 #define DDR_ACTION_LIST_ENV_VAR ("HAILO_DDR_ACTION_LIST")
18 #define DDR_ACTION_LIST_ENV_VAR_VALUE ("1")
23 class DDRActionListBufferBuilder : public ActionListBufferBuilder {
25 DDRActionListBufferBuilder(vdma::ContinuousBuffer &&buffer);
26 virtual ~DDRActionListBufferBuilder() = default;
27 static Expected<std::shared_ptr<DDRActionListBufferBuilder>> create(size_t num_contexts, HailoRTDriver &driver);
29 virtual hailo_status write_action(MemoryView action, CONTROL_PROTOCOL__context_switch_context_type_t context_type,
30 bool is_new_context, bool last_action_buffer_in_context) override;
32 virtual uint64_t get_mapped_buffer_dma_address() const override;
34 vdma::ContinuousBuffer m_action_list_buffer;
35 // TODO: HRT-12512 : Can remove this check when / if continuous buffer comes from designated region
36 static bool verify_dma_addr(vdma::ContinuousBuffer &buffer);
37 size_t m_write_offset;
38 CONTROL_PROTOCOL__context_switch_context_info_chunk_t m_current_context_info;
41 } /* namespace hailort */
43 #endif /* _HAILO_DDR_ACTION_LIST_BUFFER_BUILDER_HPP_ */