Callback set via own structure.

This commit is contained in:
Florian Pose
2010-01-25 17:42:07 +01:00
parent 4d00c17e05
commit d910657cf8
3 changed files with 25 additions and 23 deletions
+11 -6
View File
@@ -49,22 +49,27 @@
struct ec_tty;
typedef struct ec_tty ec_tty_t; /**< \see ec_tty */
/**
* \param cflag_changed This callback function is called when the serial
* settings shall be changed. The \a cflag argument contains the new settings.
*/
typedef struct {
int (*cflag_changed)(void *, tcflag_t);
} ec_tty_operations_t;
/******************************************************************************
* Global functions
*****************************************************************************/
/** Create a virtual TTY interface.
*
* \param cflag_cb This callback function is called when the serial settings
* shall be changed. The \a cb_data argument is the same as the \a cb_data
* given on device creation, while the \a cflag argument contains the new
* settings.
* \param cb_data Arbitrary data to pass to callbacks.
* \param ops Set of callbacks.
* \param cb_data Arbitrary data, that is passed to any callback.
*
* \return Pointer to the interface object, otherwise an ERR_PTR value.
*/
ec_tty_t *ectty_create(
int (*cflag_cb)(void *cb_data, tcflag_t cflag),
const ec_tty_operations_t *ops,
void *cb_data
);