Kashish Haresh Shah
/
HXCClientShield
HXC Client Shield Repository.
Driver/debug.h@3:5e1a54378107, 2021-04-19 (annotated)
- Committer:
- kashish_mbed
- Date:
- Mon Apr 19 17:43:09 2021 +0000
- Revision:
- 3:5e1a54378107
- Parent:
- 0:bacc6e701fb4
Successful Build file with CmdProcess Functionality
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kashish_mbed | 0:bacc6e701fb4 | 1 | /****************************************************************************** |
kashish_mbed | 0:bacc6e701fb4 | 2 | * @file debug.h |
kashish_mbed | 0:bacc6e701fb4 | 3 | * @author MCD Application Team |
kashish_mbed | 0:bacc6e701fb4 | 4 | * @version V1.1.4 |
kashish_mbed | 0:bacc6e701fb4 | 5 | * @date 08-January-2018 |
kashish_mbed | 0:bacc6e701fb4 | 6 | * @brief Header for driver debug.c module |
kashish_mbed | 0:bacc6e701fb4 | 7 | ****************************************************************************** |
kashish_mbed | 0:bacc6e701fb4 | 8 | * @attention |
kashish_mbed | 0:bacc6e701fb4 | 9 | * |
kashish_mbed | 0:bacc6e701fb4 | 10 | * <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V. |
kashish_mbed | 0:bacc6e701fb4 | 11 | * All rights reserved.</center></h2> |
kashish_mbed | 0:bacc6e701fb4 | 12 | * |
kashish_mbed | 0:bacc6e701fb4 | 13 | * Redistribution and use in source and binary forms, with or without |
kashish_mbed | 0:bacc6e701fb4 | 14 | * modification, are permitted, provided that the following conditions are met: |
kashish_mbed | 0:bacc6e701fb4 | 15 | * |
kashish_mbed | 0:bacc6e701fb4 | 16 | * 1. Redistribution of source code must retain the above copyright notice, |
kashish_mbed | 0:bacc6e701fb4 | 17 | * this list of conditions and the following disclaimer. |
kashish_mbed | 0:bacc6e701fb4 | 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
kashish_mbed | 0:bacc6e701fb4 | 19 | * this list of conditions and the following disclaimer in the documentation |
kashish_mbed | 0:bacc6e701fb4 | 20 | * and/or other materials provided with the distribution. |
kashish_mbed | 0:bacc6e701fb4 | 21 | * 3. Neither the name of STMicroelectronics nor the names of other |
kashish_mbed | 0:bacc6e701fb4 | 22 | * contributors to this software may be used to endorse or promote products |
kashish_mbed | 0:bacc6e701fb4 | 23 | * derived from this software without specific written permission. |
kashish_mbed | 0:bacc6e701fb4 | 24 | * 4. This software, including modifications and/or derivative works of this |
kashish_mbed | 0:bacc6e701fb4 | 25 | * software, must execute solely and exclusively on microcontroller or |
kashish_mbed | 0:bacc6e701fb4 | 26 | * microprocessor devices manufactured by or for STMicroelectronics. |
kashish_mbed | 0:bacc6e701fb4 | 27 | * 5. Redistribution and use of this software other than as permitted under |
kashish_mbed | 0:bacc6e701fb4 | 28 | * this license is void and will automatically terminate your rights under |
kashish_mbed | 0:bacc6e701fb4 | 29 | * this license. |
kashish_mbed | 0:bacc6e701fb4 | 30 | * |
kashish_mbed | 0:bacc6e701fb4 | 31 | * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" |
kashish_mbed | 0:bacc6e701fb4 | 32 | * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT |
kashish_mbed | 0:bacc6e701fb4 | 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A |
kashish_mbed | 0:bacc6e701fb4 | 34 | * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY |
kashish_mbed | 0:bacc6e701fb4 | 35 | * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT |
kashish_mbed | 0:bacc6e701fb4 | 36 | * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
kashish_mbed | 0:bacc6e701fb4 | 37 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
kashish_mbed | 0:bacc6e701fb4 | 38 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, |
kashish_mbed | 0:bacc6e701fb4 | 39 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
kashish_mbed | 0:bacc6e701fb4 | 40 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
kashish_mbed | 0:bacc6e701fb4 | 41 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
kashish_mbed | 0:bacc6e701fb4 | 42 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
kashish_mbed | 0:bacc6e701fb4 | 43 | * |
kashish_mbed | 0:bacc6e701fb4 | 44 | ****************************************************************************** |
kashish_mbed | 0:bacc6e701fb4 | 45 | */ |
kashish_mbed | 0:bacc6e701fb4 | 46 | |
kashish_mbed | 0:bacc6e701fb4 | 47 | /* Define to prevent recursive inclusion -------------------------------------*/ |
kashish_mbed | 0:bacc6e701fb4 | 48 | #ifndef __DEBUG_H__ |
kashish_mbed | 0:bacc6e701fb4 | 49 | #define __DEBUG_H__ |
kashish_mbed | 0:bacc6e701fb4 | 50 | |
kashish_mbed | 0:bacc6e701fb4 | 51 | #ifdef __cplusplus |
kashish_mbed | 0:bacc6e701fb4 | 52 | extern "C" { |
kashish_mbed | 0:bacc6e701fb4 | 53 | #endif |
kashish_mbed | 0:bacc6e701fb4 | 54 | |
kashish_mbed | 0:bacc6e701fb4 | 55 | /* Includes ------------------------------------------------------------------*/ |
kashish_mbed | 0:bacc6e701fb4 | 56 | |
kashish_mbed | 0:bacc6e701fb4 | 57 | |
kashish_mbed | 0:bacc6e701fb4 | 58 | |
kashish_mbed | 0:bacc6e701fb4 | 59 | #include <string.h> |
kashish_mbed | 0:bacc6e701fb4 | 60 | #include <stdio.h> |
kashish_mbed | 3:5e1a54378107 | 61 | #include <stdint.h> |
kashish_mbed | 0:bacc6e701fb4 | 62 | #include "hw_conf.h" |
kashish_mbed | 0:bacc6e701fb4 | 63 | //#include "vcom.h" /* if vcom is used for trace purpose*/ |
kashish_mbed | 0:bacc6e701fb4 | 64 | |
kashish_mbed | 0:bacc6e701fb4 | 65 | /* Exported types ------------------------------------------------------------*/ |
kashish_mbed | 0:bacc6e701fb4 | 66 | /* Exported constants --------------------------------------------------------*/ |
kashish_mbed | 0:bacc6e701fb4 | 67 | /* External variables --------------------------------------------------------*/ |
kashish_mbed | 0:bacc6e701fb4 | 68 | /* Exported macros -----------------------------------------------------------*/ |
kashish_mbed | 0:bacc6e701fb4 | 69 | /* Exported functions ------------------------------------------------------- */ |
kashish_mbed | 0:bacc6e701fb4 | 70 | |
kashish_mbed | 0:bacc6e701fb4 | 71 | void DBG_Init( void ); |
kashish_mbed | 0:bacc6e701fb4 | 72 | |
kashish_mbed | 0:bacc6e701fb4 | 73 | void Error_Handler( void ); |
kashish_mbed | 0:bacc6e701fb4 | 74 | /** |
kashish_mbed | 0:bacc6e701fb4 | 75 | * @brief Sends string on debug com port |
kashish_mbed | 0:bacc6e701fb4 | 76 | * @param String |
kashish_mbed | 0:bacc6e701fb4 | 77 | * @retval None |
kashish_mbed | 0:bacc6e701fb4 | 78 | */ |
kashish_mbed | 0:bacc6e701fb4 | 79 | void Debug_UART_SendBytes(const char *format, ...); |
kashish_mbed | 0:bacc6e701fb4 | 80 | void Debug_UART_Init(void); |
kashish_mbed | 3:5e1a54378107 | 81 | uint8_t Debug_Read_Char(char * c); |
kashish_mbed | 3:5e1a54378107 | 82 | void Debug_Reset_Input_Buffer(void); |
kashish_mbed | 0:bacc6e701fb4 | 83 | |
kashish_mbed | 0:bacc6e701fb4 | 84 | #ifdef DEBUG |
kashish_mbed | 0:bacc6e701fb4 | 85 | |
kashish_mbed | 0:bacc6e701fb4 | 86 | #define DBG_GPIO_WRITE( gpio, n, x ) HAL_GPIO_WritePin( gpio, n, (GPIO_PinState)(x) ) |
kashish_mbed | 0:bacc6e701fb4 | 87 | |
kashish_mbed | 0:bacc6e701fb4 | 88 | #define DBG_GPIO_SET( gpio, n ) gpio->BSRR = n |
kashish_mbed | 0:bacc6e701fb4 | 89 | |
kashish_mbed | 0:bacc6e701fb4 | 90 | #define DBG_GPIO_RST( gpio, n ) gpio->BRR = n |
kashish_mbed | 0:bacc6e701fb4 | 91 | |
kashish_mbed | 0:bacc6e701fb4 | 92 | #define DBG_RTC_OUTPUT RTC_OUTPUT_DISABLE; /* RTC_OUTPUT_ALARMA on PC13 */ |
kashish_mbed | 0:bacc6e701fb4 | 93 | |
kashish_mbed | 0:bacc6e701fb4 | 94 | #define DBG( x ) do{ x } while(0) |
kashish_mbed | 0:bacc6e701fb4 | 95 | |
kashish_mbed | 0:bacc6e701fb4 | 96 | #ifdef TRACE |
kashish_mbed | 0:bacc6e701fb4 | 97 | |
kashish_mbed | 0:bacc6e701fb4 | 98 | #define DBG_PRINTF(...) printf(__VA_ARGS__) /*vcom_Send(__VA_ARGS__)*/ |
kashish_mbed | 0:bacc6e701fb4 | 99 | |
kashish_mbed | 0:bacc6e701fb4 | 100 | #define DBG_PRINTF_CRITICAL(...) /*vcom_Send_Lp(__VA_ARGS__)*/ |
kashish_mbed | 0:bacc6e701fb4 | 101 | |
kashish_mbed | 0:bacc6e701fb4 | 102 | #else /*TRACE*/ |
kashish_mbed | 0:bacc6e701fb4 | 103 | |
kashish_mbed | 0:bacc6e701fb4 | 104 | #define DBG_PRINTF(...) |
kashish_mbed | 0:bacc6e701fb4 | 105 | |
kashish_mbed | 0:bacc6e701fb4 | 106 | #define DBG_PRINTF_CRITICAL(...) |
kashish_mbed | 0:bacc6e701fb4 | 107 | |
kashish_mbed | 0:bacc6e701fb4 | 108 | #endif /*TRACE*/ |
kashish_mbed | 0:bacc6e701fb4 | 109 | |
kashish_mbed | 0:bacc6e701fb4 | 110 | |
kashish_mbed | 0:bacc6e701fb4 | 111 | #else /* DEBUG */ |
kashish_mbed | 0:bacc6e701fb4 | 112 | |
kashish_mbed | 0:bacc6e701fb4 | 113 | #define DBG_GPIO_WRITE( gpio, n, x ) |
kashish_mbed | 0:bacc6e701fb4 | 114 | |
kashish_mbed | 0:bacc6e701fb4 | 115 | #define DBG_GPIO_SET( gpio, n ) |
kashish_mbed | 0:bacc6e701fb4 | 116 | |
kashish_mbed | 0:bacc6e701fb4 | 117 | #define DBG_GPIO_RST( gpio, n ) |
kashish_mbed | 0:bacc6e701fb4 | 118 | |
kashish_mbed | 0:bacc6e701fb4 | 119 | #define DBG( x ) do{ } while(0) |
kashish_mbed | 0:bacc6e701fb4 | 120 | |
kashish_mbed | 0:bacc6e701fb4 | 121 | #define DBG_PRINTF(...) Debug_UART_SendBytes(__VA_ARGS__) |
kashish_mbed | 0:bacc6e701fb4 | 122 | |
kashish_mbed | 0:bacc6e701fb4 | 123 | #define DBG_PRINTF_CRITICAL(...) |
kashish_mbed | 0:bacc6e701fb4 | 124 | |
kashish_mbed | 0:bacc6e701fb4 | 125 | #define DBG_RTC_OUTPUT RTC_OUTPUT_DISABLE; |
kashish_mbed | 0:bacc6e701fb4 | 126 | |
kashish_mbed | 0:bacc6e701fb4 | 127 | #endif /* DEBUG */ |
kashish_mbed | 0:bacc6e701fb4 | 128 | |
kashish_mbed | 0:bacc6e701fb4 | 129 | #ifdef __cplusplus |
kashish_mbed | 0:bacc6e701fb4 | 130 | } |
kashish_mbed | 0:bacc6e701fb4 | 131 | #endif |
kashish_mbed | 0:bacc6e701fb4 | 132 | |
kashish_mbed | 0:bacc6e701fb4 | 133 | #endif /* __DEBUG_H__*/ |
kashish_mbed | 0:bacc6e701fb4 | 134 | |
kashish_mbed | 0:bacc6e701fb4 | 135 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
kashish_mbed | 0:bacc6e701fb4 | 136 |