-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic_stdio_core.c
More file actions
67 lines (60 loc) · 2.06 KB
/
Copy pathbasic_stdio_core.c
File metadata and controls
67 lines (60 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
******************************************************************************
* @file basic_stdio_core.c
* @brief This file contains the basic stdio utility functions based on ITM.
******************************************************************************
* @attention
*
* Copyright (c) 2026 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "basic_stdio_core.h"
#include "basic_stdio_itf_io.h"
/* Private defines -----------------------------------------------------------*/
/* Private macros ------------------------------------------------------------*/
/* Private typedef -----------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Functions Definition ------------------------------------------------------*/
/**
* @addtogroup BASIC_STDIO_API BASIC_STDIO Public API
* @{
*/
/**
* @brief Initialize stdio interface redirection to the selected io interface.
* @param pobj Pointer to the output interface context object.
* @note This parameter need to be NULL when using ITM which requires no context.
*/
void BASIC_STDIO_Init(void *pobj)
{
interface_io_Init(pobj);
}
/**
* @}
*/
#if defined(WRITE_PROTO)
WRITE_PROTO(file, ptr, len)
{
(void)(file); /* prevent "unused variable" warnings */
return interface_io_Send((const uint8_t *)ptr, (uint16_t)len);
}
#else
int fputc(int c, FILE *f)
{
(void)(f); /* prevent "unused variable" warnings */
uint32_t res;
res = interface_io_Send((const uint8_t *)&c, 1U);
if (res != 1U)
{
return EOF;
}
return (int)res;
}
#endif /* WRITE_PROTO */