Lazuli
Loading...
Searching...
No Matches
usart.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: GPL-3.0-only
3 * This file is part of Lazuli.
4 */
5
14#ifndef LAZULI_SYS_ARCH_AVR_USART_H
15#define LAZULI_SYS_ARCH_AVR_USART_H
16
17#include <stdint.h>
18
19#include <Lazuli/common.h>
20
22
23/*
24 * USART Register Definitions.
25 * Ordered by address.
26 */
27
29#define UCSR0A DIRECT(0xc0)
30
32#define UCSR0B DIRECT(0xc1)
33
35#define UCSR0C DIRECT(0xc2)
36
38#define UBRROL DIRECT(0xc4)
39
41#define UBRR0H DIRECT(0xc5)
42
44#define UDR0 DIRECT(0xc6)
45
49typedef struct {
50 volatile uint8_t ucsr0a;
51 volatile uint8_t ucsr0b;
52 volatile uint8_t ucsr0c;
53 volatile uint8_t _reserved;
54 volatile uint8_t ubrr0l;
55 volatile uint8_t ubrr0h;
56 volatile uint8_t udr0;
57}Usart;
58
62enum {
71};
72
76enum {
85};
86
90enum {
99};
100
102
103#endif /* LAZULI_SYS_ARCH_AVR_USART_H */
unsigned char uint8_t
Represents a unsigned integer type with width of exactly 8 bits.
Definition stdint.h:89
Basic type definitions and useful macros.
#define _EXTERN_C_DECL_BEGIN
Open C++ header file declarations.
Definition common.h:39
#define _EXTERN_C_DECL_END
Close C++ header file declarations.
Definition common.h:44
#define POSITION(X)
Define a constant bit at position X, starting from index 0.
Definition common_asm.h:30
Describes the memory mapping for the USART.
Definition usart.h:49
volatile uint8_t ucsr0b
USART Control and Status Register B.
Definition usart.h:51
volatile uint8_t ucsr0c
USART Control and Status Register C.
Definition usart.h:52
volatile uint8_t ucsr0a
USART Control and Status Register A.
Definition usart.h:50
volatile uint8_t ubrr0l
USART Baud Rate Register low
Definition usart.h:54
volatile uint8_t _reserved
Unsed
Definition usart.h:53
volatile uint8_t udr0
USART I/O Data Register
Definition usart.h:56
volatile uint8_t ubrr0h
USART Baud Rate Register high
Definition usart.h:55
@ UCSR0A_RXC0
USART Receive Complete
Definition usart.h:63
@ UCSR0A_UPE0
USART Parity Error
Definition usart.h:68
@ UCSR0A_MPCM0
Multi-processor Communication Mode.
Definition usart.h:70
@ UCSR0A_FE0
Frame Error
Definition usart.h:66
@ UCSR0A_TXC0
USART Transmit Complete
Definition usart.h:64
@ UCSR0A_UDRE0
USART Data Register Empty
Definition usart.h:65
@ UCSR0A_DOR0
Data OverRun
Definition usart.h:67
@ UCSR0A_U2X0
Double USART Transmission Speed
Definition usart.h:69
@ UCSR0B_TXCIE0
TX Complete Interrupt Enable
Definition usart.h:78
@ UCSR0B_UCSZ02
Character Size 2
Definition usart.h:82
@ UCSR0B_RXEN0
Receiver Enable
Definition usart.h:80
@ UCSR0B_RXCIE0
RX Complete Interrupt Enable
Definition usart.h:77
@ UCSR0B_UDRIE0
Data Register Empty Interrupt Enable.
Definition usart.h:79
@ UCSR0B_RXB80
Receive Data Bit 8
Definition usart.h:83
@ UCSR0B_TXEN0
Transmitter Enable
Definition usart.h:81
@ UCSR0B_TXB80
Transmit Data Bit 8
Definition usart.h:84
@ UCSR0C_UCPOL0
Clock Polarity
Definition usart.h:98
@ UCSR0C_UMSEL01
USART Mode Select 1.
Definition usart.h:91
@ UCSR0C_UPM01
Parity Mode 1
Definition usart.h:93
@ UCSR0C_UCSZ00
Character Size 0
Definition usart.h:97
@ UCSR0C_UMSEL00
USART Mode Select 0.
Definition usart.h:92
@ UCSR0C_UPM00
Parity Mode 0
Definition usart.h:94
@ UCSR0C_USBS0
Stop Bit Select
Definition usart.h:95
@ UCSR0C_UCSZ01
Character size 1
Definition usart.h:96