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/usb.c | |
parent | 6194336d81e73e74eb7e0f26501966082ce4d411 (diff) |
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/usb.c')
-rw-r--r-- | stmhal/usb.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/stmhal/usb.c b/stmhal/usb.c index dd6daf8e5..b0a66ef9b 100644 --- a/stmhal/usb.c +++ b/stmhal/usb.c @@ -40,7 +40,6 @@ #include "py/mperrno.h" #include "bufhelper.h" #include "usb.h" -#include "pybioctl.h" #if defined(USE_USB_FS) #define USB_PHY_ID USB_PHY_FS_ID @@ -502,14 +501,14 @@ STATIC mp_uint_t pyb_usb_vcp_write(mp_obj_t self_in, const void *buf, mp_uint_t STATIC mp_uint_t pyb_usb_vcp_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t arg, int *errcode) { mp_uint_t ret; - if (request == MP_IOCTL_POLL) { + if (request == MP_STREAM_POLL) { mp_uint_t flags = arg; ret = 0; - if ((flags & MP_IOCTL_POLL_RD) && USBD_CDC_RxNum() > 0) { - ret |= MP_IOCTL_POLL_RD; + if ((flags & MP_STREAM_POLL_RD) && USBD_CDC_RxNum() > 0) { + ret |= MP_STREAM_POLL_RD; } - if ((flags & MP_IOCTL_POLL_WR) && USBD_CDC_TxHalfEmpty()) { - ret |= MP_IOCTL_POLL_WR; + if ((flags & MP_STREAM_POLL_WR) && USBD_CDC_TxHalfEmpty()) { + ret |= MP_STREAM_POLL_WR; } } else { *errcode = MP_EINVAL; @@ -632,11 +631,11 @@ STATIC MP_DEFINE_CONST_DICT(pyb_usb_hid_locals_dict, pyb_usb_hid_locals_dict_tab STATIC mp_uint_t pyb_usb_hid_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t arg, int *errcode) { mp_uint_t ret; - if (request == MP_IOCTL_POLL) { + if (request == MP_STREAM_POLL) { mp_uint_t flags = arg; ret = 0; - if ((flags & MP_IOCTL_POLL_WR) && USBD_HID_CanSendReport(&hUSBDDevice)) { - ret |= MP_IOCTL_POLL_WR; + if ((flags & MP_STREAM_POLL_WR) && USBD_HID_CanSendReport(&hUSBDDevice)) { + ret |= MP_STREAM_POLL_WR; } } else { *errcode = MP_EINVAL; |