Skip to content

Commit 8bb8e97

Browse files
committed
cc3200: Convert to using uPy internal errno numbers.
1 parent 85ab469 commit 8bb8e97

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

cc3200/mods/modusocket.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ STATIC int wlan_socket_ioctl (mod_network_socket_obj_t *s, mp_uint_t request, mp
276276
ret |= MP_STREAM_POLL_HUP;
277277
}
278278
} else {
279-
*_errno = EINVAL;
279+
*_errno = MP_EINVAL;
280280
ret = MP_STREAM_ERROR;
281281
}
282282
return ret;
@@ -519,7 +519,7 @@ STATIC mp_obj_t socket_recv(mp_obj_t self_in, mp_obj_t len_in) {
519519
int _errno;
520520
mp_int_t ret = wlan_socket_recv(self, (byte*)vstr.buf, len, &_errno);
521521
if (ret < 0) {
522-
if (_errno == EAGAIN && self->sock_base.has_timeout) {
522+
if (_errno == MP_EAGAIN && self->sock_base.has_timeout) {
523523
mp_raise_msg(&mp_type_TimeoutError, "timed out");
524524
}
525525
mp_raise_OSError(-_errno);
@@ -565,7 +565,7 @@ STATIC mp_obj_t socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
565565
int _errno;
566566
mp_int_t ret = wlan_socket_recvfrom(self, (byte*)vstr.buf, vstr.len, ip, &port, &_errno);
567567
if (ret < 0) {
568-
if (_errno == EAGAIN && self->sock_base.has_timeout) {
568+
if (_errno == MP_EAGAIN && self->sock_base.has_timeout) {
569569
mp_raise_msg(&mp_type_TimeoutError, "timed out");
570570
}
571571
mp_raise_OSError(-_errno);

cc3200/mods/pybuart.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,8 +596,8 @@ STATIC mp_uint_t pyb_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, i
596596

597597
// wait for first char to become available
598598
if (!uart_rx_wait(self)) {
599-
// return EAGAIN error to indicate non-blocking (then read() method returns None)
600-
*errcode = EAGAIN;
599+
// return MP_EAGAIN error to indicate non-blocking (then read() method returns None)
600+
*errcode = MP_EAGAIN;
601601
return MP_STREAM_ERROR;
602602
}
603603

@@ -639,7 +639,7 @@ STATIC mp_uint_t pyb_uart_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t a
639639
ret |= MP_STREAM_POLL_WR;
640640
}
641641
} else {
642-
*errcode = EINVAL;
642+
*errcode = MP_EINVAL;
643643
ret = MP_STREAM_ERROR;
644644
}
645645
return ret;

cc3200/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
#define MICROPY_STREAMS_NON_BLOCK (1)
7676
#define MICROPY_MODULE_WEAK_LINKS (1)
7777
#define MICROPY_CAN_OVERRIDE_BUILTINS (1)
78+
#define MICROPY_USE_INTERNAL_ERRNO (1)
7879
#define MICROPY_VFS (1)
7980
#define MICROPY_VFS_FAT (1)
8081
#define MICROPY_PY_ASYNC_AWAIT (0)

0 commit comments

Comments
 (0)