//----------------------------------------------------
/**
	\file		libsets.h
	\ingroup	libs
	\ingroup	all

	\brief		Definice podminenych prekladu a zakladnich definic
				knihoven. Kazda knihovna obsahujici podminene preklady
				musi byt v tomto seznamu uvedena se vsemi definicemi.
				Konkretni aplikace si ve sve kopii nastavi definice
				na potrebne hodnoty. Odkaz na inc je v ctktypes.h.
				Toto je zakladni seznam.
				<<< ALL >>>
			
	\author		ConTeK s.r.o., Ing. Vladimir Kastner
	\version	01.04
	\date		6.11.2010
*/
//----------------------------------------------------

#ifndef _LIB_SETS_INC_
#define _LIB_SETS_INC_


//--------------------------------------------------
/**
	\brief	Definice cilove platformy

	\node	MODEL	Definice modelu (MSVC, AVR, ARM7TDMI, ARM920T, ...)
			SUBMDL	Definice submodelu (ATMEGA32, ATMEGA128, AT90CAN128, AT91SAM7X256, AT91SAM7X512, AT91RM9200, ...)
			BOARD	Definice desky (CTBRD03, CTBRD03B, CPUARM01, CPUARM02, ...)

	\note	Podminene definice dle modelu, mimo modelu MSVC, a submodelu se zatim v knihovnach a aplikacich nevyuzivaji,
			knihovny jsou ulozeny v oddelenych adresarich
*/
//--------------------------------------------------

#ifndef SENS
  #error kompilovano pro nekompatibilni desku
#else
  #undef SENS
#endif

#define SENS

//--------------------------------------------------
/**
	\name	ALL

	\note	ALL_FINALIZE	je-li definovan,
				pak budou provadeny ukoncovaci funkce knihoven
*/
//--------------------------------------------------

//@{
#define ALL_FINALIZE			//!< Knihovny budou s ukoncovaci casti
//@}


//--------------------------------------------------
/**
	\brief	stmachine.h

	\param	STM_STACK_LENGTH		Velikost zasobniku automatu
	\param	STM_FIRSTPASS			Detekce prvniho pruchodu stavem
	\param	STM_TIMER				Moznost casovych prodlev
	\param	STM_CALL				Moznost stavovych podsekvenci
	\param	STM_REPEAT				Moznost opakovani stavovych sekvenci

	\note	pokud v nejakem stavovem automatu nechceme vyuzivat globalni nastaveni
			pak jej zmenime direktivami undef a define
*/
//--------------------------------------------------

#define STM_STACK_LENGTH		5	//!< Velikost zasobniku automatu
#define STM_FIRSTPASS				//!< Detekce prvniho pruchodu stavem
#define STM_TIMER					//!< Moznost casovych prodlev
#define STM_CALL					//!< Moznost stavovych podsekvenci
#define STM_REPEAT					//!< Moznost opakovani stavovych sekvenci
#define STM_STATE_NAMES				//!< Priradi stavum jmena, ktera se daji tisknout

//--------------------------------------------------
/**
	\brief	datadef.h, mindatadef.h

	\param	DTDEF_XML_TREE			Parametry aplikace jsou dany primo XML stromem
	\param	DTDEF_XML_PARAM			Parametry aplikace jsou vytvareny generatorem XML_CGen z XML
	\param	DTDEF_XML_CAN			Parametry aplikace pristupne pres CAN, je vygenerovana i jina datova zakladna pro CAN

	\param	DTDEF_XML_MINIMAL		Minimalni univerzalni datova struktura, bez udaju pro obrazeni - popisy, jednotky, formaty
	
	\param	DTDEF_MAX_TEXT_SIZE		Max. delka textoveho retezce - Desc ,Unit
	\param	DTDEF_MAX_VALUE_SIZE	Max. delka textoveho parametru - Param

	\param	DTDEF_SUPPORT_DOUBLE	Podpora double parametru
	\param	DTDEF_SUPPORT_FLOAT		Podpora float parametru
	\param	DTDEF_SUPPORT_64BIT		Podpora 64bitovych parametru
	\param	DTDEF_SUPPORT_SSTRING	Podpora sstring parametru, <0..31> znaku
	\param	DTDEF_SUPPORT_LSTRING	Podpora lstring parametru, <0..((32 * 32)-1)> znaku
*/
//--------------------------------------------------


//#define DTDEF_XML_TREE					//!< Parametry aplikace jsou dany primo XML stromem
#define DTDEF_XML_PARAM					//!< Parametry aplikace jsou vytvareny generatorem XML_CGen z XML
#define DTDEF_DEFAULT_XML
//#define DTDEF_ND_XML
//#define DTDEF_XML_CAN					//!< Parametry aplikace pristupne pres CAN, je vygenerovana i jina datova zakladna pro CAN
#define DTDEF_XML_MINIMAL				//!< Minimalni univerzalni datova struktura, bez udaju pro obrazeni - Desc, Unit, Help a formaty
//#define DTDEF_ARRAY_NAMES			4		//!< Pocet poli, u kterych je mozne pojmenovat kazdou polozku zvlast

#define DTDEF_PAR_STORE

