#include <stdio.h>
#include <stdarg.h>

#if NRF_SDK_PRESENT

    #include "sdk_config.h"
    #include "nordic_common.h"
    #if NRF_MODULE_ENABLED(NRF_LOG)

        #include "nrf_log.h"
        #include "nrf_log_ctrl.h"
        
    #endif // NRF_SDK_PRESENT

#else

    #include "SEGGER_RTT.h"
    
#endif // NRF_MODULE_ENABLED(NRF_LOG)


#if DX_LINUX_PLATFORM
extern uint32_t g_free_mem_addr;
extern uint32_t *g_test_stack_base_addr;
extern uint32_t g_rom_base_addr;
extern uint32_t g_env_rom_base_addr;
#endif


SaSiError_t   mapEnvMemory(void);
void unmapMemory(void);
SaSiError_t integration_tests_setup(void);
void integration_tests_clear(void);


#define REG_BASE_ADR			DX_BASE_CC
#define REG_AREA_LEN			0x20000
#define ENV_REG_BASE_ADR		DX_BASE_ENV_REGS
#define ENV_REG_AREA_LEN		0x20000
#define SRAM_BASE_ADR			0
#define TEST_DATA_START_ADDRESS         sizeof(CRYS_RND_Context_t)+sizeof(CRYS_RND_WorkBuff_t)

/* Zynq EVBs have 1GB and we reserve the memory at offset 768M */
#define FREE_MEM_BASE_ADR             	0x20020000
#define CONTIG_FREE_MEM	                0x8000
/* Free memory is dedicated for SW image storage */
#define BOOT_FREE_MEM_BASE_ADR          FREE_MEM_BASE_ADR
#define BOOT_FREE_MEM_LEN		0x500000

/* user space follows the free memory, and uses for stack and workspace memory */
#define PTHREAD_STACK_BASE_ADR		(FREE_MEM_BASE_ADR + CONTIG_FREE_MEM)
#define PTHREAD_STACK_SIZE		16*1024

#define WORKSPACE_BASE_ADDR         (PTHREAD_STACK_BASE_ADR + PTHREAD_STACK_SIZE)

#if NRF_SDK_PRESENT
    #if NRF_MODULE_ENABLED(NRF_LOG)
        #define INTEG_TEST_PRINT(...)       NRF_LOG_INFO(__VA_ARGS__)
    #endif // NRF_MODULE_ENABLED(NRF_LOG)

#else 
    #define INTEG_TEST_PRINT(...)           SEGGER_RTT_printf(0, __VA_ARGS__)
#endif // NRF_SDK_PRESENT

