102 lines
2.8 KiB
C
102 lines
2.8 KiB
C
|
|
|
|
#ifndef GENERAL_FUNCTION_123_INCLUDED
|
|
#define GENERAL_FUNCTION_123_INCLUDED
|
|
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
/************************************************************************/
|
|
#include "glbtypes.h"
|
|
#include "glbsem.h"
|
|
|
|
//本地时间比UTC时间超前多少秒钟
|
|
#define GENERAL_LOCAL_TIME_SEC (8*60*60)
|
|
|
|
typedef enum
|
|
{
|
|
FLAG_LINK_DISCONN=0, //连接失败或者没有建立
|
|
FLAG_LINK_CONN=1, //连接成功
|
|
FLAG_LINK_DISCONN_DEAL=2, //上层应用处理过连接没有建立
|
|
FLAG_LINK_CONN_DEAL=3 //上层应用知道连接成功
|
|
} FLAG_LINK;
|
|
|
|
typedef enum
|
|
{
|
|
DEVICE_IP_ETH0=0,
|
|
DEVICE_IP_ETH1,
|
|
DEVICE_IP_ETH2
|
|
} DEVICE_IP_ETH;
|
|
|
|
#define GENERAL_ETH_MAX_NUM 8
|
|
|
|
typedef struct {
|
|
|
|
int ethNum; //预先赋值,获取的根据本值
|
|
char ethName[8];
|
|
|
|
char ipAddress[GENERAL_ETH_MAX_NUM][20];
|
|
char ipMask[GENERAL_ETH_MAX_NUM][20];
|
|
char ipMac[GENERAL_ETH_MAX_NUM][20];
|
|
|
|
char addChar[4]; //保证字符串结束
|
|
} HOST_INFO;
|
|
|
|
|
|
/********* 交换高低位 *************/
|
|
ST_VOID function_swap_32( ST_VOID * u32 );
|
|
ST_VOID function_swap_16( ST_VOID * u16 );
|
|
|
|
ST_RET function_get_local_cp56time( ST_UCHAR *timeBuf );
|
|
ST_RET function_set_local_cp56time( ST_UCHAR *timeBuf );
|
|
ST_RET function_cp24_cp56time( const ST_UCHAR *cp24, ST_UCHAR *cp56 );
|
|
ST_RET function_set_systime_2_hwclock( ST_VOID );
|
|
|
|
|
|
ST_RET gs_start_thread_with_vx( ST_CHAR *taskName, ST_INT priority, ST_INT stackSize,
|
|
ST_THREAD_RET ( ST_THREAD_CALL_CONV * threadFunc ) ( ST_THREAD_ARG ),
|
|
ST_THREAD_ARG threadArg,
|
|
ST_THREAD_HANDLE * threadHandleOut,
|
|
ST_THREAD_ID * threadIdOut );
|
|
|
|
ST_RET gs_stop_thread_with_vx( ST_THREAD_HANDLE threadHandle, ST_THREAD_ID threadId );
|
|
|
|
|
|
int function_assi2int( char c );
|
|
unsigned char function_hex2byte( char *c );
|
|
char function_ascii2char(ST_RET ethNum);
|
|
|
|
ST_RET function_getHostInfo( HOST_INFO *hostInfo );
|
|
|
|
/*** 看门狗相关函数 ***/
|
|
ST_VOID enable_watchdog( ST_INT wtdTime );
|
|
ST_VOID ack_watchdog( ST_VOID );
|
|
ST_VOID free_watchdog( ST_VOID );
|
|
|
|
/*** 开出相关函数 ***/
|
|
ST_VOID init_gpio( ST_VOID );
|
|
ST_VOID realse_gpio( ST_VOID );
|
|
ST_INT write_output( ST_INT doport,ST_INT state );
|
|
|
|
ST_RET function_set_system_ipaddress( ST_CHAR *ifName, ST_CHAR *ipAddr, ST_CHAR *netMask, ST_INT index );
|
|
ST_RET function_set_system_macaddress( ST_CHAR *ifName, ST_CHAR *macAddr, ST_INT index );
|
|
ST_RET function_set_system_macdown( ST_CHAR *ifName, ST_INT index );
|
|
ST_RET function_set_system_macup( ST_CHAR *ifName, ST_INT index );
|
|
ST_RET function_set_system_gwaddress( ST_CHAR *ifName, ST_CHAR *gwAddr );
|
|
|
|
ST_RET function_delete_file( const ST_CHAR *pathName );
|
|
ST_RET function_system_cmdline( const ST_CHAR *cmds );
|
|
|
|
ST_UINT function_get_disk_freesize( const ST_CHAR *pathName );
|
|
/***** 循环缓冲相关函数 *****/
|
|
|
|
/************************************************************************/
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
|
|
#endif
|
|
|