]> git.cryptolib.org Git - avr-crypto-lib.git/blob - test_src/uart_ni.h
fixing E-Mail-Address & Copyright
[avr-crypto-lib.git] / test_src / uart_ni.h
1 /* uart_ni.h */
2 /*
3     This file is part of the AVR-uart_ni.
4     Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org)
5
6     This program is free software: you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation, either version 3 of the License, or
9     (at your option) any later version.
10
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19 /**
20  * \file     uart_ni.h
21  * \email    bg@nerilex.org
22  * \author   Daniel Otte
23  * \date     2009-07-24
24  * \license  GPLv3 or later
25  * \ingroup  uart_ni
26  * \brief    declaration for non-interrupt uart
27  */
28
29 #ifndef UART_NI_H_
30 #define UART_NI_H_
31
32 #include "config.h"
33 #include <stdint.h>
34
35 #if UART0_NI
36
37 /**
38  * \brief initialize uart0.
39  * This function initializes the first uart according to the parameter specified
40  * in config.h .
41  */
42 void uart0_init(void);
43
44 /**
45  * \brief send data through uart0.
46  * This function sends data through the first uart
47  * (the data size is defined in config.h).
48  * \param c data to send
49  */
50 void uart0_putc(uint16_t c);
51
52 /**
53  * \brief read data from uart0.
54  * This function reads data from the first uart
55  * (the data size is defined in config.h).
56  * \return data received by uart0
57  */
58 uint16_t uart0_getc(void);
59
60 /**
61  * \brief checks if data is available.
62  *
63  * This function checks the state of the input buffer of uart0 and
64  * returns if data is available or not.
65  * \return zero if no data is available else a value different from zero is returned
66  */
67 uint8_t uart0_dataavail(void);
68
69 #define uart0_flush()
70
71 #endif /* UART0_NI */
72
73 #if UART1_NI
74 /**
75  * \brief initialize uart1.
76  * This function initializes the second uart according to the parameter specifyed
77  * in config.h .
78  */
79 void uart1_init(void);
80
81 /**
82  * \brief send data through uart1.
83  * This function sends data through the second uart
84  * (the data size is defined in config.h).
85  * \param c data to send
86  */
87 void uart1_putc(uint16_t c);
88
89 /**
90  * \brief read data from uart1.
91  * This function reads data from the second uart
92  * (the data size is defined in config.h).
93  * \return data received by uart1
94  */
95 uint16_t uart1_getc(void);
96
97 /**
98  * \brief checks if data is available.
99  * This function checks the state of the input buffer of uart1 and
100  * returns if data is available or not.
101  * \return zero if no data is available else a value different from zero is returned
102  */
103 uint8_t uart1_dataavail(void);
104
105 #define uart1_flush()
106
107 #endif /* UART1_NI */
108
109 #endif /* UART_NI_H_ */