//----------------------------------------------------
/**
	\file		ctk/hw/fram_fm24c.h
	\ingroup	hardware
	\ingroup	avr

	\brief		Knihovna pro pristup k FRAM pameti
				<<< AVR >>>

	\author		ConTeK s.r.o., Ing. Petr Cernin
	\version	01.01
	\date		12.01.2007
*/
//----------------------------------------------------

#ifndef _FRAM_FM24C_H_
#define _FRAM_FM24C_H_		//!< Definice pritomnosti knihovny

#include <nvmem.h>
#include <twim.h>
#include <ctktypes.h>

#define VERIFYBUF_SIZE		16

//----------------------------------------------------
//!	Kontext automatu ovladace FRAM

typedef struct _FRAM_CTX
{
	NVMEMDESC	Parent;
	TWIDESC		* Twi;
	bool_t		Verify;
	uint8_t		VerifyBuf[VERIFYBUF_SIZE];
} FRAM_CTX;


//----------------------------------------------------
/**
	\brief	Funkce pro inicializaci pristupu k nevolatilni pameti

	\param	memD	struktura kontextu automatu

	\return	TRUE	inicializace probehla v poradku
			FALSE	chyba
*/
//----------------------------------------------------

bool_t FramInitialize( FRAM_CTX * const _ctx, TWIDESC * const _twiCtx, const nvptr_t _memSize );


//----------------------------------------------------
/**
	\brief	Funkce pro ukonceni pristupu k nevolatilni pameti

	\param	memD		struktura kontextu automatu

	\return	TRUE	inicializace probehla v poradku
			FALSE	chyba
*/
//----------------------------------------------------

void FramFinalize( FRAM_CTX * const _ctx );

#endif // _FRAM_FM24C_H_
