]> git.cryptolib.org Git - avr-crypto-lib.git/blob - test_src/main-test-common.c
fixing E-Mail-Address & Copyright
[avr-crypto-lib.git] / test_src / main-test-common.c
1 /* main-test-common.c */
2 /*
3     This file is part of the ARM-Crypto-Lib.
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 #include "main-test-common.h"
21
22 static
23 int std_stream_put(char c, FILE *f){
24     static uint8_t did_r = 0;
25     if(!did_r && c == '\n'){
26         uart0_putc('\r');
27     }
28     uart0_putc((char)c);
29     did_r = (c == '\r');
30     return 0;
31 }
32
33 static
34 int std_stream_get(FILE *f){
35     return (int)uart0_getc();
36 }
37
38 void main_setup(void){
39         DEBUG_INIT();
40         cli_rx = (cli_rx_fpt)uart0_getc;
41         cli_tx = (cli_tx_fpt)uart0_putc;
42         fdevopen(std_stream_put, std_stream_get);
43 }
44
45 void welcome_msg(const char *algoname){
46 /*
47     cli_putstr_P(PSTR("\r\n\r\nAVR-Crypto-Lib VS ("));
48         cli_putstr(algoname);
49         cli_putstr_P(PSTR("; "));
50         cli_putstr(__DATE__);
51         cli_putc(' ');
52         cli_putstr(__TIME__);
53         cli_putstr_P(PSTR(")\r\nloaded and running\r\n"));
54 */
55     printf_P(PSTR("\n\nAVR-Crypto-Lib VS (%s; %s %s)\nloaded and running\n"), algoname, __DATE__, __TIME__);
56 }