tto_write_block()
Store bytes in a buffer
Synopsis:
#include <sys/io-char.h>
int tto_write_block( TTYDEV *dev,
char *buf,
unsigned int buf_size,
unsigned int *byte_cnt );Arguments:
- dev
- A pointer to the structure that represents the specific device that data has been received on.
- buf
- A buffer in which to place data.
- buf_size
- The size of the buffer.
- byte_cnt
- A pointer to the integer that, if not zero, is used as offset into buf,and which will contain number of bytes copied.
Description:
The tto_write_block() function copies the first
min(dev->obuf.cnt, buf_size - *byte_cnt) characters from the
obuf member of the TTYDEV structure to
buf + &byte_cnt. Stores the amount of bytes copied into
byte_cnt.
Returns:
EOK
Example:
int byte_cnt = 0;
while(byte_cnt != buf_size) {
tto_write_block(dev, buf, buf_size, &byte_cnt);
/* wait for more data */
}
Page updated:
