mirror of https://github.com/zrafa/xinu-avr.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
771 B
30 lines
771 B
/* ttywrite.c - ttywrite */ |
|
|
|
#include <xinu.h> |
|
|
|
/*------------------------------------------------------------------------ |
|
* ttywrite - Write character(s) to a tty device (interrupts disabled) |
|
*------------------------------------------------------------------------ |
|
*/ |
|
devcall ttywrite( |
|
// struct dentry *devptr, /* Entry in device switch table */ |
|
const __flash struct dentry *devptr, /* Entry in device switch table */ |
|
char *buff, /* Buffer of characters */ |
|
int32 count /* Count of character to write */ |
|
) |
|
{ |
|
/* Handle negative and zero counts */ |
|
|
|
if (count < 0) { |
|
return SYSERR; |
|
} else if (count == 0){ |
|
return OK; |
|
} |
|
|
|
/* Write count characters one at a time */ |
|
|
|
for (; count>0 ; count--) { |
|
ttyputc(devptr, *buff++); |
|
} |
|
return OK; |
|
}
|
|
|