#ifndef __OSP_TYPE_DEF_H__
#define __OSP_TYPE_DEF_H__

#include "ucp_utility.h"

extern int g_ape_id;

typedef unsigned int        UINTPTR;
typedef void                sem_t;

//#define NULLPTR             (void *)(0)
#define MALLOC              osp_malloc
#define FREE                osp_free
#define STRCPY              strcpy

#define OSP_NELEMENTS(x)    ((sizeof(x)/sizeof((x)[0])))

#define OS_ENTER_CRITICAL()   smart_int_disable()
#define OS_EXIT_CRITICAL()    smart_int_enable()

#define OSP_DEBUG_POT(ape_id, idx)      (DBG_DDR_IDX_OSP_BASE + (ape_id*240) + idx)
#define OSP2_DEBUG_POT(ape_id, idx)     (DBG_DDR_IDX_OSP2_BASE + (ape_id*1024) + idx)

#if 0
#define CMD_DEBUG_LEVEL     (0)
#define ERR_DEBUG_LEVEL     (1)
#define WARNING_DEBUG_LEVEL (2)
#define RUN_DEBUG_LEVEL     (3)
#define DBG_DEBUG_LEVEL     (4)

#define PLOAD_EX_W(ptr) __ucps2_load_ext_mem((char*)ptr, f_W)
#define PLOAD_EX_S(ptr) __ucps2_load_ext_mem((char*)ptr, f_S)
#define PLOAD_EX_B(ptr) __ucps2_load_ext_mem((char*)ptr, f_B)

#define PLOAD_EX_V_W(ptr) __ucps2_load_ext_mem_v((char*)ptr, f_W)
#define PLOAD_EX_V_S(ptr) __ucps2_load_ext_mem_v((char*)ptr, f_S)
#define PLOAD_EX_V_B(ptr) __ucps2_load_ext_mem_v((char*)ptr, f_B)

#define PSTORE_EX_W(ptr, value) __ucps2_store_ext_mem((char*)ptr, value, f_W)
#define PSTORE_EX_S(ptr, value) __ucps2_store_ext_mem((char*)ptr, value, f_S)
#define PSTORE_EX_B(ptr, value) __ucps2_store_ext_mem((char*)ptr, value, f_B)
#endif

#endif

