#ifndef __ONECHIP_BASIC_DEFINE_H_
#define __ONECHIP_BASIC_DEFINE_H_

#include <stddef.h>


#define ARR_LEN(array)(sizeof(array) / sizeof(array[0]))

#ifdef ONECHIP_GLOBAL_DEF_FLAG
#define   ONECHIP_GLOBAL_DEF
#else
#define   ONECHIP_GLOBAL_DEF extern
#endif


#define NAME_MAX_SIZE 32 /*执行单元名字最长限制*/

#define ERRDES_MAX_SIZE 32 /*执行单元名字最长限制*/

#ifndef THREAD_STACKSIZE
#define THREAD_STACKSIZE (int)1024
#endif
#ifndef DEFAULT_THREAD_PRIO_ONECHIP
#define DEFAULT_THREAD_PRIO_ONECHIP (int)2
#endif

#define PROTOCOVERDEF(ver) "V_J_"#ver
#define DEVICENAMEDEF(dev) "ONECHIP_"#dev


#define ONECHIP_NOCONFIG  0xffffffff
#define ONECHIP_CONFIG_FLAG  0xffffffff


#define ONECHIP_FLAOT_COMPARE_ZERO  (float)0.001

//16位大小端转换的宏
#define ONECHIP_htons(A) ((((uint16_t)(A) & 0xff00 ) >> 8 )|\
                  (((uint16_t)(A) & 0x00ff ) << 8))
//32位大小端转换宏
#define ONECHIP_htonl(A) ((((uint32_t)(A) & 0xff000000 ) >> 24) |\
				  (((uint32_t)(A) & 0x00ff0000 ) >> 8 ) |\
				  (((uint32_t)(A) & 0x0000ff00 ) << 8 ) |\
				  (((uint32_t)(A) & 0x000000ff ) << 24))

#define NAME(n) #n



#endif //__ONECHIP_BASIC_DEFINE_H_

