45 lines
983 B
C
45 lines
983 B
C
#ifndef _LOOPBACK_H_
|
|
#define _LOOPBACK_H_
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include "protocols/modbustcpslave.h"
|
|
#include "protocols/finsudpmaster.h"
|
|
#include "protocols/slmptcpmaster.h"
|
|
|
|
/* Loopback test debug message printout enable */
|
|
//#define _LOOPBACK_DEBUG_
|
|
/* DATA_BUF_SIZE define for Loopback example */
|
|
#ifndef DATA_BUF_SIZE
|
|
#define DATA_BUF_SIZE 2048
|
|
#endif
|
|
|
|
/************************/
|
|
/* Select LOOPBACK_MODE */
|
|
/************************/
|
|
#define LOOPBACK_MAIN_NOBLOCK 0
|
|
#define LOOPBACK_MODE LOOPBACK_MAIN_NOBLOCK
|
|
|
|
// 全局共享变量
|
|
extern uint16_t client_wait_timeout;
|
|
extern uint16_t comm_count;
|
|
extern uint16_t slmpTimegap;
|
|
extern uint16_t fins_timeout;
|
|
|
|
// 工具函数声明
|
|
void to_big_endian_16(uint16_t value, uint8_t *dest);
|
|
void to_big_endian_24(uint32_t value, uint8_t *dest);
|
|
|
|
// 顶层统一入口
|
|
void loopback_comm(uint8_t *ip, uint16_t port, uint8_t node);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|