#define DTDEF_SUPPORT_FLOAT				//!< Podpora float parametru
//#define DTDEF_SUPPORT_DOUBLE			//!< Podpora double parametru
//#define DTDEF_SUPPORT_64BIT				//!< Podpora 64bitovych parametru
//#define DTDEF_SUPPORT_DATATIME64		//!< Podpora 64bitovych TIME a DATATIME
//#define DTDEF_SUPPORT_SSTRING			//!< Podpora sstring parametru
//#define DTDEF_SUPPORT_LSTRING			//!< Podpora lstring parametru

 #define DTDEF_MAX_DESC_STRING_SIZE		24		//!< Maximalni velikost textoveho retezce - Desc, Unit, Help
 #define DTDEF_MAX_VALUE_STRING_SIZE	24		//!< Maximalni velikost textu ziskaneho prevodem hodnoty parametru na string

//--- automaticky generovane podminky --------------

#if defined(DTDEF_SUPPORT_SSTRING) || defined(DTDEF_SUPPORT_LSTRING)
 #define DTDEF_SUPPORT_STRING		//!< Podpora string parametru
#endif // defined(DTDEF_SUPPORT_SSTRING) || defined(DTDEF_SUPPORT_LSTRING)

//--------------------------------------------------

#ifdef DTDEF_SUPPORT_STRING				//!< Podpora string parametru
 #define DTDEF_VALUE_SSTRING_SIZE	31	//!< Velikost sstring <0..31> parametru - Param
 #define DTDEF_VALUE_LSTRING_SIZE	255	//!< Velikost lstring <0..((32 * 32)-1)> parametru - Param
#endif // DTDEF_SUPPORT_STRING

//--- automaticky generovane podminky --------------

#ifdef DTDEF_SUPPORT_STRING
 #define DTDEF_DESC_STRING_BUFF_SIZE	(DTDEF_DESC_STRING_SIZE + 1)	//!< Velikost bufferu pro retezce + "\0", Desc, Unit, Help
#endif // DTDEF_SUPPORT_STRING

#ifdef DTDEF_SUPPORT_SSTRING
 #define DTDEF_SSTRING_SIZE			DTDEF_VALUE_SSTRING_SIZE			//!< Velikost sstring
 #define DTDEF_SSTRING_BUFF_SIZE	(DTDEF_SSTRING_SIZE + 1)			//!< Velikost bufferu pro sstring + "\0"
#endif // DTDEF_SUPPORT_SSTRING

#ifdef DTDEF_SUPPORT_LSTRING
 #define DTDEF_LSTRING_SIZE			DTDEF_VALUE_LSTRING_SIZE			//!< Velikost lstring
 #define DTDEF_LSTRING_BUFF_SIZE	(DTDEF_LSTRING_SIZE + 1)			//!< Velikost bufferu pro lstring + "\0"
#endif // DTDEF_SUPPORT_LSTRING

#ifdef DTDEF_SUPPORT_LSTRING
 #define DTDEF_STRING_SIZE			DTDEF_LSTRING_SIZE					//!< Velikost obecneho stringu
 #define DTDEF_STRING_BUFF_SIZE		((((DTDEF_STRING_SIZE + 1)+ 31) >> 5) << 5)	//!< Velikost bufferu pro obecny string
#else
 #ifdef DTDEF_SUPPORT_SSTRING
  #define DTDEF_STRING_SIZE			DTDEF_SSTRING_SIZE					//!< Velikost obecneho stringu
  #define DTDEF_STRING_BUFF_SIZE	(DTDEF_STRING_SIZE + 1)				//!< Velikost bufferu pro obecny string
 #endif // DTDEF_SUPPORT_SSTRING
#endif // DTDEF_SUPPORT_LSTRING

//--------------------------------------------------
/**
	\brief	paramstore.h

	\param	PARAMSTORE_FLASHFS		K ukladani parametru se pouziva knihovna flashfs
	\param	NO_PST_TICK				Nebude se provadet PST tick
	\param	ONE_PARAM_MEM			PST i CONF parametry se budou ukladat do stejne pameti
	\param	PST_HEADER_ADDR			Offset PST parametru v pameti - kdyz probiha ukladani do stejne pameti,
									PST parametry jsou ukladany za CONF parametry.
*/
//--------------------------------------------------

//#define PARAMSTORE_FLASHFS						//!< K ukladani parametru se pouziva knihovna flashfs
//#define NO_PST_TICK							//!< Vypnuti ukladani PST parametru
//#define ONE_PARAM_MEM							//!< K ukladani parametru PST i CONF se pouziva jedna pamet

#define PST_HEADER_ADDR			0x00000040		//!< Offset hlavicky v pameti pro PST data (pamet fram)
//#define PST_HEADER_ADDR			0x00005000	//!< Offset hlavicky v pameti PST dat pro CPUARM01 (pamet sram)

//--------------------------------------------------
/**
	\brief	flashfs.h

	\param	FLASHFS_MAXPAGES		Max. pocet stranek (zavisi na typu dataflash)
*/
//--------------------------------------------------

#define FLASHFS_MAXPAGES		4096	//!< Max. pocet stranek

//--------------------------------------------------
/**
	\brief	comm.h

	\param	COMM_SMALL_BUFF_SIZE	je-li definovan,
				pak velikost bufferu bude max 255 byte =
				delka nejdelsi prijimane/odesilane zpravy.
				Neni-li definovan, pak max 65535 byte.
*/
//--------------------------------------------------

//#define COMM_SMALL_BUF_SIZE			//!< Max. velikost bufferu na 255 byte


//--------------------------------------------------
/**
	\brief	comm.h, comm.c

	\param	COMM_ERROR				Povoleni chybove zpravy
	\param	COMM_MSG_COUNTERS		Povoleni Send a Recv counteru (zakomentovat u bootloaderu)
*/
//--------------------------------------------------

#define COMM_ERROR						//!< Povoleni chybove zpravy
//#define COMM_MSG_COUNTERS				//!< Povoleni Send a Recv counteru

