iLLD_TC29x  1.0
Ifx_Console.h
Go to the documentation of this file.
1 /**
2  * \file Ifx_Console.h
3  * \brief Main Console module header file
4  *
5  * \version iLLD_1_0_0_11_0
6  * \copyright Copyright (c) 2013 Infineon Technologies AG. All rights reserved.
7  *
8  *
9  * IMPORTANT NOTICE
10  *
11  *
12  * Infineon Technologies AG (Infineon) is supplying this file for use
13  * exclusively with Infineon's microcontroller products. This file can be freely
14  * distributed within development tools that are supporting such microcontroller
15  * products.
16  *
17  * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
18  * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
19  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
20  * INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
21  * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
22  *
23  * \defgroup library_srvsw_sysse_comm_console Console
24  * This module implements "Main Console" functions
25  * \ingroup library_srvsw_sysse_comm
26  *
27  */
28 #ifndef IFX_CONSOLE_H
29 #define IFX_CONSOLE_H 1
30 
31 #include "StdIf/IfxStdIf_DPipe.h"
32 
33 //----------------------------------------------------------------------------------------
34 #if !defined(IFX_CFG_CONSOLE_INDENT_SIZE)
35 #define IFX_CFG_CONSOLE_INDENT_SIZE (4) /**<\brief Default indentation/alignment size */
36 #endif
37 
38 typedef struct
39 {
40  IfxStdIf_DPipe *standardIo; /**<\brief Pointer to the \ref IfxStdIf_DPipe object used as general console */
41  sint16 align; /**<\brief Variable for storing the actual (left)indentation level of the \ref Ifx_g_console */
42 } Ifx_Console;
43 
44 IFX_EXTERN Ifx_Console Ifx_g_console; /**< \brief Default main console global variable */
45 
46 //----------------------------------------------------------------------------------------
47 /** \addtogroup library_srvsw_sysse_comm_console
48  * \{ */
49 
50 #ifndef CONSOLE
51 
52 /* FIXME (Alann to discuss with Dian) there is no requirement to define multiple console, CONSOLE should be removed, and APIs used instead */
53 /** \brief Alias \ref Ifx_g_console object (by value) */
54 #define CONSOLE Ifx_g_console
55 
56 /** \brief Return pointer to the default console object
57  *
58  * User can override this function by defining new \ref CONSOLE macro and this function
59  * externally, e.g. inside Ifx_Cfg.h file.*/
61 {
63 }
64 
65 
66 #endif
67 
69 IFX_EXTERN boolean Ifx_Console_print(pchar format, ...);
70 IFX_EXTERN boolean Ifx_Console_printAlign(pchar format, ...);
71 
72 /**
73  * \brief Decrement the alignment/indentation using the given value
74  * \param value the increment. If value == 0, \ref IFX_CFG_CONSOLE_INDENT_SIZE will be used.
75  */
77 {
78  value = (sint16)(Ifx_g_console.align - ((value == 0U) ? IFX_CFG_CONSOLE_INDENT_SIZE : value));
79  Ifx_g_console.align = (value > 0) ? value : 0;
80 }
81 
82 
83 /**
84  * \brief Increment the alignment/indentation using the given value
85  * \param value the increment. If value == 0, \ref IFX_CFG_CONSOLE_INDENT_SIZE will be used.
86  */
88 {
89  Ifx_g_console.align += ((value == 0) ? (sint16)IFX_CFG_CONSOLE_INDENT_SIZE : value);
90 }
91 
92 
93 /** \} */
94 //----------------------------------------------------------------------------------------
95 #endif