MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/configuration/AddProcessor.hpp
2024-06-07 11:12:56 +03:00

46 lines
1.4 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* AddProcessor.hpp
*
* Created on: 17 июл. 2019 г.
* Author: titov
*/
#ifndef SOURCE_APPLICATION_ADDPROCESSOR_HPP_
#define SOURCE_APPLICATION_ADDPROCESSOR_HPP_
#include "Environment.hh"
#include "../systemic/Scheduler.hpp"
namespace configuration {
template<typename Processor>
void addProcessor( float proc_sampletime, std::size_t proc_size,
configuration::Environment & env, memories::allocator secure_ma );
}
template<typename Processor>
void configuration::addProcessor( float proc_sampletime,
std::size_t proc_size,
configuration::Environment & env,
std::pmr::memory_resource & secure_ma,
std::pmr::memory_resource & object_ma )
{
typedef systemic::SchedulerInterface<Processor> ProcessorInterface;
ProcessorInterface::setSampleTime(proc_sampletime);
systemic::ProcessInfo * table_proc = memories::instance_array<systemic::ProcessInfo>(
secure_ma, proc_size
);
std::pmr::memory_resource * object_ma_ptr = &object_ma;
ProcessorInterface * proc_intf = memories::instance_object<ProcessorInterface>(
env.static_object_ma, table_proc, proc_size, object_ma_ptr
);
env.scheduler.addProcessor( proc_intf, ProcessorInterface::tag );
}
#endif /* SOURCE_APPLICATION_ADDPROCESSOR_HPP_ */