cc3200: Convert to using uPy internal errno numbers.

This commit is contained in:
Damien George 2017-02-22 11:53:53 +11:00
parent 85ab469c64
commit 8bb8e97dfe
3 changed files with 7 additions and 6 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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)