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"
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>UTCʱ<43>䳬ǰ<E4B3AC><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
#define GENERAL_LOCAL_TIME_SEC (8*60*60)
|
|||
|
|
|||
|
typedef enum
|
|||
|
{
|
|||
|
FLAG_LINK_DISCONN=0, //<2F><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܻ<EFBFBD><DCBB><EFBFBD>û<EFBFBD>н<EFBFBD><D0BD><EFBFBD>
|
|||
|
FLAG_LINK_CONN=1, //<2F><><EFBFBD>ӳɹ<D3B3>
|
|||
|
FLAG_LINK_DISCONN_DEAL=2, //<2F>ϲ<EFBFBD>Ӧ<EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>н<EFBFBD><D0BD><EFBFBD>
|
|||
|
FLAG_LINK_CONN_DEAL=3 //<2F>ϲ<EFBFBD>Ӧ<EFBFBD><D3A6>֪<EFBFBD><D6AA><EFBFBD><EFBFBD><EFBFBD>ӳɹ<D3B3>
|
|||
|
} 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; //Ԥ<>ȸ<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>ȡ<EFBFBD>ĸ<EFBFBD><C4B8>ݱ<EFBFBD>ֵ
|
|||
|
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]; //<2F><>֤<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
} HOST_INFO;
|
|||
|
|
|||
|
|
|||
|
/********* <20><><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD>λ *************/
|
|||
|
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 );
|
|||
|
|
|||
|
/*** <20><><EFBFBD>Ź<EFBFBD><C5B9><EFBFBD><EFBFBD>غ<EFBFBD><D8BA><EFBFBD> ***/
|
|||
|
ST_VOID enable_watchdog( ST_INT wtdTime );
|
|||
|
ST_VOID ack_watchdog( ST_VOID );
|
|||
|
ST_VOID free_watchdog( ST_VOID );
|
|||
|
|
|||
|
/*** <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>غ<EFBFBD><D8BA><EFBFBD> ***/
|
|||
|
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 );
|
|||
|
/***** ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>غ<EFBFBD><D8BA><EFBFBD> *****/
|
|||
|
|
|||
|
/************************************************************************/
|
|||
|
#ifdef __cplusplus
|
|||
|
}
|
|||
|
#endif
|
|||
|
|
|||
|
|
|||
|
#endif
|
|||
|
|