63 lines
1.6 KiB
C
63 lines
1.6 KiB
C
#ifndef _LOOPBACK_H_
|
|
#define _LOOPBACK_H_
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <stdint.h>
|
|
|
|
/* Loopback test debug message printout enable */
|
|
//#define _LOOPBACK_DEBUG_
|
|
//#define _LOOPBACK_DEBUG_S7_
|
|
/* DATA_BUF_SIZE define for Loopback example */
|
|
#ifndef DATA_BUF_SIZE
|
|
#define DATA_BUF_SIZE 2048
|
|
#endif
|
|
|
|
/************************/
|
|
/* Select LOOPBACK_MODE */
|
|
/************************/
|
|
//#define _LOOPBACK_DEBUG_SLMP_
|
|
#define LOOPBACK_MAIN_NOBLOCK 0
|
|
#define LOOPBACK_MODE LOOPBACK_MAIN_NOBLOCK
|
|
|
|
extern uint16_t client_wait_timeout;
|
|
extern uint16_t s7Timegap;
|
|
|
|
extern uint16_t comm_count;
|
|
extern _Bool comm_flag;
|
|
extern uint16_t slmpTimegap;
|
|
extern uint16_t fins_timeout;
|
|
void update_timeout_slmp();
|
|
|
|
typedef struct {
|
|
uint8_t buf[512];
|
|
_Bool done;
|
|
uint16_t size;
|
|
} RtuRxST;
|
|
|
|
/* TCP server Loopback test example */
|
|
int32_t loopback_tcps_modbus(uint8_t sn, uint16_t port);
|
|
|
|
int32_t loopback_tcps_modbus_to485(uint8_t sn, uint8_t *buf, uint16_t port, uint16_t *timeout, RtuRxST *rtu_rx);
|
|
|
|
/* TCP client Loopback test example */
|
|
int32_t loopback_tcpc_s7(uint8_t sn, uint8_t *recvbuf, uint8_t *destip, uint16_t destport);
|
|
|
|
/* UDP Loopback test example */
|
|
int32_t loopback_udps(uint8_t sn, uint8_t *buf, uint16_t port);
|
|
|
|
int32_t loopback_tcpc_slmp(uint8_t sn, uint8_t *destip, uint16_t destport);
|
|
|
|
void update_timeout_fins();
|
|
int32_t loopback_udpc_omrfins(uint8_t sn, uint8_t *destip, uint16_t destport, uint16_t local_node);
|
|
|
|
void loopback_comm(uint8_t *ip, uint16_t port, uint8_t node);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|