//--------------------------------------------------
/**
	\brief	dbguart.h, dbguart.c

	\param	DBGUART_ENABLE			Povoleni DBGUART
*/
//--------------------------------------------------

//#define DBGUART_ENABLE					//!< Povoleni DBGUART

//--------------------------------------------------
/**
	\brief	uart.h, uart.c

	\param	UART_MAX_BUFF_SIZE		Max. velikost bufferu pro prijem a vysilani

	\param	UART_ERROR				Povoleni chybove zpravy
	\param	UART_RS485				Povoleni dvoudratove RS485 komunikace
	\param	UART_ENABLE_1, UART_ENABLE_2,...	Povoleni prislusneho uartu
*/
//--------------------------------------------------

#define UART_MAX_BUFF_SIZE	10000		//!< Max. velikost bufferu pro prijem a vysilani

#define UART_ERROR						//!< Povoleni chybove zpravy
//#define UART_RS485						//!< Povoleni dvoudratove RS485 komunikace

#define UART_ENABLE_1					//!< Povoleni UART 1
#define UART_ENABLE_2					//!< Povoleni UART 2
//#define UART_ENABLE_3					//!< Povoleni UART 3
//#define UART_ENABLE_4					//!< Povoleni UART 4

//#define USART_ENABLE_1
#define USART_ENABLE_2

//--------------------------------------------------
/**
	\brief	vuart.h

	\param	VUART_MAX_BUFF_SIZE		Max. velikost prenasenych bloku dat
*/
//--------------------------------------------------

#define VUART_MAX_BUFF_SIZE	10000		//!< Max. velikost prenasenych bloku dat

//--------------------------------------------------
/**
	\brief	tcpclient.h

	\param	TCPCLIENT_MAX_BUFF_SIZE	Max. velikost prenasenych bloku dat
*/
//--------------------------------------------------

#define TCPCLIENT_MAX_BUFF_SIZE	10000	//!< Max. velikost prenasenych bloku dat

//--------------------------------------------------
/**
	\brief	uclp1a.c

	\param	UCLP1A_ERROR			Povoleni chybove zpravy
*/
//--------------------------------------------------

#define UCLP1A_ERROR					//!< Povoleni chybove zpravy

//--------------------------------------------------
/**
	\brief	uclp1c.c

	\param	UCLP1C_ERROR			Povoleni chybove zpravy
*/
//--------------------------------------------------

//#define UCLP1C_ERROR					//!< Povoleni chybove zpravy

//--------------------------------------------------
/**
	\brief	dbgwdef.h, dbgw.h, dbgw.c

	\param	DGBW_DEBUG				Povoleni sledovani ladicich promennych
	\param	DGBW_CACHE_ITEMCOUNT	Pocet polozek cache tabulky poctu polozek skupiny
*/
//--------------------------------------------------

#define DBGW_DEBUG						//!< Povoleni sledovani ladicich promennych
#define DBGW_CACHE_ITEMCOUNT	8		//!< Pocet polozek cache tabulky poctu polozek skupiny

//--------------------------------------------------
/**
	\brief	uctp.h, uctp.c, dbgmon.h

	\param	UCTP_MIN_BUF_SIZE		Min. delka zpravy, pro zpravy s promenou delkou dat
	\param	UCTP_MAX_BUF_SIZE		Max. delka zpravy
	\param	UCTP_MAX_TEXT_SIZE		Max. delka textoveho retezce
	\param	UCTP_MAX_PARAM_SIZE		Max. velikost parametru
	\param	UCTP_MAX_LOG_BUF_SIZE	Max. velikost Log buferu

	\param	UCTP_MST				Povoleni master komunikace
	\param	UCTP_SLV				Povoleni slave komunikace

	\param	UCTP_PARAM				Povoleni komunikace parametru
	\param	UCTP_BLOCK_PARAM		Povoleni blokoveho prenosu parametru
	\param	UCTP_BLOADER			Povoleni BLOADER komunikace
	\param	UCTP_TOUCH				Povoleni TOUCH komunikace
	\param	UCTP_MIN_BLOADER		Povoleni jen minimalni BootLoader komunikace
	\param	UCTP_RUNBOOT			Povoleni zpravy na spusteni bootloaderu z aplikace
	\param	UCTP_ERROR				Povoleni chybove zpravy
	\param	UCTP_SWINFO				Povoleni SW verze zpravy
	\param	UCTP_TSTMSG				Povoleni testovaci zpravy
	\param	UCTP_USERDEFINED		Povoleni uzivatelem definovane zpravy
	\param	UCTP_LOG				Povoleni Log komunikace
	\param	UCTP_DBG				Povoleni DBG komunikace
	\param	UCTP_DBG_TXT			Povoleni DBG s textovymi zpravami
	\param	UCTP_DBG_VID			Povoleni DBG s video komunikaci
	\param	UCTP_DBG_KEYB			Povoleni DBG s KEYB komunikaci
	\param	UCTP_DBG_BUTTON			Povoleni DBG s BUTTON zpravou
	\param	UCTP_DBGW				Povoleni DBGW komunikace sledovani/nastaveni promenych
	\param	UCTP_ANY				Povoleni callback cbAnyMsg pri kazde platne prijate zprave
*/
//--------------------------------------------------

