Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
9d2bf9c4
Commit
9d2bf9c4
authored
Sep 30, 2014
by
Damien George
Browse files
drivers, wiznet5k: Wrap exported functions in a macro for renaming.
3rd party drivers should not export generic names like "close".
parent
3a1c4c5b
Changes
4
Hide whitespace changes
Inline
Side-by-side
drivers/wiznet5k/ethernet/socket.c
View file @
9d2bf9c4
...
...
@@ -87,7 +87,7 @@ static uint8_t sock_pack_info[_WIZCHIP_SOCK_NUM_] = {0,};
int8_t
socket
(
uint8_t
sn
,
uint8_t
protocol
,
uint16_t
port
,
uint8_t
flag
)
int8_t
WIZCHIP_EXPORT
(
socket
)
(
uint8_t
sn
,
uint8_t
protocol
,
uint16_t
port
,
uint8_t
flag
)
{
CHECK_SOCKNUM
();
switch
(
protocol
)
...
...
@@ -132,7 +132,7 @@ int8_t socket(uint8_t sn, uint8_t protocol, uint16_t port, uint8_t flag)
break
;
}
}
close
(
sn
);
WIZCHIP_EXPORT
(
close
)
(
sn
);
setSn_MR
(
sn
,
(
protocol
|
(
flag
&
0xF0
)));
if
(
!
port
)
{
...
...
@@ -150,7 +150,7 @@ int8_t socket(uint8_t sn, uint8_t protocol, uint16_t port, uint8_t flag)
return
(
int8_t
)
sn
;
}
int8_t
close
(
uint8_t
sn
)
int8_t
WIZCHIP_EXPORT
(
close
)
(
uint8_t
sn
)
{
CHECK_SOCKNUM
();
...
...
@@ -166,7 +166,7 @@ int8_t close(uint8_t sn)
return
SOCK_OK
;
}
int8_t
listen
(
uint8_t
sn
)
int8_t
WIZCHIP_EXPORT
(
listen
)
(
uint8_t
sn
)
{
CHECK_SOCKNUM
();
CHECK_SOCKMODE
(
Sn_MR_TCP
);
...
...
@@ -177,7 +177,7 @@ int8_t listen(uint8_t sn)
{
if
(
getSn_CR
(
sn
)
==
SOCK_CLOSED
)
{
close
(
sn
);
WIZCHIP_EXPORT
(
close
)
(
sn
);
return
SOCKERR_SOCKCLOSED
;
}
}
...
...
@@ -185,7 +185,7 @@ int8_t listen(uint8_t sn)
}
int8_t
connect
(
uint8_t
sn
,
uint8_t
*
addr
,
uint16_t
port
)
int8_t
WIZCHIP_EXPORT
(
connect
)
(
uint8_t
sn
,
uint8_t
*
addr
,
uint16_t
port
)
{
CHECK_SOCKNUM
();
CHECK_SOCKMODE
(
Sn_MR_TCP
);
...
...
@@ -236,7 +236,7 @@ int8_t connect(uint8_t sn, uint8_t * addr, uint16_t port)
return
SOCK_OK
;
}
int8_t
disconnect
(
uint8_t
sn
)
int8_t
WIZCHIP_EXPORT
(
disconnect
)
(
uint8_t
sn
)
{
CHECK_SOCKNUM
();
CHECK_SOCKMODE
(
Sn_MR_TCP
);
...
...
@@ -249,14 +249,14 @@ int8_t disconnect(uint8_t sn)
{
if
(
getSn_IR
(
sn
)
&
Sn_IR_TIMEOUT
)
{
close
(
sn
);
WIZCHIP_EXPORT
(
close
)
(
sn
);
return
SOCKERR_TIMEOUT
;
}
}
return
SOCK_OK
;
}
int32_t
send
(
uint8_t
sn
,
uint8_t
*
buf
,
uint16_t
len
)
int32_t
WIZCHIP_EXPORT
(
send
)
(
uint8_t
sn
,
uint8_t
*
buf
,
uint16_t
len
)
{
uint8_t
tmp
=
0
;
uint16_t
freesize
=
0
;
...
...
@@ -284,7 +284,7 @@ int32_t send(uint8_t sn, uint8_t * buf, uint16_t len)
}
else
if
(
tmp
&
Sn_IR_TIMEOUT
)
{
close
(
sn
);
WIZCHIP_EXPORT
(
close
)
(
sn
);
return
SOCKERR_TIMEOUT
;
}
else
return
SOCK_BUSY
;
...
...
@@ -297,7 +297,7 @@ int32_t send(uint8_t sn, uint8_t * buf, uint16_t len)
tmp
=
getSn_SR
(
sn
);
if
((
tmp
!=
SOCK_ESTABLISHED
)
&&
(
tmp
!=
SOCK_CLOSE_WAIT
))
{
close
(
sn
);
WIZCHIP_EXPORT
(
close
)
(
sn
);
return
SOCKERR_SOCKSTATUS
;
}
if
(
(
sock_io_mode
&
(
1
<<
sn
))
&&
(
len
>
freesize
)
)
return
SOCK_BUSY
;
...
...
@@ -315,7 +315,7 @@ int32_t send(uint8_t sn, uint8_t * buf, uint16_t len)
}
int32_t
recv
(
uint8_t
sn
,
uint8_t
*
buf
,
uint16_t
len
)
int32_t
WIZCHIP_EXPORT
(
recv
)
(
uint8_t
sn
,
uint8_t
*
buf
,
uint16_t
len
)
{
uint8_t
tmp
=
0
;
uint16_t
recvsize
=
0
;
...
...
@@ -336,13 +336,13 @@ int32_t recv(uint8_t sn, uint8_t * buf, uint16_t len)
if
(
recvsize
!=
0
)
break
;
else
if
(
getSn_TX_FSR
(
sn
)
==
getSn_TxMAX
(
sn
))
{
close
(
sn
);
WIZCHIP_EXPORT
(
close
)
(
sn
);
return
SOCKERR_SOCKSTATUS
;
}
}
else
{
close
(
sn
);
WIZCHIP_EXPORT
(
close
)
(
sn
);
return
SOCKERR_SOCKSTATUS
;
}
}
...
...
@@ -357,7 +357,7 @@ int32_t recv(uint8_t sn, uint8_t * buf, uint16_t len)
return
len
;
}
int32_t
sendto
(
uint8_t
sn
,
uint8_t
*
buf
,
uint16_t
len
,
uint8_t
*
addr
,
uint16_t
port
)
int32_t
WIZCHIP_EXPORT
(
sendto
)
(
uint8_t
sn
,
uint8_t
*
buf
,
uint16_t
len
,
uint8_t
*
addr
,
uint16_t
port
)
{
uint8_t
tmp
=
0
;
uint16_t
freesize
=
0
;
...
...
@@ -436,7 +436,7 @@ int32_t sendto(uint8_t sn, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t
int32_t
recvfrom
(
uint8_t
sn
,
uint8_t
*
buf
,
uint16_t
len
,
uint8_t
*
addr
,
uint16_t
*
port
)
int32_t
WIZCHIP_EXPORT
(
recvfrom
)
(
uint8_t
sn
,
uint8_t
*
buf
,
uint16_t
len
,
uint8_t
*
addr
,
uint16_t
*
port
)
{
uint8_t
mr
;
uint8_t
head
[
8
];
...
...
@@ -506,7 +506,7 @@ int32_t recvfrom(uint8_t sn, uint8_t * buf, uint16_t len, uint8_t * addr, uint16
sock_remained_size
[
sn
]
=
(
sock_remained_size
[
sn
]
<<
8
)
+
head
[
1
];
if
(
sock_remained_size
[
sn
]
>
1514
)
{
close
(
sn
);
WIZCHIP_EXPORT
(
close
)
(
sn
);
return
SOCKFATAL_PACKLEN
;
}
sock_pack_info
[
sn
]
=
PACK_FIRST
;
...
...
@@ -555,7 +555,7 @@ int32_t recvfrom(uint8_t sn, uint8_t * buf, uint16_t len, uint8_t * addr, uint16
}
int8_t
ctlsocket
(
uint8_t
sn
,
ctlsock_type
cstype
,
void
*
arg
)
int8_t
WIZCHIP_EXPORT
(
ctlsocket
)
(
uint8_t
sn
,
ctlsock_type
cstype
,
void
*
arg
)
{
uint8_t
tmp
=
0
;
CHECK_SOCKNUM
();
...
...
@@ -598,7 +598,7 @@ int8_t ctlsocket(uint8_t sn, ctlsock_type cstype, void* arg)
return
SOCK_OK
;
}
int8_t
setsockopt
(
uint8_t
sn
,
sockopt_type
sotype
,
void
*
arg
)
int8_t
WIZCHIP_EXPORT
(
setsockopt
)
(
uint8_t
sn
,
sockopt_type
sotype
,
void
*
arg
)
{
// M20131220 : Remove warning
//uint8_t tmp;
...
...
@@ -651,7 +651,7 @@ int8_t setsockopt(uint8_t sn, sockopt_type sotype, void* arg)
return
SOCK_OK
;
}
int8_t
getsockopt
(
uint8_t
sn
,
sockopt_type
sotype
,
void
*
arg
)
int8_t
WIZCHIP_EXPORT
(
getsockopt
)
(
uint8_t
sn
,
sockopt_type
sotype
,
void
*
arg
)
{
CHECK_SOCKNUM
();
switch
(
sotype
)
...
...
drivers/wiznet5k/ethernet/socket.h
View file @
9d2bf9c4
...
...
@@ -78,8 +78,11 @@
* Following figure shows network flow diagram by WIZnet SOCKET API.
* @image html WIZnet_SOCKET.jpg "<WIZnet SOCKET API>"
*/
#ifndef _SOCKET_H_
#define _SOCKET_H_
#ifndef _WIZCHIP_SOCKET_H_
#define _WIZCHIP_SOCKET_H_
// use this macro for exported names to avoid name clashes
#define WIZCHIP_EXPORT(name) wizchip_ ## name
#include
"wizchip_conf.h"
...
...
@@ -147,7 +150,7 @@
* @ref SOCKERR_SOCKMODE - Not support socket mode as TCP, UDP, and so on. \n
* @ref SOCKERR_SOCKFLAG - Invaild socket flag.
*/
int8_t
socket
(
uint8_t
sn
,
uint8_t
protocol
,
uint16_t
port
,
uint8_t
flag
);
int8_t
WIZCHIP_EXPORT
(
socket
)
(
uint8_t
sn
,
uint8_t
protocol
,
uint16_t
port
,
uint8_t
flag
);
/**
* @ingroup WIZnet_socket_APIs
...
...
@@ -159,7 +162,7 @@ int8_t socket(uint8_t sn, uint8_t protocol, uint16_t port, uint8_t flag);
* @return @b Success : @ref SOCK_OK \n
* @b Fail : @ref SOCKERR_SOCKNUM - Invalid socket number
*/
int8_t
close
(
uint8_t
sn
);
int8_t
WIZCHIP_EXPORT
(
close
)
(
uint8_t
sn
);
/**
* @ingroup WIZnet_socket_APIs
...
...
@@ -172,7 +175,7 @@ int8_t close(uint8_t sn);
* @b Fail :\n @ref SOCKERR_SOCKINIT - Socket is not initialized \n
* @ref SOCKERR_SOCKCLOSED - Socket closed unexpectedly.
*/
int8_t
listen
(
uint8_t
sn
);
int8_t
WIZCHIP_EXPORT
(
listen
)
(
uint8_t
sn
);
/**
* @ingroup WIZnet_socket_APIs
...
...
@@ -195,7 +198,7 @@ int8_t listen(uint8_t sn);
* @ref SOCKERR_TIMEOUT - Timeout occurred during request connection\n
* @ref SOCK_BUSY - In non-block io mode, it returned immediately\n
*/
int8_t
connect
(
uint8_t
sn
,
uint8_t
*
addr
,
uint16_t
port
);
int8_t
WIZCHIP_EXPORT
(
connect
)
(
uint8_t
sn
,
uint8_t
*
addr
,
uint16_t
port
);
/**
* @ingroup WIZnet_socket_APIs
...
...
@@ -212,7 +215,7 @@ int8_t connect(uint8_t sn, uint8_t * addr, uint16_t port);
* @ref SOCKERR_TIMEOUT - Timeout occurred \n
* @ref SOCK_BUSY - Socket is busy.
*/
int8_t
disconnect
(
uint8_t
sn
);
int8_t
WIZCHIP_EXPORT
(
disconnect
)
(
uint8_t
sn
);
/**
* @ingroup WIZnet_socket_APIs
...
...
@@ -232,7 +235,7 @@ int8_t disconnect(uint8_t sn);
* @ref SOCKERR_DATALEN - zero data length \n
* @ref SOCK_BUSY - Socket is busy.
*/
int32_t
send
(
uint8_t
sn
,
uint8_t
*
buf
,
uint16_t
len
);
int32_t
WIZCHIP_EXPORT
(
send
)
(
uint8_t
sn
,
uint8_t
*
buf
,
uint16_t
len
);
/**
* @ingroup WIZnet_socket_APIs
...
...
@@ -254,7 +257,7 @@ int32_t send(uint8_t sn, uint8_t * buf, uint16_t len);
* @ref SOCKERR_DATALEN - zero data length \n
* @ref SOCK_BUSY - Socket is busy.
*/
int32_t
recv
(
uint8_t
sn
,
uint8_t
*
buf
,
uint16_t
len
);
int32_t
WIZCHIP_EXPORT
(
recv
)
(
uint8_t
sn
,
uint8_t
*
buf
,
uint16_t
len
);
/**
* @ingroup WIZnet_socket_APIs
...
...
@@ -282,7 +285,7 @@ int32_t recv(uint8_t sn, uint8_t * buf, uint16_t len);
* @ref SOCKERR_TIMEOUT - Timeout occurred \n
* @ref SOCK_BUSY - Socket is busy.
*/
int32_t
sendto
(
uint8_t
sn
,
uint8_t
*
buf
,
uint16_t
len
,
uint8_t
*
addr
,
uint16_t
port
);
int32_t
WIZCHIP_EXPORT
(
sendto
)
(
uint8_t
sn
,
uint8_t
*
buf
,
uint16_t
len
,
uint8_t
*
addr
,
uint16_t
port
);
/**
* @ingroup WIZnet_socket_APIs
...
...
@@ -312,7 +315,7 @@ int32_t sendto(uint8_t sn, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t
* @ref SOCKERR_SOCKNUM - Invalid socket number \n
* @ref SOCKBUSY - Socket is busy.
*/
int32_t
recvfrom
(
uint8_t
sn
,
uint8_t
*
buf
,
uint16_t
len
,
uint8_t
*
addr
,
uint16_t
*
port
);
int32_t
WIZCHIP_EXPORT
(
recvfrom
)
(
uint8_t
sn
,
uint8_t
*
buf
,
uint16_t
len
,
uint8_t
*
addr
,
uint16_t
*
port
);
/////////////////////////////
...
...
@@ -399,7 +402,7 @@ typedef enum
* @return @b Success @ref SOCK_OK \n
* @b fail @ref SOCKERR_ARG - Invalid argument\n
*/
int8_t
ctlsocket
(
uint8_t
sn
,
ctlsock_type
cstype
,
void
*
arg
);
int8_t
WIZCHIP_EXPORT
(
ctlsocket
)
(
uint8_t
sn
,
ctlsock_type
cstype
,
void
*
arg
);
/**
* @ingroup WIZnet_socket_APIs
...
...
@@ -427,7 +430,7 @@ int8_t ctlsocket(uint8_t sn, ctlsock_type cstype, void* arg);
* - @ref SOCKERR_SOCKOPT - Invalid socket option or its value \n
* - @ref SOCKERR_TIMEOUT - Timeout occurred when sending keep-alive packet \n
*/
int8_t
setsockopt
(
uint8_t
sn
,
sockopt_type
sotype
,
void
*
arg
);
int8_t
WIZCHIP_EXPORT
(
setsockopt
)
(
uint8_t
sn
,
sockopt_type
sotype
,
void
*
arg
);
/**
* @ingroup WIZnet_socket_APIs
...
...
@@ -461,6 +464,6 @@ int8_t setsockopt(uint8_t sn, sockopt_type sotype, void* arg);
* When SO_PACKINFO value is PACK_FIRST and the return value of recvfrom() is zero,
* This means the zero byte UDP data(UDP Header only) received.
*/
int8_t
getsockopt
(
uint8_t
sn
,
sockopt_type
sotype
,
void
*
arg
);
int8_t
WIZCHIP_EXPORT
(
getsockopt
)
(
uint8_t
sn
,
sockopt_type
sotype
,
void
*
arg
);
#endif // _SOCKET_H_
#endif //
_WIZCHIP
_SOCKET_H_
drivers/wiznet5k/internet/dns/dns.c
View file @
9d2bf9c4
...
...
@@ -521,21 +521,21 @@ int8_t DNS_run(uint8_t * dns_ip, uint8_t * name, uint8_t * ip_from_dns)
hal_sys_tick
=
HAL_GetTick
();
// Socket open
socket
(
DNS_SOCKET
,
Sn_MR_UDP
,
0
,
0
);
WIZCHIP_EXPORT
(
socket
)
(
DNS_SOCKET
,
Sn_MR_UDP
,
0
,
0
);
#ifdef _DNS_DEBUG_
printf
(
"> DNS Query to DNS Server : %d.%d.%d.%d
\r\n
"
,
dns_ip
[
0
],
dns_ip
[
1
],
dns_ip
[
2
],
dns_ip
[
3
]);
#endif
len
=
dns_makequery
(
0
,
(
char
*
)
name
,
pDNSMSG
,
MAX_DNS_BUF_SIZE
);
sendto
(
DNS_SOCKET
,
pDNSMSG
,
len
,
dns_ip
,
IPPORT_DOMAIN
);
WIZCHIP_EXPORT
(
sendto
)
(
DNS_SOCKET
,
pDNSMSG
,
len
,
dns_ip
,
IPPORT_DOMAIN
);
while
(
1
)
{
if
((
len
=
getSn_RX_RSR
(
DNS_SOCKET
))
>
0
)
{
if
(
len
>
MAX_DNS_BUF_SIZE
)
len
=
MAX_DNS_BUF_SIZE
;
len
=
recvfrom
(
DNS_SOCKET
,
pDNSMSG
,
len
,
ip
,
&
port
);
len
=
WIZCHIP_EXPORT
(
recvfrom
)
(
DNS_SOCKET
,
pDNSMSG
,
len
,
ip
,
&
port
);
#ifdef _DNS_DEBUG_
printf
(
"> Receive DNS message from %d.%d.%d.%d(%d). len = %d
\r\n
"
,
ip
[
0
],
ip
[
1
],
ip
[
2
],
ip
[
3
],
port
,
len
);
#endif
...
...
@@ -556,10 +556,10 @@ int8_t DNS_run(uint8_t * dns_ip, uint8_t * name, uint8_t * ip_from_dns)
#ifdef _DNS_DEBUG_
printf
(
"> DNS Timeout
\r\n
"
);
#endif
sendto
(
DNS_SOCKET
,
pDNSMSG
,
len
,
dns_ip
,
IPPORT_DOMAIN
);
WIZCHIP_EXPORT
(
sendto
)
(
DNS_SOCKET
,
pDNSMSG
,
len
,
dns_ip
,
IPPORT_DOMAIN
);
}
}
close
(
DNS_SOCKET
);
WIZCHIP_EXPORT
(
close
)
(
DNS_SOCKET
);
// Return value
// 0 > : failed / 1 - success
return
ret
;
...
...
stmhal/modwiznet5k.c
View file @
9d2bf9c4
...
...
@@ -339,7 +339,7 @@ STATIC void wiznet5k_socket_print(void (*print)(void *env, const char *fmt, ...)
STATIC
mp_obj_t
wiznet5k_socket_close
(
mp_obj_t
self_in
)
{
wiznet5k_socket_obj_t
*
self
=
self_in
;
wiznet5k_obj
.
socket_used
&=
~
(
1
<<
self
->
sn
);
mp_int_t
ret
=
close
(
self
->
sn
);
mp_int_t
ret
=
WIZCHIP_EXPORT
(
close
)
(
self
->
sn
);
check_sock_return_value
(
ret
);
return
mp_const_none
;
}
...
...
@@ -352,7 +352,7 @@ STATIC mp_obj_t wiznet5k_socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
mp_uint_t
port
=
mod_network_parse_inet_addr
(
addr_in
,
ip
);
// open the socket in server mode
mp_int_t
ret
=
socket
(
self
->
sn
,
self
->
type
,
port
,
0
);
mp_int_t
ret
=
WIZCHIP_EXPORT
(
socket
)
(
self
->
sn
,
self
->
type
,
port
,
0
);
check_sock_return_value
(
ret
);
return
mp_const_none
;
...
...
@@ -361,7 +361,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(wiznet5k_socket_bind_obj, wiznet5k_socket_bind)
STATIC
mp_obj_t
wiznet5k_socket_listen
(
mp_obj_t
self_in
,
mp_obj_t
backlog
)
{
wiznet5k_socket_obj_t
*
self
=
self_in
;
mp_int_t
ret
=
listen
(
self
->
sn
);
mp_int_t
ret
=
WIZCHIP_EXPORT
(
listen
)
(
self
->
sn
);
check_sock_return_value
(
ret
);
return
mp_const_none
;
}
...
...
@@ -381,13 +381,13 @@ STATIC mp_obj_t wiznet5k_socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
wiznet5k_socket_obj_t
*
self
=
self_in
;
// first open the socket in client mode
mp_int_t
ret
=
socket
(
self
->
sn
,
self
->
type
,
0
,
0
);
mp_int_t
ret
=
WIZCHIP_EXPORT
(
socket
)
(
self
->
sn
,
self
->
type
,
0
,
0
);
check_sock_return_value
(
ret
);
// now connect
uint8_t
ip
[
IPADDR_BUF_SIZE
];
mp_uint_t
port
=
mod_network_parse_inet_addr
(
addr_in
,
ip
);
ret
=
connect
(
self
->
sn
,
ip
,
port
);
ret
=
WIZCHIP_EXPORT
(
connect
)
(
self
->
sn
,
ip
,
port
);
check_sock_return_value
(
ret
);
return
mp_const_none
;
...
...
@@ -396,7 +396,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(wiznet5k_socket_connect_obj, wiznet5k_socket_co
STATIC
mp_obj_t
wiznet5k_socket_disconnect
(
mp_obj_t
self_in
)
{
wiznet5k_socket_obj_t
*
self
=
self_in
;
mp_int_t
ret
=
disconnect
(
self
->
sn
);
mp_int_t
ret
=
WIZCHIP_EXPORT
(
disconnect
)
(
self
->
sn
);
check_sock_return_value
(
ret
);
return
mp_const_none
;
}
...
...
@@ -406,7 +406,7 @@ STATIC mp_obj_t wiznet5k_socket_send(mp_obj_t self_in, mp_obj_t data_in) {
wiznet5k_socket_obj_t
*
self
=
self_in
;
mp_buffer_info_t
bufinfo
;
mp_get_buffer_raise
(
data_in
,
&
bufinfo
,
MP_BUFFER_READ
);
mp_int_t
ret
=
send
(
self
->
sn
,
bufinfo
.
buf
,
bufinfo
.
len
);
mp_int_t
ret
=
WIZCHIP_EXPORT
(
send
)
(
self
->
sn
,
bufinfo
.
buf
,
bufinfo
.
len
);
check_sock_return_value
(
ret
);
return
mp_obj_new_int
(
ret
);
}
...
...
@@ -416,7 +416,7 @@ STATIC mp_obj_t wiznet5k_socket_recv(mp_obj_t self_in, mp_obj_t len_in) {
wiznet5k_socket_obj_t
*
self
=
self_in
;
mp_int_t
len
=
mp_obj_get_int
(
len_in
);
uint8_t
*
buf
=
m_new
(
uint8_t
,
len
);
mp_int_t
ret
=
recv
(
self
->
sn
,
buf
,
len
);
mp_int_t
ret
=
WIZCHIP_EXPORT
(
recv
)
(
self
->
sn
,
buf
,
len
);
check_sock_return_value
(
ret
);
mp_obj_t
ret_buf
=
mp_obj_new_bytes
(
buf
,
ret
);
m_del
(
uint8_t
,
buf
,
len
);
...
...
@@ -430,7 +430,7 @@ STATIC mp_obj_t wiznet5k_socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_ob
mp_get_buffer_raise
(
data_in
,
&
bufinfo
,
MP_BUFFER_READ
);
uint8_t
ip
[
IPADDR_BUF_SIZE
];
mp_uint_t
port
=
mod_network_parse_inet_addr
(
addr_in
,
ip
);
mp_int_t
ret
=
sendto
(
self
->
sn
,
bufinfo
.
buf
,
bufinfo
.
len
,
ip
,
port
);
mp_int_t
ret
=
WIZCHIP_EXPORT
(
sendto
)
(
self
->
sn
,
bufinfo
.
buf
,
bufinfo
.
len
,
ip
,
port
);
check_sock_return_value
(
ret
);
return
mp_obj_new_int
(
ret
);
}
...
...
@@ -442,7 +442,7 @@ STATIC mp_obj_t wiznet5k_socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
uint8_t
*
buf
=
m_new
(
uint8_t
,
len
);
uint8_t
ip
[
4
];
uint16_t
port
;
mp_int_t
ret
=
recvfrom
(
self
->
sn
,
buf
,
len
,
ip
,
&
port
);
mp_int_t
ret
=
WIZCHIP_EXPORT
(
recvfrom
)
(
self
->
sn
,
buf
,
len
,
ip
,
&
port
);
check_sock_return_value
(
ret
);
mp_obj_t
tuple
[
2
]
=
{
mp_obj_new_bytes
(
buf
,
ret
),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment