Browse Source

cc3200: Remove NIC abstraction layer.

That layer is nice, but the CC3200 doesn't need it and getting rid of
it saves ~200 bytes, which are more than welcome.
pull/1278/merge
Daniel Campora 10 years ago
parent
commit
3cb804de26
  1. 2
      cc3200/fatfs/src/drivers/sflash_diskio.c
  2. 1
      cc3200/ftp/ftp.c
  3. 2
      cc3200/ftp/updater.c
  4. 34
      cc3200/mods/modnetwork.h
  5. 1
      cc3200/mods/modpyb.c
  6. 35
      cc3200/mods/modusocket.c
  7. 90
      cc3200/mods/modwlan.c
  8. 15
      cc3200/mods/modwlan.h
  9. 1
      cc3200/mods/pybsleep.c
  10. 1
      cc3200/telnet/telnet.c
  11. 3
      cc3200/util/random.c

2
cc3200/fatfs/src/drivers/sflash_diskio.c

@ -4,10 +4,12 @@
#include "py/mpconfig.h"
#include MICROPY_HAL_H
#include "py/obj.h"
#include "simplelink.h"
#include "diskio.h"
#include "sflash_diskio.h"
#include "debug.h"
#include "modnetwork.h"
#include "modwlan.h"
#define SFLASH_TIMEOUT_MAX_MS 5500

1
cc3200/ftp/ftp.c

@ -39,6 +39,7 @@
#include "pybrtc.h"
#include "ftp.h"
#include "simplelink.h"
#include "modnetwork.h"
#include "modwlan.h"
#include "modusocket.h"
#include "debug.h"

2
cc3200/ftp/updater.c

@ -3,10 +3,12 @@
#include "py/mpconfig.h"
#include MICROPY_HAL_H
#include "py/obj.h"
#include "simplelink.h"
#include "flc.h"
#include "updater.h"
#include "shamd5.h"
#include "modnetwork.h"
#include "modwlan.h"
#include "debug.h"

34
cc3200/mods/modnetwork.h