#define UCTP_MIN_BUF_SIZE	1	//!< Min. delka zpravy, pro zpravy s promenou delkou dat
#define UCTP_MAX_BUF_SIZE	60	//!< Max. delka zpravy
#define UCTP_MAX_TEXT_SIZE	60	//!< Max. delka textoveho retezce
#define UCTP_MAX_PARAM_SIZE		sizeof(datavalue_t)	//!< Max. velikost parametru
#define UCTP_MAX_LOG_BUF_SIZE	1	//!< Max. velikost Log bufferu

//#define UCTP_MST				//!< master komunikace
#define UCTP_SLV				//!< slave komunikace

#define UCTP_PARAM						//!< Povoleni komunikace parametru
#define UCTP_BLOCK_PARAM				//!< Povoleni blokoveho prenosu parametru
//#define UCTP_PERIODICPARAM					//!< Periodicky prenos parametru
#ifdef UCTP_PERIODICPARAM
 #define UCTP_MAX_PERIODICPARAMARRAY_SIZE 8	//!< Maximalni pocet periodickych parametru
#endif //UCTP_PERIODICPARAM
//#define UCTP_TOUCH						//!< Povoleni TOUCH komunikace
//#define UCTP_BLOADER					//!< Povoleni BLOADER komunikace
//#define UCTP_MIN_BLOADER				//!< Povoleni jen minimalni BootLoader komunikace
#ifndef UCTP_MIN_BLOADER
 #define UCTP_RUNBOOT					//!< Povoleni zpravy na spusteni bootloaderu z aplikace
 #define UCTP_ERROR						//!< Povoleni chybove zpravy
#endif // UCTP_MIN_BLOADER

#define UCTP_SWINFO						//!< Povoleni SW verze zpravy
//#define UCTP_TSTMSG						//!< Povoleni testovaci zpravy
//#define UCTP_USERDEFINED				//!< Povoleni uzivatelem definovane zpravy

//#define UCTP_LOG						//!< Povoleni Log komunikace
//#define UCTP_DBG						//!< Povoleni DBG komunikace
//#define UCTP_DBG_TXT					//!< Povoleni DBG s textovymi zpravami
//#define UCTP_DBG_VID					//!< Povoleni DBG s video komunikaci
//#define UCTP_DBG_KEYB					//!< Povoleni DBG s KEYB komunikaci
//#define UCTP_DBG_BUTTON					//!< Povoleni DBG s BUTTON zpravou

//#define UCTP_DBGW						//!< Povoleni DBGW komunikace sledovani/nastaveni promenych

//#define UCTP_ANY						//!< Povoleni callback cbAnyMsg pri kazde platne prijate zprave

//! Velikost bufferu pro blokovy prenos parametru
#ifdef UCTP_BLOCK_PARAM
  #define UCTP_BLOCK_PARAM_BUFSIZE	256	//!< Velikost bufferu
  #define UCTP_BLOCK_PARAM_MAXCODES	(UCTP_BLOCK_PARAM_BUFSIZE / (sizeof(uint32_t) + sizeof(uint8_t)))	//!< Maximalni pocet zasilanych CODE parametru
#endif // UCTP_BLOCK_PARAM

//--- automaticky generovane podminky --------------
#if defined( UCTP_MST )
  #define UCTP_DATACOM
#endif

#if defined( UCTP_MST ) && defined( UCTP_DBG )
  #define UCTP_MST_DBG		//!< master s DBG komunikaci
#endif // UCTP_MST && UCTP_DBG

#if defined( UCTP_SLV ) && defined( UCTP_DBG )
  #define UCTP_SLV_DBG		//!< slave s DBG komunikaci
#endif // UCTP_SLV && UCTP_DBG

#if defined( UCTP_MST ) || defined( UCTP_DBG_KEYB )
  #define UCTP_MST_KEYB				//!< master nebo KEYB
#endif // UCTP_MST || UCTP_DBG_KEYB

#if (defined( UCTP_MST ) && defined( UCTP_DBG_TXT )) || defined( UCTP_DBG_KEYB ) 
  #define UCTP_DBG_MST_TXT_KEYB	//!< (master a TXT) nebo KEYB
#endif // (UCTP_MST && UCTP_DBG_TXT) || UCTP_DBG_KEYB

#if defined( UCTP_MST ) && defined( UCTP_BLOADER )
  #define UCTP_MST_BLOADER
#endif // UCTP_MST && UCTP_BLOADER 

#if defined( UCTP_SLV ) && defined( UCTP_BLOADER )
  #define UCTP_SLV_BLOADER
#endif // UCTP_SLV && UCTP_BLOADER 

#if defined(UCTP_MST) && defined(UCTP_TOUCH)
  #define UCTP_MST_TOUCH
#endif // UCTP_MST && UCTP_TOUCH

#if defined(UCTP_SLV) && defined(UCTP_TOUCH)
  #define UCTP_SLV_TOUCH
#endif // UCTP_SLV && UCTP_TOUCH

//--------------------------------------------------
/**
	\brief	datacom.h, datacom.c

	\param	DCM_UPDATE_LIST_COUNT		Pocet update seznamu
	\param	DCM_UPDATE_LIST_MAX_SIZE	Maximalni pocet polozek v jednom update seznamu
*/
//--------------------------------------------------

#define DCM_UPDATE_LIST_COUNT		3
#define DCM_UPDATE_LIST_MAX_SIZE	16

//! Pocet update seznamu
#define DCM_UPDATE_READ_LIST_COUNT		1
#define DCM_UPDATE_WRITE_LIST_COUNT		1

//! Maximalni pocet polozek v jednom update seznamu
#define DCM_UPDATE_READ_LIST_MAX_SIZE	16
#define	DCM_UPDATE_WRITE_LIST_MAX_SIZE	16


