/*
 * relay_out.h
 *
 *  Created on: 07-04-2014
 *      Author: Krzysztof Jakubczyk
 */

#ifndef RELAY_OUT_H_
#define RELAY_OUT_H_

#include "tdefs.h"

#define RELAY_OUT_UNTIL_CLR	0x01
#define RELAY_OUT_VIA_MSW	0x02

struct relay_out_logic
{
	u8 *in_ptr;
	u8 in_bit_mask;
	u8 *clr_ptr;
	u8 clr_bit_mask;
	u8 *kob_ptr;
	u8 kob_bit_mask;
	u16 kob_msw_bit_mask;
};

struct relay_out_io
{
	u32 in;  	 // one bit input for relay
	u32 clr_in;	 // clr bit input
	u32 kob_out; // kob bit output
}__attribute__((__packed__));

struct relay_out_params
{
	u32 card_addr;
	u32 relay_num;
	u32 bits;
}__attribute__((__packed__));


struct relay_out_args
{
	struct relay_out_io io;
	struct relay_out_params params;
//	u16 crc;
}__attribute__((__packed__));

extern void relay_out(void *args, void *logic);
extern int relay_out_initlog(void *arguments, void *logic);

#endif /* RELAY_OUT_H_ */
