#include "tty.h"
#include "tty-priv.h"
#include "types.h"

static volatile uint32_t *_tty_addr;

void _tty_init(uint32_t *addr)
{
  _tty_addr = (volatile uint32_t *)addr;
}

int _tty_write(char *buffer, int length)
{
    int     i;
    int     nwritten = 0;

    for ( i=0 ; i < length ; i++ )
    {
      _tty_addr[TTY_WRITE] = buffer[i]; // write character
      nwritten++;
    }
    return nwritten;
}