//--------------------------------------------------
/**
	\brief	uprt.h, uprt.c

	\param	UPRT_MST				Povoleni master komunikace
	\param	UPRT_SLV				Povoleni slave komunikace
*/
//--------------------------------------------------

#define UPRT_MST						//<! Povoleni master komunikace
#define UPRT_SLV						//<! Povoleni slave komunikace

//--------------------------------------------------
/**
	\brief	umodbus.h, umodbus.c
*/
//--------------------------------------------------


//--------------------------------------------------
/**
	\brief	dbgmon.h

	\param	DBGMON_SPRINTF			Povoleni formatovaneho retezce
	\param	DBGMON_NOTEPAD			Povoleni notepadu
	\param	DBGMON_NOTEPAD_SIZE		Velikost notepadu (4bytove polozky)
*/
//--------------------------------------------------

#define DBGMON_SPRINTF					//!< Povoleni formatovaneho retezce
//#define DBGMON_NOTEPAD				//!< Podpora notepadu

#define DBGMON_NOTEPAD_SIZE		30	//!< Velikost notepadu (4bytove polozky)


//--------------------------------------------------
/**
	\brief	wintick.h

	\param	WINTICK_WTIMER			Provadeni WinTick pomoci WaitableTimer
*/
//--------------------------------------------------

#define WINTICK_WTIMER					//!< Provadeni WinTick pomoci WaitableTimer

//--------------------------------------------------
/**
	\brief	uctp.h

	\param	BLOADER_BLKSIZE			Velikost bloku komunikacnich dat boot loaderu

	\note	Takto definovano predevsim pro CPUARM01 (arm9), protoze tento
			parametr vyrazne ovlivnuje velikost bootloaderu. Ostatni desky
			(na procesorech, s vnitrni flash a s vetsi velikosti RAM) staci
			definovat BLOADER_BLKSIZE 528
*/
//--------------------------------------------------
#ifdef APP_RUN
 #define BLOADER_BLKSIZE	528 //264	//!< Velikost bloku komunikacnich dat boot loaderu
#elif RELOC_BLDR_RUN
 #define BLOADER_BLKSIZE	132			//!< Velikost bloku komunikacnich dat boot loaderu
#else
 #define BLOADER_BLKSIZE		66
#endif // RELOC_BLDR_RUN


//--------------------------------------------------
/**
	\brief	timeticks.h

	\param	TTCK_REALTICK			Vykonavani RealTick
	\param	TTCK_HWTICK				Vykonavani FastTick
	\param	TTCK_FASTTICK			Vykonavani FastTick
	\param	TTCK_SLOWTICK			Vykonavani SlowTick
	\param	TTCK_MAINTICK			Vykonavani MainTick

	\param	TTCK_REALTICK_MEASURE	Mereni doby RealTicku
	\param	TTCK_HWTICK_MEASURE		Mereni doby HWTick
	\param	TTCK_FASTTICK_MEASURE	Mereni doby FastTick
	\param	TTCK_SLOWTICK_MEASURE	Mereni doby SlowTick
	\param	TTCK_MAINTICK_MEASURE	Mereni doby MainTick
*/
//--------------------------------------------------

//#define TTCK_REALTICK					//<! Vykonavani RealTick
//#define TTCK_HWTICK						//<! Vykonavani HWTick
#define TTCK_FASTTICK					//<! Vykonavani FastTick
#define TTCK_SLOWTICK					//<! Vykonavani SlowTick
#define TTCK_MAINTICK					//<! Vykonavani MainTick

//#define TTCK_REALTICK_MEASURE			//<! Mereni doby RealTicku
//#define TTCK_HWTICK_MEASURE				//<! Mereni doby HWTicku
#define TTCK_FASTTICK_MEASURE			//<! Mereni doby FastTick
#define TTCK_SLOWTICK_MEASURE			//<! Mereni doby SlowTick
#define TTCK_MAINTICK_MEASURE			//<! Mereni doby MainTick

//--------------------------------------------------
/**
	\brief	sync.h

	\param	SYNC_FASTLOCK_MEASURE	Bude provadeno mereni doby FastLocku
*/
//--------------------------------------------------

//#define SYNC_FASTLOCK_MEASURE			//<! Mereni doby FastLocku

//--------------------------------------------------
/**
	\brief	hwboard.h

	\param	USE_HWCONFIG			Provedeni funkce HWConfigInitialize v HWBoardInitialize
	\param	USEHW_FLASH_INTERNAL	Pouziti interni FLASH
	\param	USEHW_FRAM				Pouziti FRRAM
	\param	USE_ACCEL				Pouziti akcelerometru
	\param	NO_HWTICK_DATAFLASH_A	Zakazani DataFlashTick A v HWTick
	\param	USEHW_DATAFLASH_B		Pouziti DATAFLASH B
	\param	NO_HWTICK_DATAFLASH_B	Zakazani DataFlashTick B v HWTick
	\param	USEHW_EEPROM			Pouziti EEPROM
	\param	USEHW_ADC				Pouziti ADC
	\param	USEHW_CAN				Pouziti CAN
	\param	USEHW_RTC				Pouziti RTC
	\param	USEHW_BRIDGE			Pouziti BRIDGE
	\param	USEHW_STEPPER_A			Pouziti krokoveho mtoru A
	\param	USEHW_STEPPER_B			Pouziti krokoveho mtoru B 
	\param	USEHW_DAC				Pouziti DAC
	\param	USEHW_DISPLAY			Pouziti displeje
	\param	USEHW_KEYBOARD			Pouziti klavesnice
*/
//--------------------------------------------------

