blob: cf441e5c3fb9c35c52ba0a400dc7def5f021fd72 [file] [log] [blame]
Christina Quast8be71e42014-12-02 13:06:01 +01001/* ----------------------------------------------------------------------------
2 * ATMEL Microcontroller Software Support
3 * ----------------------------------------------------------------------------
4 * Copyright (c) 2010, Atmel Corporation
5 *
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 * - Redistributions of source code must retain the above copyright notice,
12 * this list of conditions and the disclaimer below.
13 *
14 * Atmel's name may not be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
20 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
23 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 * ----------------------------------------------------------------------------
28 */
29
30/*
31 * This file Configures the target-dependent low level functions for character I/O.
32 */
33
34#include "board.h"
35#include <stdio.h>
36
37/* Disable semihosting */
38#pragma import(__use_no_semihosting_swi)
39
40struct __FILE { int handle;} ;
41FILE __stdout;
42FILE __stderr;
43
44/*------------------------------------------------------------------------------
45 * Outputs a character.
46 *------------------------------------------------------------------------------*/
47int fputc(int ch, FILE *f)
48{
49 if ((f == stdout) || (f == stderr))
50 {
51 UART_PutChar( ch ) ;
52 return ch ;
53 }
54 else
55 {
56 return EOF ;
57 }
58}
59
60/*------------------------------------------------------------------------------
61 * Returns the error status accumulated during file I/O.
62 *------------------------------------------------------------------------------*/
63int ferror( FILE *f )
64{
65 return EOF ;
66}
67
68
69void _ttywrch( int ch )
70{
71 UART_PutChar( (uint8_t)ch ) ;
72}
73
74void _sys_exit(int return_code)
75{
76 while ( 1 ) ; /* endless loop */
77}
78
79/*------------------------------------------------------------------------------
80 * Low level functions I/O for assert().
81 *------------------------------------------------------------------------------*/
82void __assert_puts(const char *str)
83{
84 printf("%s", str);
85}
86