feat(lwip): Add socket UDP sync function

This commit is contained in:
Dong Heng
2018-07-26 14:28:33 +08:00
parent 8af3aa5ccf
commit cf46ba82be
7 changed files with 277 additions and 0 deletions

View File

@ -52,6 +52,10 @@
#define ESP_LWIP 1
#ifdef CONFIG_ESP_UDP_SYNC_SEND
#define ESP_UDP 1
#endif
#ifdef CONFIG_LWIP_SOCKET_MULTITHREAD
#define SOCKETS_MT
#endif
@ -2213,4 +2217,12 @@ void *memp_malloc_ll(size_t type);
* @}
*/
#if ESP_UDP
#if !LWIP_UDP || !LWIP_SOCKET || !ESP_LWIP
#error "LWIP_UDP & LWIP_SOCKET & ESP_LWIP must be enable"
#else
#include "udp_sync.h"
#endif
#endif
#endif /* __LWIP_HDR_LWIPOPTS_H__ */

View File

@ -0,0 +1,59 @@
// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _UDP_SYNC_H
#define _UDP_SYNC_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* @brief initialize UDP sync module
*/
void udp_sync_init(void);
/*
* @brief register a UDP API message(struct api_msg) to module
*
* @param in_msg message pointer
*/
void udp_sync_regitser(void *in_msg);
/*
* @brief ack the message
*
* @param in_msg message pointer
*/
void udp_sync_ack(void *in_msg);
/*
* @brief set the current message send result
*
* @param ret current message send result
*/
void udp_sync_set_ret(int ret);
/*
* @brief process the sync
*
* @param ret current message send result
*/
void udp_sync_proc(void);
#ifdef __cplusplus
}
#endif
#endif /* _UDP_SYNC_H */