/**
 * \file   system.h
 * \author Štefan Mišík
 * \date   March, 2014
 * \brief  System header file
 *
 * \details
 * In this file are defined all necessary header files and other
 */

#ifndef SYSTEM_H
#define SYSTEM_H

/* Includes ------------------------------------------------------------------*/
/* Microcontroller header files */
#include <stm32f4xx.h>
/* OS header files */
#include <FreeRTOS.h>
#include "FreeRTOSConfig.h"
#include <task.h>
#include <queue.h>
#include <semphr.h>

#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */

#define SYS_PLACE_BACKUPRAM __attribute__ ((section (".bkpram")))
#define SYS_PLACE_EXTMEM __attribute__ ((section (".memory_b1")))
#define SYS_PLACE_RAM1 __attribute__ ((section (".ram1")))
#define SYS_PLACE_RAM2 __attribute__ ((section (".ram2")))

#define SYS_SET_BITS(reg,mask,val)	\
	((val) ? ((reg) |= (mask)) : ((reg) &= (~(mask))))

#define SYS_SET_BIT(reg,bit,val)	\
	((val) ? ((reg) |= (1 << (bit))) : ((reg) &= (~(1 << (bit)))))

/**
 * \brief	Boolean variable
 */
typedef enum sys_bool_en
{
	FALSE = 0,
	TRUE = (!FALSE)
} bool_t;

/**
 * \brief	Enable/Disable state variable form stm32f4xx.h
 */
typedef FunctionalState state_t;


#ifdef __cplusplus
}
#endif /* __cplusplus */


#endif /* SYSTEM_H_ */
