47 *****************************************************************************/ |
47 *****************************************************************************/ |
48 |
48 |
49 struct ec_tty; |
49 struct ec_tty; |
50 typedef struct ec_tty ec_tty_t; /**< \see ec_tty */ |
50 typedef struct ec_tty ec_tty_t; /**< \see ec_tty */ |
51 |
51 |
|
52 /** |
|
53 * \param cflag_changed This callback function is called when the serial |
|
54 * settings shall be changed. The \a cflag argument contains the new settings. |
|
55 */ |
|
56 typedef struct { |
|
57 int (*cflag_changed)(void *, tcflag_t); |
|
58 } ec_tty_operations_t; |
|
59 |
52 /****************************************************************************** |
60 /****************************************************************************** |
53 * Global functions |
61 * Global functions |
54 *****************************************************************************/ |
62 *****************************************************************************/ |
55 |
63 |
56 /** Create a virtual TTY interface. |
64 /** Create a virtual TTY interface. |
57 * |
65 * |
58 * \param cflag_cb This callback function is called when the serial settings |
66 * \param ops Set of callbacks. |
59 * shall be changed. The \a cb_data argument is the same as the \a cb_data |
67 * \param cb_data Arbitrary data, that is passed to any callback. |
60 * given on device creation, while the \a cflag argument contains the new |
|
61 * settings. |
|
62 * \param cb_data Arbitrary data to pass to callbacks. |
|
63 * |
68 * |
64 * \return Pointer to the interface object, otherwise an ERR_PTR value. |
69 * \return Pointer to the interface object, otherwise an ERR_PTR value. |
65 */ |
70 */ |
66 ec_tty_t *ectty_create( |
71 ec_tty_t *ectty_create( |
67 int (*cflag_cb)(void *cb_data, tcflag_t cflag), |
72 const ec_tty_operations_t *ops, |
68 void *cb_data |
73 void *cb_data |
69 ); |
74 ); |
70 |
75 |
71 /****************************************************************************** |
76 /****************************************************************************** |
72 * TTY interface methods |
77 * TTY interface methods |