#ifndef _MEMORY_FUNCTIONS_H
#define _MEMORY_FUNCTIONS_H


enum {RETURN_FLASHED_OK=0,
    RETURN_FLASHED_NOT_CLEAR_1,
    RETURN_FLASHED_NOT_CLEAR_2,
    RETURN_FLASHED_ERROR_AFTER_REPL,
    RETURN_FLASHED_ERROR_BEFORE_REPL_NOT_CLEAR,
    RETURN_FLASHED_ERROR
};

//#include "RS_Functions_modbus.h"

void WriteMemory(unsigned long addr, unsigned int data);
unsigned int ReadMemory(unsigned long addr);


//unsigned int RunFlashData(unsigned long AdrFrom,unsigned long AdrTo, unsigned long Length);
unsigned int RunFlashData(unsigned long AdrFrom, unsigned long AdrTo, unsigned long Length,
                          unsigned int *cerr_out, unsigned int *repl_out, unsigned int *count_ok_out);

unsigned int VerifyFlashData(unsigned long AdrFrom, unsigned long AdrTo, unsigned long Length,
                          unsigned int *cerr_out, unsigned int *repl_out, unsigned int *count_ok_out);



#define i_ReadMemory(addr)	        ReadMemory(addr)
#define i_WriteMemory(addr,data)	WriteMemory(addr,data)


//#define i_ReadMemory(addr)  (*(volatile int *)(addr))
//#define i_WriteMemory(addr,data)    {  (*(volatile int *)( addr )) = data; }


#endif
