#include "xp_optlink_tms2tms.h"

#include "MemoryFunctions.h"
#include "Spartan2E_Adr.h"
#include "Spartan2E_Functions.h"
#include "xp_controller.h"



X_OPTLINK_TMS2TMS x_optlink_tms2tms_project = X_OPTLINK_TMS2TMS_DEFAULTS;

////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
// 
////////////////////////////////////////////////////////////////


void x_optlink_tms2tms_read_data(X_OPTLINK_TMS2TMS *v)
{
	volatile unsigned int d_wr;

//	v->data_receiver[0] = ReadMemory(ADR_FIRST_FREE + v->adr_table_read);
//	d_wr = v->;
//	WriteMemory(ADR_PARALLEL_BUS_CMD, d_wr);

}
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////



void x_optlink_tms2tms_write_data(X_OPTLINK_TMS2TMS *v)
{
	volatile unsigned int d_wr;


//	d_wr = v->;
//	WriteMemory(ADR_PARALLEL_BUS_CMD, d_wr);

}
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////



////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
// 
////////////////////////////////////////////////////////////////
void x_optlink_tms2tms_init(X_OPTLINK_TMS2TMS *v)
{
	if (v->flags.bit.init)
		return;
/*
	v->setup.size_table  = 0;//-1;
	v->setup.tms_adr_data_start  = ADR_FIRST_FREE;
	v->setup.tms_adr_data_finish = ADR_LAST_FREE;
	v->setup.setup_error_count_read = MAX_WAIT_ERROR_PARALLEL_BUS;

	v->flags.all		 = 0;

	v->slave_addr        = 0;
	v->reg_addr			 = 0;
	v->error_count_start = 0;
	v->count_read 		 = 0;

	v->stop(v);

	v->flags.bit.init = 1;
*/
}
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
// 
////////////////////////////////////////////////////////////////
/*
#pragma CODE_SECTION(x_parallel_bus_read_one_data,".fast_run");
void x_parallel_bus_read_one_data(X_OPTLINK_TMS2TMS *v)
{
// read data from parallel bus
//	v->data_table_read = ReadMemory(ADR_FIRST_FREE + v->adr_table_read);
}
*/
////////////////////////////////////////////////////////////////