//#define USE_HWCONFIG					//!< Provedeni funkce HWConfigInitialize v HWBoardInitialize

#define USEHW_FLASH_INTERNAL
#define USEHW_FRAM
//#define USE_ACCEL

//#define USEHW_DATAFLASH_A
#ifdef USEHW_DATAFLASH_A
//#define NO_HWTICK_DATAFLASH_A
#endif // USEHW_DATAFLASH_A

//#define USEHW_DATAFLASH_B
#ifdef USEHW_DATAFLASH_B
//#define NO_HWTICK_DATAFLASH_B
#endif // USEHW_DATAFLASH_B

//#define USEHW_EEPROM					//!< Pouziti EEPROM
//#define USEHW_ADC						//!< Pouziti ADC
//#define USEHW_CAN						//!< Pouziti CAN
//#define USEHW_RTC						//!< Pouziti RTC
//#define USEHW_BRIDGE					//!< Pouziti BRIDGE
//#define USEHW_STEPPER_A					//!< Pouziti krokoveho mtoru A
//#define USEHW_STEPPER_B					//!< Pouziti krokoveho mtoru B 
//#define USEHW_DAC						//!< Pouziti DAC
//#define USEHW_DISPLAY					//!< Pouziti displeje
//#define USEHW_KEYBOARD					//!< Pouziti klavesnice

//--------------------------------------------------
/**
	\brief	spi.h

	\param	SPI_ENABLE_0			Povoleni SPI 0
	\param	SPI_ENABLE_1			Povoleni SPI 1
	\param	SPI_INLINE				Spi transakce definovany jako inline funkce
	\param	SPI_BLOCK				Povoleni funkce pro blokujici operaci na SPI
	\param	SPI_IRQ					SPI transkace pres preruseni a DMA
	\param	SPI_URGENT				Umozni prerusit DMA transakci jinou
	\param	SPI_IRQ_OVERRIDE		Umozni nahradit implicitni preruseni urciteho kanalu svou metodou
*/
//--------------------------------------------------

//#define SPI_ENABLE_0					//!< Povoleni SPI 0
//#define SPI_ENABLE_1					//!< Povoleni SPI 1
//#define SPI_INLINE						//!< Spi transakce definovany jako inline funkce

//#define SPI_BLOCK						//!< Povoleni funkce pro blokujici operaci na SPI
//#define SPI_IRQ							//!< SPI transkace pres preruseni a DMA
//#define SPI_URGENT						//!< Umozni prerusit DMA transakci jinou
//#define SPI_IRQ_OVERRIDE				//!< Umozni nahradit implicitni preruseni urciteho kanalu svou metodou

//----------------------------------------------------
#if defined( SPI_URGENT ) && !defined( SPI_IRQ )
	#define SPI_IRQ
#endif

#if defined( SPI_IRQ ) && !defined( SPI_ENABLE_0 ) && !defined( SPI_ENABLE_1 )
	#error At least one SPI controller must be enabled in SPI_IRQ mode
#endif

#if defined( SPI_IRQ_OVERRIDE ) && !defined( SPI_IRQ )
	#define SPI_IRQ
#endif

//--------------------------------------------------
/**
	\brief	twim.h

	\param	TWI_ENABLE_0			Povoleni TWI 0
	\param	TWI_ENABLE_1			Povoleni TWI 1
	\param	TWI_MAX_CHANNELS		Pocet definovanych TWI kanalu
	\param	TWI_COMPARE				TWI podporuje porovnavani prijimanych dat se zadanym bufferem
	\param	TWI_FREQ				Pozadovana frekvence TWI v Hz
*/
//--------------------------------------------------

#define TWI_ENABLE_0					//!< Povoleni TWI 0
#define TWI_ENABLE_1					//!< Povoleni TWI 1
#define TWI_MAX_CHANNELS	3			//!< Pocet definovanych TWI kanalu
#define TWI_COMPARE						//!< TWI podporuje porovnavani prijimanych dat se zadanym bufferem
#define TWI_FREQ			400000		//!< Pozadovana frekvence TWI v Hz

//--------------------------------------------------
/**
	\brief	stepper.h

	\param	STEPPER_ENABLE			Povoleni krokoveho motoru
	\param	STEPPER_RAMPS			Podpora rampovani
*/
//--------------------------------------------------

//#define STEPPER_ENABLE					//!< Povoleni krokoveho motoru
//#define STEPPER_RAMPS					//!< Podpora rampovani

//--------------------------------------------------
/**
	\brief	FRAM

	\param	FRAM_VERIFY				FRAM podporuje porovnani obsahu pameti se zadanym bufferem
*/
//--------------------------------------------------

#define FRAM_VERIFY						//!< FRAM podporuje porovnani obsahu pameti se zadanym bufferem

//--------------------------------------------------
/**
	\brief	dataflash

	\param	DATAFLASH_LINEAR		Funkce vytvarejici linearni adresovy prostor nad dataflash, avsak omezujici velikost stranky na 256 bytu
	\param	DATAFLASH_PAGE			Funkce pristupuji k celym dataflash strankam
*/
//--------------------------------------------------

//#define DATAFLASH_LINEAR				//!< Funkce vytvarejici linearni adresovy prostor nad dataflash
//#define DATAFLASH_PAGE					//!< Funkce pristupuji k celym dataflash strankam