@ -28,36 +28,20 @@
#ifndef MODNETWORK_H_
#define MODNETWORK_H_
/******************************************************************************
DEFINE CONSTANTS
******************************************************************************/
#define MOD_NETWORK_IPV4ADDR_BUF_SIZE (4)
// Forward declaration
struct _mod_network_socket_obj_t;
/******************************************************************************
DEFINE TYPES
******************************************************************************/
typedef struct _mod_network_nic_type_t {
mp_obj_type_t base;
// API for non-socket operations
int (*gethostbyname)(const char *name, mp_uint_t len, uint8_t *ip_out, uint8_t family);
// API for socket operations; return -1 on error
int (*socket)(struct _mod_network_socket_obj_t *s, int *_errno);
void (*close)(struct _mod_network_socket_obj_t *socket);
int (*bind)(struct _mod_network_socket_obj_t *s, byte *ip, mp_uint_t port, int *_errno);
int (*listen)(struct _mod_network_socket_obj_t *s, mp_int_t backlog, int *_errno);
int (*accept)(struct _mod_network_socket_obj_t *s, struct _mod_network_socket_obj_t *s2, byte *ip, mp_uint_t *port, int *_errno);
int (*connect)(struct _mod_network_socket_obj_t *s, byte *ip, mp_uint_t port, int *_errno);
int (*send)(struct _mod_network_socket_obj_t *s, const byte *buf, mp_uint_t len, int *_errno);
int (*recv)(struct _mod_network_socket_obj_t *s, byte *buf, mp_uint_t len, int *_errno);
int (*sendto)(struct _mod_network_socket_obj_t *s, const byte *buf, mp_uint_t len, byte *ip, mp_uint_t port, int *_errno);
int (*recvfrom)(struct _mod_network_socket_obj_t *s, byte *buf, mp_uint_t len, byte *ip, mp_uint_t *port, int *_errno);
int (*setsockopt)(struct _mod_network_socket_obj_t *s, mp_uint_t level, mp_uint_t opt, const void *optval, mp_uint_t optlen, int *_errno);
int (*settimeout)(struct _mod_network_socket_obj_t *s, mp_uint_t timeout_ms, int *_errno);
int (*ioctl)(struct _mod_network_socket_obj_t *s, mp_uint_t request, mp_uint_t arg, int *_errno);
} mod_network_nic_type_t;
typedef struct _mod_network_socket_obj_t {
mp_obj_base_t base;
mod_network_nic_type_t *nic_type;
union {
struct {
uint8_t domain;
@ -70,8 +54,14 @@ typedef struct _mod_network_socket_obj_t {
bool closed;
} mod_network_socket_obj_t;
/******************************************************************************
EXPORTED DATA
******************************************************************************/
extern const mod_network_nic_type_t mod_network_nic_type_wlan;
/******************************************************************************
DECLARE FUNCTIONS
******************************************************************************/
void mod_network_init0(void);
#endif // MODNETWORK_H_

1
cc3200/mods/modpyb.c

@ -44,6 +44,7 @@
#include "pybrtc.h"
#include "mpsystick.h"
#include "simplelink.h"
#include "modnetwork.h"
#include "modwlan.h"
#include "moduos.h"
#include "telnet.h"

35
cc3200/mods/modusocket.c

@ -34,6 +34,7 @@
#include "py/runtime.h"
#include "netutils.h"
#include "modnetwork.h"
#include "modwlan.h"
#include "modusocket.h"
#include "mpexception.h"
@ -129,7 +130,6 @@ STATIC mp_obj_t socket_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_
// create socket object
mod_network_socket_obj_t *s = m_new_obj_with_finaliser(mod_network_socket_obj_t);
s->base.type = (mp_obj_t)&socket_type;
s->nic_type = (mod_network_nic_type_t *)&mod_network_nic_type_wlan;
s->u_param.domain = AF_INET;
s->u_param.type = SOCK_STREAM;
s->u_param.proto = IPPROTO_TCP;
@ -149,7 +149,7 @@ STATIC mp_obj_t socket_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_
// create the socket
int _errno;
if (s->nic_type->socket(s, &_errno) != 0) {
if (wlan_socket_socket(s, &_errno) != 0) {
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(_errno)));
}
@ -160,7 +160,7 @@ STATIC mp_obj_t socket_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_
// method socket.close()
STATIC mp_obj_t socket_close(mp_obj_t self_in) {
mod_network_socket_obj_t *self = self_in;
self->nic_type->close(self);
wlan_socket_close(self);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(socket_close_obj, socket_close);
@ -175,7 +175,7 @@ STATIC mp_obj_t socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
// call the NIC to bind the socket
int _errno;
if (self->nic_type->bind(self, ip, port, &_errno) != 0) {
if (wlan_socket_bind(self, ip, port, &_errno) != 0) {
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(_errno)));
}
return mp_const_none;
@ -187,7 +187,7 @@ STATIC mp_obj_t socket_listen(mp_obj_t self_in, mp_obj_t backlog) {
mod_network_socket_obj_t *self = self_in;
int _errno;
if (self->nic_type->listen(self, mp_obj_get_int(backlog), &_errno) != 0) {
if (wlan_socket_listen(self, mp_obj_get_int(backlog), &_errno) != 0) {
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(_errno)));
}
return mp_const_none;
@ -199,22 +199,17 @@ STATIC mp_obj_t socket_accept(mp_obj_t self_in) {
mod_network_socket_obj_t *self = self_in;
// create new socket object
// starts with empty nic so that the finaliser doesn't run close() method if accept() fails
mod_network_socket_obj_t *socket2 = m_new_obj_with_finaliser(mod_network_socket_obj_t);
socket2->base.type = (mp_obj_t)&socket_type;
socket2->nic_type = MP_OBJ_NULL;
// accept incoming connection
uint8_t ip[MOD_NETWORK_IPV4ADDR_BUF_SIZE];
mp_uint_t port;
int _errno;
if (self->nic_type->accept(self, socket2, ip, &port, &_errno) != 0) {
if (wlan_socket_accept(self, socket2, ip, &port, &_errno) != 0) {
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(_errno)));
}
// new socket has valid state, so set the nic to the same as parent
socket2->nic_type = self->nic_type;
// add the socket to the list
modusocket_socket_add(socket2->sd, true);
@ -236,7 +231,7 @@ STATIC mp_obj_t socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
// call the NIC to connect the socket
int _errno;
if (self->nic_type->connect(self, ip, port, &_errno) != 0) {
if (wlan_socket_connect(self, ip, port, &_errno) != 0) {
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(_errno)));
}
return mp_const_none;
@ -249,7 +244,7 @@ STATIC mp_obj_t socket_send(mp_obj_t self_in, mp_obj_t buf_in) {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ);
int _errno;
mp_uint_t ret = self->nic_type->send(self, bufinfo.buf, bufinfo.len, &_errno);
mp_uint_t ret = wlan_socket_send(self, bufinfo.buf, bufinfo.len, &_errno);
if (ret == -1) {
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(_errno)));
}
@ -264,7 +259,7 @@ STATIC mp_obj_t socket_recv(mp_obj_t self_in, mp_obj_t len_in) {
vstr_t vstr;
vstr_init_len(&vstr, len);
int _errno;
mp_uint_t ret = self->nic_type->recv(self, (byte*)vstr.buf, len, &_errno);
mp_uint_t ret = wlan_socket_recv(self, (byte*)vstr.buf, len, &_errno);
if (ret == -1) {
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(_errno)));
}
@ -291,7 +286,7 @@ STATIC mp_obj_t socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_
// call the nic to sendto
int _errno;
mp_int_t ret = self->nic_type->sendto(self, bufinfo.buf, bufinfo.len, ip, port, &_errno);
mp_int_t ret = wlan_socket_sendto(self, bufinfo.buf, bufinfo.len, ip, port, &_errno);
if (ret == -1) {
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(_errno)));
}
@ -307,7 +302,7 @@ STATIC mp_obj_t socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
byte ip[4];
mp_uint_t port;
int _errno;
mp_int_t ret = self->nic_type->recvfrom(self, (byte*)vstr.buf, vstr.len, ip, &port, &_errno);
mp_int_t ret = wlan_socket_recvfrom(self, (byte*)vstr.buf, vstr.len, ip, &port, &_errno);
if (ret == -1) {
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(_errno)));
}
@ -346,7 +341,7 @@ STATIC mp_obj_t socket_setsockopt(mp_uint_t n_args, const mp_obj_t *args) {
}
int _errno;
if (self->nic_type->setsockopt(self, level, opt, optval, optlen, &_errno) != 0) {
if (wlan_socket_setsockopt(self, level, opt, optval, optlen, &_errno) != 0) {
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(_errno)));
}
return mp_const_none;
@ -366,7 +361,7 @@ STATIC mp_obj_t socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {
timeout = 1000 * mp_obj_get_int(timeout_in);
}
int _errno;
if (self->nic_type->settimeout(self, timeout, &_errno) != 0) {
if (wlan_socket_settimeout(self, timeout, &_errno) != 0) {
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(_errno)));
}
return mp_const_none;
@ -403,7 +398,7 @@ STATIC MP_DEFINE_CONST_DICT(socket_locals_dict, socket_locals_dict_table);
mp_uint_t socket_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t arg, int *errcode) {
mod_network_socket_obj_t *self = self_in;
return self->nic_type->ioctl(self, request, arg, errcode);
return wlan_socket_ioctl(self, request, arg, errcode);
}
STATIC const mp_stream_p_t socket_stream_p = {
@ -431,7 +426,7 @@ STATIC mp_obj_t mod_usocket_getaddrinfo(mp_obj_t host_in, mp_obj_t port_in) {
// ipv4 only
uint8_t out_ip[MOD_NETWORK_IPV4ADDR_BUF_SIZE];
int32_t result = mod_network_nic_type_wlan.gethostbyname(host, hlen, out_ip, AF_INET);
int32_t result = wlan_gethostbyname(host, hlen, out_ip, AF_INET);
if (result != 0) {
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(result)));
}

