/*
 * batch_manager_ext.cpp
 *
 */


#include "batch_synch_ext.h"

#include "DataRecorder.h"

#include <string.h>

#include <stdint.h>

extern volatile batch_synch_ext_recorded_t batch_synch_ext_recorded;

static DataRecorder<batch_synch_ext_recorded_t> rpEifTT("EIFSYNCH", 0);

//Sorry: type (name only) dependency from EIF Rhapsody project

struct AvionicsDbgTimeSynch;
extern AvionicsDbgTimeSynch autoMonitorable_avsynch __attribute__((weak));

void EifBatchTimetagSynchRecorder()
{
	batch_synch_ext_recorded_t* d=const_cast<batch_synch_ext_recorded_t*>(&batch_synch_ext_recorded);

	if (reinterpret_cast<intptr_t>(&autoMonitorable_avsynch)!=0)
        memcpy(d->avbdata, &autoMonitorable_avsynch, sizeof d->avbdata);
	rpEifTT.save(*d);
}

void EifBatchTimetagSynchRecorderEnable(bool ena)
{
	rpEifTT.setEnable(ena);
}