//--------------------------------------------------
/**
	\brief	CAN

	\param	CAN_ENABLE_0			Povoleni CAN 0
	\param	CAN_ENABLE_1			Povoleni CAN 1

	\param	CAN_MASKMB				Umozni definovat vice prijimacich mailboxu s maskami
	\param	CAN_RTR					Moznost pouzivat remote zpravy (producer/consumer)
	\param	CAN_USER_MBCOUNT		Pocet schranek pouzivanych pro prijem oblushovanych uzivatelem (pocitaji se rx, producer i consumer schranky)
	\param	CAN_RX_MBCOUNT			Pocet schranek pouzivanych pro automaticky prijem
	\param	CAN_TX_MBCOUNT			Pocet schranek pouzivanych pro vysilani
	\param	CAN_USE_HWBUF			Umozni pouzivani vetsiho mnozstvi prijimacich schranek, podminkou je, ze vsechny CAN buffery musi mit prostor pro 8 bytu dat
*/
//--------------------------------------------------

//#define CAN_ENABLE_0					//!< Povoleni CAN 0
//#define CAN_ENABLE_1					//!< Povoleni CAN 1

//#define CAN_MASKMB					//!< Umozni definovat vice prijimacich mailboxu s maskami
//#define CAN_RTR						//!< Moznost pouzivat remote zpravy (producer/consumer)
//#define CAN_USER_MBCOUNT		0	//!< Pocet schranek pouzivanych pro prijem oblushovanych uzivatelem (pocitaji se rx, producer i consumer schranky)
//#define CAN_RX_MBCOUNT			1	//!< Pocet schranek pouzivanych pro automaticky prijem
//#define	CAN_TX_MBCOUNT			1	//!< Pocet schranek pouzivanych pro vysilani

//#define CAN_USE_HWBUF				//!< Umozni pouzivani vetsiho mnozstvi prijimacich schranek, podminkou je, ze vsechny CAN buffery musi mit prostor pro 8 bytu dat

//----------------------------------------------------
#if (CAN_RX_MBCOUNT > 1) && !defined(CAN_USE_HWBUF)
	#error You must also define CAN_USE_HWBUF if you want more RX mailboxes
#endif

//--------------------------------------------------
/**
	\brief	J1939

	\param	J1939_RETRY_COUNT		Pocet opakovani zpravy P2P, pokud se ji nepodari prenest

	\param	J1939_PROPRIETARY_P2P	Podpora zpravy proprietary A
	\param	J1939_PROPRIETARY_BCAST	Podpora zpravy proprietary B

	\param	J1939_MULTI_BCAST		Podpora protokolu BAM
	\param	J1939_MULTI_P2P			Podpora protokolu RTS/CTS
	\param	J1939_ADDRESSCLAIM		Podpora protokolu address claim

	\param	J1939_FLOWCONTROL		Pridava moznost volit pocet paketu a prijeti spojeni P2P
	\param	J1939_REQUEST			Zprava request PGN + ACK

	\param	J1939_HVACR				Umozni nektere odchylky od normy J1939 definovane v HVACR CAN 
*/
//--------------------------------------------------

//#define J1939_RETRY_COUNT		2	//!< Pocet opakovani zpravy P2P, pokud se ji nepodari prenest

//#define J1939_PROPRIETARY_P2P		//!< Podpora zpravy proprietary A
//#define J1939_PROPRIETARY_BCAST		//!< Podpora zpravy proprietary B

//#define J1939_MULTI_BCAST			//!< Podpora protokolu BAM
//#define J1939_MULTI_P2P				//!< Podpora protokolu RTS/CTS
//#define J1939_ADDRESSCLAIM			//!< Podpora protokolu address claim

//#define J1939_FLOWCONTROL			//!< Pridava moznost volit pocet paketu a prijeti spojeni P2P
//#define J1939_REQUEST				//!< Zprava request PGN + ACK

//#define J1939_HVACR					//!< Umozni nektere odchylky od normy J1939 definovane v HVACR CAN

//----------------------------------------------------
//!
//!	\brief	Cisla mailboxu pro address claim
//@{

#ifdef J1939_ADDRESSCLAIM
 #define J1939_MB_BCAST		0
 #define J1939_MB_P2P		1
 #define J1939_MB_ALL		2
//@}
#endif // J1939_ADDRESSCLAIM

//----------------------------------------------------
#if !defined(J1939_MULTI_P2P) && defined(J1939_FLOWCONTROL)
	#undef J1939_FLOWCONTROL
#endif // !J1939_MULTI_P2P && J1939_FLOWCONTROL

//--------------------------------------------------
/**
	\brief	HWMODEL

	\param	THREAD_SAFE_LIB			Zajisti reentranci systemovych volani 
	\param	RUNBOOT_USE_FLASHKEY	Pri skoku do bootloaderu zapisuje klic do flash
									u cpuarm01 je metoda zapisu klice do dataflash v HWBOARD
*/
//--------------------------------------------------

#define THREAD_SAFE_LIB				//!< Zajisti reentranci systemovych volani 

#define RUNBOOT_USE_FLASHKEY		//!< Pri skoku do bootloaderu zapisuje klic do flash

//--------------------------------------------------
/**
	\brief	IOLIB

	\param	IO_ENABLE				Povoli knihovnu vstupu a vystupu
	\param	IO_TEST					Testovaci rezim k dispozici
*/
//--------------------------------------------------

#define IO_ENABLE					//!< Povoli knihovnu vstupu a vystupu
#define IO_TEST						//!< Testovaci rezim k dispozici

//--------------------------------------------------
/**
	\brief	XBUS
*/
//--------------------------------------------------

