2020-03-14 22:30:05 +01:00
|
|
|
/* Copyright © 2020 tyrolyean
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _16550_H
|
|
|
|
#define _16550_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
/* Registers in the 16550 UART */
|
|
|
|
|
|
|
|
#define UART_REG_DLLS 0
|
|
|
|
#define UART_REG_DLMS 1
|
|
|
|
#define UART_REG_TXRX 0
|
|
|
|
#define UART_REG_IER 1
|
|
|
|
#define UART_REG_IIR 2
|
|
|
|
#define UART_REG_LCR 3
|
|
|
|
#define UART_REG_MCR 4
|
|
|
|
#define UART_REG_LSR 5
|
|
|
|
#define UART_REG_MSR 6
|
|
|
|
#define UART_REG_SCR 7
|
|
|
|
|
2020-03-26 23:53:14 +01:00
|
|
|
/* The printf function in the background performs automatic column wrapping by
|
|
|
|
* finding the first space character within 10 characters ofthe display columns
|
|
|
|
* and replacingit with a newline character
|
|
|
|
*/
|
|
|
|
#define DISPLAY_COLUMNS 80
|
|
|
|
|
2020-03-14 22:30:05 +01:00
|
|
|
void init_16550();
|
|
|
|
void write_to_uart(uint8_t addr, uint8_t data);
|
|
|
|
uint8_t read_from_uart(uint8_t addr);
|
|
|
|
|
|
|
|
void init_uart();
|
|
|
|
|
2020-03-17 16:31:31 +01:00
|
|
|
int println(const char* output,...);
|
2020-03-14 22:30:05 +01:00
|
|
|
int putchar_16550(char var, FILE *stream);
|
2020-03-17 16:31:31 +01:00
|
|
|
void writechar_16550(char var);
|
2020-03-14 22:30:05 +01:00
|
|
|
|
2020-03-15 22:14:50 +01:00
|
|
|
void routine_uart();
|
|
|
|
|
2020-03-14 22:30:05 +01:00
|
|
|
#endif
|