/*
 * log_state.c
 *
 *  Created on: 25-01-2017
 *      Author: Krzysztof Jakubczyk
 */

#include "tdefs.h"
#include "misc.h"

#include "log_state.h"
#include "helper.h"

int log_state_initlog(void *arguments, void *logic)
{
	struct log_state_args *args = (struct log_state_args *)arguments;
	struct log_state_logic *log = (struct log_state_logic *)logic;

	if(set_bit_ptr_mask(args->io.out,&log->out,&log->out_bit_mask))
		return -1;

	if(set_bit_ptr_mask(args->params.net_number,&log->in,&log->in_bit_mask))
		return -1;

	return 0;
}

void log_state(void *arguments, void *logic)
{
	struct log_state_logic *log = (struct log_state_logic *)logic;

	check_and_set_mask(*log->in & log->in_bit_mask, log->out, log->out_bit_mask);
}