//#define XBUS_ENABLE					//!< Povoleni funkci XBUS
//#define XBUS_IRQ_ENABLE				//!< Povoleni preruseni XBUS
//#define XBUS_XMAIO01_IRQ_ENABLE		//!< Povoleni preruseni od desky XMAIO01

#if defined(XBUS_IRQ_ENABLE) && !defined(XBUS_ENABLE)
	#error "XBUS not enabled, but XBUS irq does"
#endif

#ifdef CTBRD03
	// nasledujici se tyka CTBRD03
//	#define IO_AO3_DISABLED		//!< 4. analogovy vystup nebude k dispozici
	#define IO_AO3_TIMER0		//!< 4. analogovy vystup bude 8bitove PWM rizene casovacem 0
//	#define IO_AO3_TIMER1		//!< 4. analogovy vystup bude 10bitove PWM rizene casovacem 1

	//----------------------------------------------------
	#if ((defined(TTCK_MAINTICK_MEASURE) \
				|| defined(TTCK_MAINTICK_MEASURE) \
				|| defined(TTCK_MAINTICK_MEASURE) \
				|| defined(TTCK_MAINTICK_MEASURE) \
				|| defined(SYNC_FASTLOCK_MEASURE)) \
			&& defined(IO_AO3_TIMER1))

		#error "Measuring of tick times is not possible with 10bit PWM on AO3 (timer conflict)"

	#endif

	//----------------------------------------------------
	#if (defined(IO_AO3_DISABLED) && defined(IO_AO3_TIMER0)) \
		|| (defined(IO_AO3_TIMER0) && defined(IO_AO3_TIMER1)) \
		|| (defined(IO_AO3_DISABLED) && defined(IO_AO3_TIMER1))

		#error Only one of IO_AO3_DISABLED, IO_AO3_TIMER0 and IO_AO3_TIMER1 can be defined

	#endif
#endif // CTBRD03

#ifdef CTBRD03B
	// nasledujici se tyka CTBRD03B
	
	#define CTBRD03B_OUTPUT_STS			//!< Povoli cteni stavovych signalu vystupu - od revize 1.3
	
#endif // CTBRD03B

//--------------------------------------------------
/**
	\brief	XmCore.h

	\param	XCR_REPEAT				Pocet opakovani zadosti
	\param	XCR_TIMEOUT				Timeout zadosti

*/
//--------------------------------------------------

#define	XCR_REPEAT				1	//!< Pocet opakovani master
#define	XCR_TIMEOUT				200	//!< Timeout master


//--------------------------------------------------
/**
	\brief	stmachine.h

*/
//--------------------------------------------------

#define STM_MAX_PRINTSTATE_LENGTH	64	//<! Maximalni delka retezce pro vypis nazvu stavu


//--------------------------------------------------
/**
	\brief	codepage.h

	\param	SYSTEM_CODEPAGE			Kodova stranka pouzivana systemem (operace s retezci)
	\param	UCTP_CODEPAGE			Kodova stranka pouzivana pri komunikaci pres UCTP
*/
//--------------------------------------------------

#define SYSTEM_CODEPAGE			CTK_CP_CSY_WINDOWS
#define UCTP_CODEPAGE			CTK_CP_CSY_WINDOWS
#define FONT_CODEPAGE			CTK_CP_CSY_WINDOWS

#if defined(UCTP_CODEPAGE) && !defined(SYSTEM_CODEPAGE)
	#error SYSTEM_CODEPAGE must be defined if UCTP_CODEPAGE is defined
#endif

//--------------------------------------------------
/**
	\brief	fonts.h
*/
//--------------------------------------------------

#define MAX_FONTS				3


//--------------------------------------------------
/**
	\brief	memclaim.h

	\param	MEMCLAIM_POOL_SIZE		Velikost pameti, ktera je k dispozici pro alokaci memclaimem
	\param	MEMCLAIM_ALIGN			Zarovnani alokovanych oblasti v bytech
*/
//--------------------------------------------------

#define MEMCLAIM_POOL_SIZE		2048		//!< Velikost pameti, ktera je k dispozici pro alokaci memclaimem
#define MEMCLAIM_ALIGN			4			//!< Zarovnani alokovanych oblasti v bytech

//--------------------------------------------------
/**
	\brief	priorities
*/
//--------------------------------------------------
#ifdef CORTEX

#define SUPC_IRQ_PRIORITY       6
#define RSTC_IRQ_PRIORITY       6
#define RTC_IRQ_PRIORITY        6
#define RTT_IRQ_PRIORITY        6
#define WDT_IRQ_PRIORITY        6
#define PMC_IRQ_PRIORITY        6
#define EFC_IRQ_PRIORITY        6
#define UART_IRQ_PRIORITY    	7
#define PIO_IRQ_PRIORITY       	0
#define USART_IRQ_PRIORITY      7
#define HSMCI_IRQ_PRIORITY      6
#define TWI_IRQ_PRIORITY       	7
#define SPI_IRQ_PRIORITY      	6
#define DMAC_IRQ_PRIORITY   	6
#define TC_IRQ_PRIORITY     	6
#define AFEC_IRQ_PRIORITY     	6
#define DACC_IRQ_PRIORITY     	6
#define ACC_IRQ_PRIORITY        6
#define ARM_IRQ_PRIORITY        6
#define UDP_IRQ_PRIORITY        6
#define PWM_IRQ_PRIORITY        6
#define CAN_IRQ_PRIORITY        6
#define AES_IRQ_PRIORITY        6
#define GMAC_IRQ_PRIORITY   	6

#endif // CORTEX

#endif // _LIB_SETS_INC_
