/* Main generated for Simulink Real-Time model SquareDebug */
#include <ModelInfo.hpp>
#include <utilities.hpp>
#include "SquareDebug.h"
#include "rte_SquareDebug_parameters.h"

/* Task wrapper function definitions */
void SquareDebug_Task1(void)
{ 
    SquareDebug_step0();
} 
void SquareDebug_Task2(void)
{ 
    SquareDebug_step1();
} 
void SquareDebug_Task3(void)
{ 
    SquareDebug_step2();
} 
void SquareDebug_Task4(void)
{ 
    SquareDebug_step3();
} 
/* Task descriptors */
slrealtime::TaskInfo task_1( 0u, std::bind(SquareDebug_Task1), slrealtime::TaskInfo::PERIODIC, 0.0001, 0, 40);
slrealtime::TaskInfo task_2( 1u, std::bind(SquareDebug_Task2), slrealtime::TaskInfo::PERIODIC, 0.5, 0, 39);
slrealtime::TaskInfo task_3( 2u, std::bind(SquareDebug_Task3), slrealtime::TaskInfo::PERIODIC, 1, 0, 38);
slrealtime::TaskInfo task_4( 3u, std::bind(SquareDebug_Task4), slrealtime::TaskInfo::PERIODIC, 2.5, 0, 37);

/* Executable base address for XCP */
#ifdef __linux__
extern char __executable_start;
static uintptr_t const base_address = reinterpret_cast<uintptr_t>(&__executable_start);
#else
/* Set 0 as placeholder, to be parsed later from /proc filesystem */
static uintptr_t const base_address = 0;
#endif

/* Model descriptor */
slrealtime::ModelInfo SquareDebug_Info =
{
    "SquareDebug",
    SquareDebug_initialize,
    SquareDebug_terminate,
    []()->char const*& { return SquareDebug_M->errorStatus; },
    []()->unsigned char& { return SquareDebug_M->Timing.stopRequestedFlag; },
    { task_1, task_2, task_3, task_4 },
    slrealtime::getSegmentVector()
};

int main(int argc, char *argv[]) {
    slrealtime::BaseAddress::set(base_address);
    return slrealtime::runModel(argc, argv, SquareDebug_Info);
}
