diff options
author | Damien George <damien.p.george@gmail.com> | 2014-07-30 14:04:16 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-09-07 20:40:10 +0100 |
commit | c8c44a4c2e6deaf57a4d7badfcbb9ba525d3dfa2 (patch) | |
tree | c74d7aed3f4507bbd4e6058de3cf7f1416a48664 /py | |
parent | 8105736982b0bb2ee3809c8d05b9c41b9aceea1b (diff) | |
download | micropython-c8c44a4c2e6deaf57a4d7badfcbb9ba525d3dfa2.tar.gz micropython-c8c44a4c2e6deaf57a4d7badfcbb9ba525d3dfa2.zip |
py: Add ioctl method to stream protocol; add initial modselect.
Diffstat (limited to 'py')
-rw-r--r-- | py/mpconfig.h | 4 | ||||
-rw-r--r-- | py/obj.h | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h index adbcb0eb71..fc5d6ce2e1 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -390,6 +390,10 @@ typedef double mp_float_t; #define MICROPY_PY_ZLIBD (0) #endif +#ifndef MICROPY_PY_SELECT +#define MICROPY_PY_SELECT (0) +#endif + /*****************************************************************************/ /* Hooks for a port to add builtins */ @@ -230,12 +230,14 @@ void mp_get_buffer_raise(mp_obj_t obj, mp_buffer_info_t *bufinfo, mp_uint_t flag // Stream protocol #define MP_STREAM_ERROR (-1) +#define MP_STREAM_FLUSH (1) +#define MP_STREAM_POLL (2) typedef struct _mp_stream_p_t { // On error, functions should return MP_STREAM_ERROR and fill in *errcode (values // are implementation-dependent, but will be exposed to user, e.g. via exception). mp_uint_t (*read)(mp_obj_t obj, void *buf, mp_uint_t size, int *errcode); mp_uint_t (*write)(mp_obj_t obj, const void *buf, mp_uint_t size, int *errcode); - // add seek() ? + mp_uint_t (*ioctl(mp_obj_t obj, mp_uint_t request, int *errcode, ...); mp_uint_t is_text : 1; // default is bytes, set this for text stream } mp_stream_p_t; |