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.
58 lines
2.2 KiB
58 lines
2.2 KiB
/* ttyinit.c - ttyinit */ |
|
|
|
#include <xinu.h> |
|
|
|
struct ttycblk ttytab[Ntty]; |
|
|
|
/*------------------------------------------------------------------------ |
|
* ttyinit - Initialize buffers and modes for a tty line |
|
*------------------------------------------------------------------------ |
|
*/ |
|
devcall ttyinit( |
|
// struct dentry *devptr /* Entry in device switch table */ |
|
const __flash struct dentry *devptr /* Entry in device switch table */ |
|
) |
|
{ |
|
struct ttycblk *typtr; /* Pointer to ttytab entry */ |
|
// struct uart_csreg *uptr; /* Address of UART's CSRs */ |
|
|
|
typtr = &ttytab[ devptr->dvminor ]; |
|
|
|
/* Initialize values in the tty control block */ |
|
|
|
typtr->tyihead = typtr->tyitail = /* Set up input queue */ |
|
&typtr->tyibuff[0]; /* as empty */ |
|
typtr->tyisem = semcreate(0); /* Input semaphore */ |
|
typtr->tyohead = typtr->tyotail = /* Set up output queue */ |
|
&typtr->tyobuff[0]; /* as empty */ |
|
typtr->tyosem = semcreate(TY_OBUFLEN); /* Output semaphore */ |
|
typtr->tyehead = typtr->tyetail = /* Set up echo queue */ |
|
&typtr->tyebuff[0]; /* as empty */ |
|
typtr->tyimode = TY_IMCOOKED; /* Start in cooked mode */ |
|
typtr->tyiecho = TRUE; /* Echo console input */ |
|
typtr->tyieback = TRUE; /* Honor erasing bksp */ |
|
typtr->tyevis = TRUE; /* Visual control chars */ |
|
typtr->tyecrlf = TRUE; /* Echo CRLF for NEWLINE*/ |
|
typtr->tyicrlf = TRUE; /* Map CR to NEWLINE */ |
|
typtr->tyierase = TRUE; /* Do erasing backspace */ |
|
typtr->tyierasec = TY_BACKSP; /* Primary erase char */ |
|
typtr->tyierasec2= TY_BACKSP2; /* Alternate erase char */ |
|
typtr->tyeof = TRUE; /* Honor eof on input */ |
|
typtr->tyeofch = TY_EOFCH; /* End-of-file character*/ |
|
typtr->tyikill = TRUE; /* Allow line kill */ |
|
typtr->tyikillc = TY_KILLCH; /* Set line kill to ^U */ |
|
typtr->tyicursor = 0; /* Start of input line */ |
|
typtr->tyoflow = TRUE; /* Handle flow control */ |
|
typtr->tyoheld = FALSE; /* Output not held */ |
|
typtr->tyostop = TY_STOPCH; /* Stop char is ^S */ |
|
typtr->tyostart = TY_STRTCH; /* Start char is ^Q */ |
|
typtr->tyocrlf = TRUE; /* Send CRLF for NEWLINE*/ |
|
typtr->tyifullc = TY_FULLCH; /* Send ^G when buffer */ |
|
/* is full */ |
|
|
|
/* Initialize UART */ |
|
/* avr: TODO port uart to here */ |
|
|
|
// ttykickout(uptr); |
|
return OK; |
|
}
|
|
|