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.
31 lines
856 B
31 lines
856 B
/* ttyhandler.c - ttyhandler */ |
|
|
|
#include <xinu.h> |
|
|
|
/*------------------------------------------------------------------------ |
|
* ttyhandler - Handle an interrupt for a tty (serial) device |
|
*------------------------------------------------------------------------ |
|
*/ |
|
void ttyhandler(uint32 xnum, char c, int flag) { |
|
const __flash struct dentry *devptr; /* Address of device control blk*/ |
|
struct ttycblk *typtr; /* Pointer to ttytab entry */ |
|
struct uart_csreg *csrptr; /* Address of UART's CSR */ |
|
|
|
/* Get CSR address of the device (assume console for now) */ |
|
|
|
devptr = (struct dentry *) &devtab[CONSOLE]; |
|
|
|
/* Obtain a pointer to the tty control block */ |
|
|
|
typtr = &ttytab[devptr->dvminor]; |
|
|
|
/* Test type of UART interrupt */ |
|
|
|
/* AVR */ |
|
|
|
if (flag) /* TX */ |
|
ttyhandle_out(typtr, csrptr); |
|
else /* RX */ |
|
ttyhandle_in(typtr, csrptr, c); |
|
|
|
}
|
|
|