初始提交
This commit is contained in:
61
cli/simulator/freertos/src/os_socket.c
Normal file
61
cli/simulator/freertos/src/os_socket.c
Normal file
@@ -0,0 +1,61 @@
|
||||
/****************************************************************************
|
||||
|
||||
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
|
||||
|
||||
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
|
||||
be copied by any method or incorporated into another program without
|
||||
the express written consent of Aerospace C.Power. This Information or any portion
|
||||
thereof remains the property of Aerospace C.Power. The Information contained herein
|
||||
is believed to be accurate and Aerospace C.Power assumes no responsibility or
|
||||
liability for its use in any way and conveys no license or title under
|
||||
any patent or copyright and makes no representation or warranty that this
|
||||
Information is free from patent or copyright infringement.
|
||||
|
||||
****************************************************************************/
|
||||
#include "os_socket.h"
|
||||
|
||||
uint32_t os_socket_bind(os_socket_t socket, os_sock_addr* sockaddr,
|
||||
uint32_t addrlen)
|
||||
{
|
||||
return FreeRTOS_bind(socket, sockaddr, addrlen);
|
||||
}
|
||||
|
||||
os_socket_t os_udpsocket()
|
||||
{
|
||||
return FreeRTOS_socket(FREERTOS_AF_INET, FREERTOS_SOCK_DGRAM,
|
||||
FREERTOS_IPPROTO_UDP);
|
||||
}
|
||||
|
||||
uint32_t os_setsock_recvtimeout_opt(os_socket_t socket, uint32_t timeout)
|
||||
{
|
||||
return FreeRTOS_setsockopt(socket, 0,
|
||||
SO_RCVTIMEO, &timeout, sizeof(timeout));
|
||||
}
|
||||
|
||||
uint32_t os_sock_bind(os_socket_t socket, os_sock_addr bind_address)
|
||||
{
|
||||
return FreeRTOS_bind(socket, &bind_address, sizeof(bind_address));
|
||||
}
|
||||
|
||||
uint32_t os_close_socket(os_socket_t socket)
|
||||
{
|
||||
return FreeRTOS_closesocket(socket);
|
||||
}
|
||||
|
||||
void get_local_address_configuration(uint32_t *ipaddress,
|
||||
uint32_t *netmask, uint32_t *gateway, uint32_t *dnsserver)
|
||||
{
|
||||
FreeRTOS_GetAddressConfiguration(ipaddress, netmask, gateway, dnsserver);
|
||||
}
|
||||
|
||||
int32_t os_recv_from(os_socket_t socket, void* buffer, size_t len,
|
||||
uint32_t flags, os_sock_addr* sockaddr, uint32_t *addrlen)
|
||||
{
|
||||
return FreeRTOS_recvfrom(socket, buffer, len, flags, sockaddr, addrlen);
|
||||
}
|
||||
|
||||
int32_t os_sendto(os_socket_t socket, void* buffer, size_t len, uint32_t flags,
|
||||
const os_sock_addr* destaddr, uint32_t addrlen)
|
||||
{
|
||||
return FreeRTOS_sendto(socket, buffer, len, flags, destaddr, addrlen);
|
||||
}
|
||||
Reference in New Issue
Block a user