90
cc3200/mods/modwlan.c

@ -597,14 +597,15 @@ STATIC modwlan_Status_t wlan_do_connect (const char* ssid, uint32_t ssid_len, co
secParams.Type = sec;
if (0 == sl_WlanConnect((_i8*)ssid, ssid_len, (_u8*)bssid, &secParams, NULL)) {
// Wait for the WLAN Event
// wait for the WLAN Event
uint32_t waitForConnectionMs = 0;
while (!IS_CONNECTED(wlan_obj.status)) {
HAL_Delay (5);
wlan_update();
if (++waitForConnectionMs >= timeout) {
waitForConnectionMs += 5;
if (waitForConnectionMs > timeout) {
return MODWLAN_ERROR_TIMEOUT;
}
wlan_update();
}
return MODWLAN_OK;
}
@ -1057,6 +1058,15 @@ STATIC const mp_map_elem_t wlan_locals_dict_table[] = {
};
STATIC MP_DEFINE_CONST_DICT(wlan_locals_dict, wlan_locals_dict_table);
const mod_network_nic_type_t mod_network_nic_type_wlan = {
.base = {
{ &mp_type_type },
.name = MP_QSTR_WLAN,
.make_new = wlan_make_new,
.locals_dict = (mp_obj_t)&wlan_locals_dict,
},
};
STATIC const mp_cb_methods_t wlan_cb_methods = {
.init = wlan_callback,
.enable = wlan_lpds_callback_enable,
@ -1066,7 +1076,7 @@ STATIC const mp_cb_methods_t wlan_cb_methods = {
/******************************************************************************/
// Micro Python bindings; WLAN socket
STATIC int wlan_gethostbyname(const char *name, mp_uint_t len, uint8_t *out_ip, uint8_t family) {
int wlan_gethostbyname(const char *name, mp_uint_t len, uint8_t *out_ip, uint8_t family) {
uint32_t ip;
int result = sl_NetAppDnsGetHostByName((_i8 *)name, (_u16)len, (_u32*)&ip, (_u8)family);
@ -1078,29 +1088,32 @@ STATIC int wlan_gethostbyname(const char *name, mp_uint_t len, uint8_t *out_ip,
return result;
}
STATIC int wlan_socket_socket(struct _mod_network_socket_obj_t *s, int *_errno) {
int wlan_socket_socket(mod_network_socket_obj_t *s, int *_errno) {
// open the socket
int16_t sd = sl_Socket(s->u_param.domain, s->u_param.type, s->u_param.proto);
if (s->sd < 0) {
*_errno = s->sd;
// save the socket descriptor
s->sd = sd;
if (sd < 0) {
*_errno = sd;
return -1;
}
// mark the socket not closed
s->closed = false;
// save the socket descriptor
s->sd = sd;
return 0;
}
STATIC void wlan_socket_close(mod_network_socket_obj_t *s) {
modusocket_socket_delete(s->sd);
void wlan_socket_close(mod_network_socket_obj_t *s) {
// this is to prevent the finalizer to close a socket that failed when being created
if (s->sd >= 0) {
modusocket_socket_delete(s->sd);
sl_Close(s->sd);
}
s->closed = true;
sl_Close(s->sd);
}
STATIC int wlan_socket_bind(mod_network_socket_obj_t *s, byte *ip, mp_uint_t port, int *_errno) {
int wlan_socket_bind(mod_network_socket_obj_t *s, byte *ip, mp_uint_t port, int *_errno) {
MAKE_SOCKADDR(addr, ip, port)
int ret = sl_Bind(s->sd, &addr, sizeof(addr));
if (ret != 0) {
@ -1110,7 +1123,7 @@ STATIC int wlan_socket_bind(mod_network_socket_obj_t *s, byte *ip, mp_uint_t por
return 0;
}
STATIC int wlan_socket_listen(mod_network_socket_obj_t *s, mp_int_t backlog, int *_errno) {
int wlan_socket_listen(mod_network_socket_obj_t *s, mp_int_t backlog, int *_errno) {
int ret = sl_Listen(s->sd, backlog);
if (ret != 0) {
*_errno = ret;
@ -1119,19 +1132,22 @@ STATIC int wlan_socket_listen(mod_network_socket_obj_t *s, mp_int_t backlog, int
return 0;
}
STATIC int wlan_socket_accept(mod_network_socket_obj_t *s, mod_network_socket_obj_t *s2, byte *ip, mp_uint_t *port, int *_errno) {
int wlan_socket_accept(mod_network_socket_obj_t *s, mod_network_socket_obj_t *s2, byte *ip, mp_uint_t *port, int *_errno) {
// accept incoming connection
int16_t sd;
sockaddr addr;
socklen_t addr_len = sizeof(addr);
if ((sd = sl_Accept(s->sd, &addr, &addr_len)) < 0) {
sd = sl_Accept(s->sd, &addr, &addr_len);
// save the socket descriptor
s2->sd = sd;
if (sd < 0) {
*_errno = sd;
return -1;
}
// Mark the socket not closed and save the new descriptor
// mark the socket not closed
s2->closed = false;
s2->sd = sd;
// return ip and port
UNPACK_SOCKADDR(addr, ip, *port);
@ -1139,7 +1155,7 @@ STATIC int wlan_socket_accept(mod_network_socket_obj_t *s, mod_network_socket_ob
return 0;
}
STATIC int wlan_socket_connect(mod_network_socket_obj_t *s, byte *ip, mp_uint_t port, int *_errno) {
int wlan_socket_connect(mod_network_socket_obj_t *s, byte *ip, mp_uint_t port, int *_errno) {
MAKE_SOCKADDR(addr, ip, port)
int ret = sl_Connect(s->sd, &addr, sizeof(addr));
if (ret != 0) {
@ -1149,7 +1165,7 @@ STATIC int wlan_socket_connect(mod_network_socket_obj_t *s, byte *ip, mp_uint_t
return 0;
}
STATIC int wlan_socket_send(mod_network_socket_obj_t *s, const byte *buf, mp_uint_t len, int *_errno) {
int wlan_socket_send(mod_network_socket_obj_t *s, const byte *buf, mp_uint_t len, int *_errno) {
mp_int_t bytes = 0;
if (len > 0) {
bytes = sl_Send(s->sd, (const void *)buf, len, 0);
@ -1162,7 +1178,7 @@ STATIC int wlan_socket_send(mod_network_socket_obj_t *s, const byte *buf, mp_uin
return bytes;
}
STATIC int wlan_socket_recv(mod_network_socket_obj_t *s, byte *buf, mp_uint_t len, int *_errno) {
int wlan_socket_recv(mod_network_socket_obj_t *s, byte *buf, mp_uint_t len, int *_errno) {
// check if the socket is open
if (s->closed) {
// socket is closed, but the there might be data remaining in the buffer, so check
@ -1193,7 +1209,7 @@ STATIC int wlan_socket_recv(mod_network_socket_obj_t *s, byte *buf, mp_uint_t le
return ret;
}
STATIC int wlan_socket_sendto( mod_network_socket_obj_t *s, const byte *buf, mp_uint_t len, byte *ip, mp_uint_t port, int *_errno) {
int wlan_socket_sendto( mod_network_socket_obj_t *s, const byte *buf, mp_uint_t len, byte *ip, mp_uint_t port, int *_errno) {
MAKE_SOCKADDR(addr, ip, port)
int ret = sl_SendTo(s->sd, (byte*)buf, len, 0, (sockaddr*)&addr, sizeof(addr));
if (ret < 0) {
@ -1203,7 +1219,7 @@ STATIC int wlan_socket_sendto( mod_network_socket_obj_t *s, const byte *buf, mp_
return ret;
}
STATIC int wlan_socket_recvfrom(mod_network_socket_obj_t *s, byte *buf, mp_uint_t len, byte *ip, mp_uint_t *port, int *_errno) {
int wlan_socket_recvfrom(mod_network_socket_obj_t *s, byte *buf, mp_uint_t len, byte *ip, mp_uint_t *port, int *_errno) {
sockaddr addr;
socklen_t addr_len = sizeof(addr);
mp_int_t ret = sl_RecvFrom(s->sd, buf, len, 0, &addr, &addr_len);
@ -1215,7 +1231,7 @@ STATIC int wlan_socket_recvfrom(mod_network_socket_obj_t *s, byte *buf, mp_uint_
return ret;
}
STATIC int wlan_socket_setsockopt(mod_network_socket_obj_t *socket, mp_uint_t level, mp_uint_t opt, const void *optval, mp_uint_t optlen, int *_errno) {
int wlan_socket_setsockopt(mod_network_socket_obj_t *socket, mp_uint_t level, mp_uint_t opt, const void *optval, mp_uint_t optlen, int *_errno) {
int ret = sl_SetSockOpt(socket->sd, level, opt, optval, optlen);
if (ret < 0) {
*_errno = ret;
@ -1224,7 +1240,7 @@ STATIC int wlan_socket_setsockopt(mod_network_socket_obj_t *socket, mp_uint_t le
return 0;
}
STATIC int wlan_socket_settimeout(mod_network_socket_obj_t *s, mp_uint_t timeout_ms, int *_errno) {
int wlan_socket_settimeout(mod_network_socket_obj_t *s, mp_uint_t timeout_ms, int *_errno) {
int ret;
if (timeout_ms == 0 || timeout_ms == -1) {
int optval;
@ -1249,7 +1265,7 @@ STATIC int wlan_socket_settimeout(mod_network_socket_obj_t *s, mp_uint_t timeout
return 0;
}
STATIC int wlan_socket_ioctl (mod_network_socket_obj_t *s, mp_uint_t request, mp_uint_t arg, int *_errno) {
int wlan_socket_ioctl (mod_network_socket_obj_t *s, mp_uint_t request, mp_uint_t arg, int *_errno) {
mp_int_t ret;
if (request == MP_IOCTL_POLL) {
mp_uint_t flags = arg;
@ -1308,25 +1324,3 @@ STATIC int wlan_socket_ioctl (mod_network_socket_obj_t *s, mp_uint_t request, mp
return ret;
}
const mod_network_nic_type_t mod_network_nic_type_wlan = {
.base = {
{ &mp_type_type },
.name = MP_QSTR_WLAN,
.make_new = wlan_make_new,
.locals_dict = (mp_obj_t)&wlan_locals_dict,
},
.gethostbyname = wlan_gethostbyname,
.socket = wlan_socket_socket,
.close = wlan_socket_close,
.bind = wlan_socket_bind,
.listen = wlan_socket_listen,
.accept = wlan_socket_accept,
.connect = wlan_socket_connect,
.send = wlan_socket_send,
.recv = wlan_socket_recv,
.sendto = wlan_socket_sendto,
.recvfrom = wlan_socket_recvfrom,
.setsockopt = wlan_socket_setsockopt,
.settimeout = wlan_socket_settimeout,
.ioctl = wlan_socket_ioctl,
};

15
cc3200/mods/modwlan.h

@ -63,4 +63,19 @@ extern void wlan_start (void);
extern void wlan_get_mac (uint8_t *macAddress);
extern void wlan_get_ip (uint32_t *ip);
extern int wlan_gethostbyname(const char *name, mp_uint_t len, uint8_t *out_ip, uint8_t family);
extern int wlan_socket_socket(mod_network_socket_obj_t *s, int *_errno);
extern void wlan_socket_close(mod_network_socket_obj_t *s);
extern int wlan_socket_bind(mod_network_socket_obj_t *s, byte *ip, mp_uint_t port, int *_errno);
extern int wlan_socket_listen(mod_network_socket_obj_t *s, mp_int_t backlog, int *_errno);
extern int wlan_socket_accept(mod_network_socket_obj_t *s, mod_network_socket_obj_t *s2, byte *ip, mp_uint_t *port, int *_errno);
extern int wlan_socket_connect(mod_network_socket_obj_t *s, byte *ip, mp_uint_t port, int *_errno);
extern int wlan_socket_send(mod_network_socket_obj_t *s, const byte *buf, mp_uint_t len, int *_errno);
extern int wlan_socket_recv(mod_network_socket_obj_t *s, byte *buf, mp_uint_t len, int *_errno);
extern int wlan_socket_sendto( mod_network_socket_obj_t *s, const byte *buf, mp_uint_t len, byte *ip, mp_uint_t port, int *_errno);
extern int wlan_socket_recvfrom(mod_network_socket_obj_t *s, byte *buf, mp_uint_t len, byte *ip, mp_uint_t *port, int *_errno);
extern int wlan_socket_setsockopt(mod_network_socket_obj_t *socket, mp_uint_t level, mp_uint_t opt, const void *optval, mp_uint_t optlen, int *_errno);
extern int wlan_socket_settimeout(mod_network_socket_obj_t *s, mp_uint_t timeout_ms, int *_errno);
extern int wlan_socket_ioctl (mod_network_socket_obj_t *s, mp_uint_t request, mp_uint_t arg, int *_errno);
#endif /* MODWLAN_H_ */

1
cc3200/mods/pybsleep.c

@ -45,6 +45,7 @@
#include "pybsleep.h"
#include "pybpin.h"
#include "simplelink.h"
#include "modnetwork.h"
#include "modwlan.h"
#include "osi.h"
#include "debug.h"

1
cc3200/telnet/telnet.c

@ -31,6 +31,7 @@
#include "py/obj.h"
#include "telnet.h"
#include "simplelink.h"
#include "modnetwork.h"
#include "modwlan.h"
#include "modusocket.h"
#include "debug.h"

3
cc3200/util/random.c

@ -27,14 +27,15 @@
#include <stdint.h>
#include <stdbool.h>
#include "py/obj.h"
#include "inc/hw_types.h"
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "rom_map.h"
#include "prcm.h"
#include "simplelink.h"
#include "modnetwork.h"
#include "modwlan.h"
#include "py/obj.h"
#include "random.h"
#include "debug.h"

Loading…
Cancel
Save