summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-02-22 11:53:53 +1100
committerDamien George <damien.p.george@gmail.com>2017-02-22 12:58:11 +1100
commit8bb8e97dfe2626b97028f1dad76cdd4050757961 (patch)
tree64a5d751e6261616b85ceb0e927d078c2bdc743a
parent85ab469c64420d4c11c946efd17ddaea57b19278 (diff)
cc3200: Convert to using uPy internal errno numbers.
-rw-r--r--cc3200/mods/modusocket.c6
-rw-r--r--cc3200/mods/pybuart.c6
-rw-r--r--cc3200/mpconfigport.h1
3 files changed, 7 insertions, 6 deletions
diff --git a/cc3200/mods/modusocket.c b/cc3200/mods/modusocket.c
index 35964fa05..56e0946a7 100644
--- a/cc3200/mods/modusocket.c
+++ b/cc3200/mods/modusocket.c
@@ -276,7 +276,7 @@ STATIC int wlan_socket_ioctl (mod_network_socket_obj_t *s, mp_uint_t request, mp
ret |= MP_STREAM_POLL_HUP;
}
} else {
- *_errno = EINVAL;
+ *_errno = MP_EINVAL;
ret = MP_STREAM_ERROR;
}
return ret;
@@ -519,7 +519,7 @@ STATIC mp_obj_t socket_recv(mp_obj_t self_in, mp_obj_t len_in) {
int _errno;
mp_int_t ret = wlan_socket_recv(self, (byte*)vstr.buf, len, &_errno);
if (ret < 0) {
- if (_errno == EAGAIN && self->sock_base.has_timeout) {
+ if (_errno == MP_EAGAIN && self->sock_base.has_timeout) {
mp_raise_msg(&mp_type_TimeoutError, "timed out");
}
mp_raise_OSError(-_errno);
@@ -565,7 +565,7 @@ STATIC mp_obj_t socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
int _errno;
mp_int_t ret = wlan_socket_recvfrom(self, (byte*)vstr.buf, vstr.len, ip, &port, &_errno);
if (ret < 0) {
- if (_errno == EAGAIN && self->sock_base.has_timeout) {
+ if (_errno == MP_EAGAIN && self->sock_base.has_timeout) {
mp_raise_msg(&mp_type_TimeoutError, "timed out");
}
mp_raise_OSError(-_errno);
diff --git a/cc3200/mods/pybuart.c b/cc3200/mods/pybuart.c
index dceb842d5..f28af9063 100644
--- a/cc3200/mods/pybuart.c
+++ b/cc3200/mods/pybuart.c
@@ -596,8 +596,8 @@ STATIC mp_uint_t pyb_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, i
// wait for first char to become available
if (!uart_rx_wait(self)) {
- // return EAGAIN error to indicate non-blocking (then read() method returns None)
- *errcode = EAGAIN;
+ // return MP_EAGAIN error to indicate non-blocking (then read() method returns None)
+ *errcode = MP_EAGAIN;
return MP_STREAM_ERROR;
}
@@ -639,7 +639,7 @@ STATIC mp_uint_t pyb_uart_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t a
ret |= MP_STREAM_POLL_WR;
}
} else {
- *errcode = EINVAL;
+ *errcode = MP_EINVAL;
ret = MP_STREAM_ERROR;
}
return ret;
diff --git a/cc3200/mpconfigport.h b/cc3200/mpconfigport.h
index 944a6c071..91d14dd1e 100644
--- a/cc3200/mpconfigport.h
+++ b/cc3200/mpconfigport.h
@@ -75,6 +75,7 @@
#define MICROPY_STREAMS_NON_BLOCK (1)
#define MICROPY_MODULE_WEAK_LINKS (1)
#define MICROPY_CAN_OVERRIDE_BUILTINS (1)
+#define MICROPY_USE_INTERNAL_ERRNO (1)
#define MICROPY_VFS (1)
#define MICROPY_VFS_FAT (1)
#define MICROPY_PY_ASYNC_AWAIT (0)