/*
 * flashUtilities.h
 *
 *  Created on: 21.4.2010
 *      Author: hudo
 */

#ifndef FLASHUTILITIES_H_
#define FLASHUTILITIES_H_
/*********************************DEFINITIONS*********************************/

#define FLASH_PROGRAM_ADDR(x) \
  (*(volatile unsigned long *)(void *)(&__IPSBAR[(0x04000000 + (x))]))

#define FLASH_READ_ADDR(x) \
  (*(volatile unsigned long *)(void *) x)
#define	WRITELONGWORD	0x20
#define	PAGEERASE		0x40
#define TESTADDRESS		0x35801
#define TEMPADDRESS		0x36000

#define pocetFlashPremen 1

typedef struct {
	uint8 ip1;
	uint8 ip2;
	uint8 ip3;
	uint8 ip4;
	uint8 Maska1;
	uint8 Maska2;
	uint8 Maska3;
	uint8 Maska4;
	uint8 Gate1;
	uint8 Gate2;
	uint8 Gate3;
	uint8 Gate4;
}IpAdresa;


typedef const struct {
	IpAdresa ipAdresa;

}Nastavenia;

Nastavenia Settings;




/*****************************FUNCTION PROTOTYPES*****************************/
void CFMinit(void);
void SaveNastavenia(void);
void CFMrom2ram(uint32 address,uint32 value, uint32 command);
void CFMcommand(uint32 address, uint32 value, uint32 command);
void CFMcommandEND(void);

#endif /* FLASHUTILITIES_H_ */
