Xemu [doxygen]
hyppo 0a42be3a057156924bc1b626a687bd6e27349c45 @ Sat 19 Mar 02:15:11 CET 2022
targets
rc2014
uart.c
Go to the documentation of this file.
1
/* RC2014 and generic Z80 SBC emulator
2
Part of the Xemu project, please visit: https://github.com/lgblgblgb/xemu
3
Copyright (C)2020 LGB (Gábor Lénárt) <lgblgblgb@gmail.com>
4
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
9
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
14
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
18
19
#include "
xemu/emutools.h
"
20
#include "
uart.h
"
21
22
#define UART_START_BITS 1
23
#define UART_STOP_BITS 1
24
#define UART_HAS_PARITY_BIT 0
25
26
int
cpu_cycles_per_uart_transfer
;
27
28
void
uart_init
(
int
baud_crystal_hz,
int
baud_rate,
int
cpu_hz )
29
{
30
cpu_cycles_per_uart_transfer
= (8 +
UART_START_BITS
+
UART_STOP_BITS
+
UART_HAS_PARITY_BIT
) * cpu_hz / baud_rate;
31
DEBUGPRINT
(
"UART: %d CPU cycles (CPU @ %.2fMHz) per UART character transfer"
NL
,
cpu_cycles_per_uart_transfer
, (
double
)cpu_hz / 1000000.0);
32
}
emutools.h
uart_init
void uart_init(int baud_crystal_hz, int baud_rate, int cpu_hz)
Definition:
uart.c:28
UART_STOP_BITS
#define UART_STOP_BITS
Definition:
uart.c:23
uart.h
DEBUGPRINT
#define DEBUGPRINT(...)
Definition:
emutools_basicdefs.h:171
cpu_cycles_per_uart_transfer
int cpu_cycles_per_uart_transfer
Definition:
uart.c:26
NL
#define NL
Definition:
fat32.c:37
UART_START_BITS
#define UART_START_BITS
Definition:
uart.c:22
UART_HAS_PARITY_BIT
#define UART_HAS_PARITY_BIT
Definition:
uart.c:24
Generated by
1.8.17