/*
 * cap_comp.h
 *
 *  Created on: 19-08-2019
 *      Author: Krzysztof Jakubczyk
 */

#ifndef CAP_COMP_H_
#define CAP_COMP_H_

#include "tdefs.h"

struct cap_comp_logic
{
	float *I_comp[3];
	float *I_comp_prev[3];
	u16 *IL_buf[3];
	u16 *UL_buf[3];
	struct analog_in_params *I_params[3];
	struct analog_in_params *U_params[3];
	float mul;
};

struct cap_comp_io
{
	u32 IL1_buf_ptr_in;
	u32 IL1_params_ptr_in;
	u32 IL2_buf_ptr_in;
	u32 IL2_params_ptr_in;
	u32 IL3_buf_ptr_in;
	u32 IL3_params_ptr_in;
	u32 UL1_buf_ptr_in;
	u32 UL1_params_ptr_in;
	u32 UL2_buf_ptr_in;
	u32 UL2_params_ptr_in;
	u32 UL3_buf_ptr_in;
	u32 UL3_params_ptr_in;
	u32 IL1_comp_float_out;
	u32 IL2_comp_float_out;
	u32 IL3_comp_float_out;
	u32 IL1_comp_prev_float_out;
	u32 IL2_comp_prev_float_out;
	u32 IL3_comp_prev_float_out;
}__attribute__((__packed__));


struct cap_comp_params
{
	u32 bits;
	double k;
	double c;
}__attribute__((__packed__));

struct cap_comp_args
{
	struct cap_comp_io io;
	struct cap_comp_params params;
//	u16 crc;
}__attribute__((__packed__));

extern void cap_comp(void *args, void *logic);
extern int cap_comp_initlog(void *arguments, void *logic);

#endif
