blob: 9c5fbcf3ef706504964953723764e95bdb778d6b [file] [log] [blame]
alexander3c798932021-03-26 21:42:19 +00001/*
2 * Copyright (c) 2021 Arm Limited. All rights reserved.
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17#ifndef UART_STDOUT_H
18#define UART_STDOUT_H
19
20#include <stdbool.h>
21
22/**
23 * @brief Initialised the UART block.
24 **/
25extern void UartStdOutInit(void);
26
27/**
28 * @brief Transmits a character over UART (blocking call).
29 * @param[in] my_ch Character to be transmitted.
30 * @return Character transmitted.
31 **/
32extern unsigned char UartPutc(unsigned char my_ch);
33
34/**
35 * @brief Receives a character from the UART block (blocking call).
36 * @return Character received.
37 **/
38extern unsigned char UartGetc(void);
39
40/**
41 * @brief Reads characters from the UART block until a line feed or
42 * carriage return terminates the function. NULL character
43 * also terminates the function, error is returned.
44 * @param[out] lp Characters read from the UART block.
45 * @param[in] len Character to be transmitted.
46 * @return true if successful, false otherwise.
47 **/
48extern bool GetLine(char *lp, unsigned int len);
49
50/**
51 * @brief Terminates UART simulation. This is useful when a Fixed
52 * Virtual Platform's session needs to be gracefully terminated.
53 * @param[in] code Terminating code displayed on the UART before the end of the simulation.
54 **/
55extern void UartEndSimulation(int code);
56
57#endif /* UART_STDOUT_H */