diff options
author | Damien George <damien.p.george@gmail.com> | 2016-12-02 16:37:29 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-12-02 16:37:29 +1100 |
commit | 304cfda8c466920b1d29903bfca8bca5ed110f3b (patch) | |
tree | 1a6e2aec1e3da97d6e50512c4923a404087bd932 /stmhal/modnwcc3k.c | |
parent | 6194336d81e73e74eb7e0f26501966082ce4d411 (diff) | |
download | micropython-304cfda8c466920b1d29903bfca8bca5ed110f3b.tar.gz micropython-304cfda8c466920b1d29903bfca8bca5ed110f3b.zip |
py/stream: Move ad-hoc ioctl constants to stream.h and rename them.
The constants MP_IOCTL_POLL_xxx, which were stmhal-specific, are moved
from stmhal/pybioctl.h (now deleted) to py/stream.h. And they are renamed
to MP_STREAM_POLL_xxx to be consistent with other such constants.
All uses of these constants have been updated.
Diffstat (limited to 'stmhal/modnwcc3k.c')
-rw-r--r-- | stmhal/modnwcc3k.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/stmhal/modnwcc3k.c b/stmhal/modnwcc3k.c index 5910576029..dcef1f99b5 100644 --- a/stmhal/modnwcc3k.c +++ b/stmhal/modnwcc3k.c @@ -41,7 +41,6 @@ #include "pin.h" #include "genhdr/pins.h" #include "spi.h" -#include "pybioctl.h" #include "hci.h" #include "socket.h" @@ -354,7 +353,7 @@ STATIC int cc3k_socket_settimeout(mod_network_socket_obj_t *socket, mp_uint_t ti STATIC int cc3k_socket_ioctl(mod_network_socket_obj_t *socket, mp_uint_t request, mp_uint_t arg, int *_errno) { mp_uint_t ret; - if (request == MP_IOCTL_POLL) { + if (request == MP_STREAM_POLL) { mp_uint_t flags = arg; ret = 0; int fd = socket->u_state; @@ -366,19 +365,19 @@ STATIC int cc3k_socket_ioctl(mod_network_socket_obj_t *socket, mp_uint_t request FD_ZERO(&xfds); // set fds if needed - if (flags & MP_IOCTL_POLL_RD) { + if (flags & MP_STREAM_POLL_RD) { FD_SET(fd, &rfds); // A socked that just closed is available for reading. A call to // recv() returns 0 which is consistent with BSD. if (cc3k_get_fd_closed_state(fd)) { - ret |= MP_IOCTL_POLL_RD; + ret |= MP_STREAM_POLL_RD; } } - if (flags & MP_IOCTL_POLL_WR) { + if (flags & MP_STREAM_POLL_WR) { FD_SET(fd, &wfds); } - if (flags & MP_IOCTL_POLL_HUP) { + if (flags & MP_STREAM_POLL_HUP) { FD_SET(fd, &xfds); } @@ -396,13 +395,13 @@ STATIC int cc3k_socket_ioctl(mod_network_socket_obj_t *socket, mp_uint_t request // check return of select if (FD_ISSET(fd, &rfds)) { - ret |= MP_IOCTL_POLL_RD; + ret |= MP_STREAM_POLL_RD; } if (FD_ISSET(fd, &wfds)) { - ret |= MP_IOCTL_POLL_WR; + ret |= MP_STREAM_POLL_WR; } if (FD_ISSET(fd, &xfds)) { - ret |= MP_IOCTL_POLL_HUP; + ret |= MP_STREAM_POLL_HUP; } } else { *_errno = MP_EINVAL; |