Rohan Gurav
/
Sean_AdiSense1000_V21
ADISense1000 Version 2.1 code base
Fork of AdiSense1000_V21 by
inc/adi_sense_log.h@27:567abf893938, 2018-03-26 (annotated)
- Committer:
- Dan O'Donovan
- Date:
- Mon Mar 26 20:28:05 2018 +0100
- Branch:
- v2.0
- Revision:
- 27:567abf893938
- Parent:
- 26:12d0204be712
- Child:
- 29:57edca10d78c
Adding host library and example code for v1.1 release
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
danodonovan | 26:12d0204be712 | 1 | /* |
danodonovan | 26:12d0204be712 | 2 | Copyright 2017 (c) Analog Devices, Inc. |
danodonovan | 26:12d0204be712 | 3 | |
danodonovan | 26:12d0204be712 | 4 | All rights reserved. |
danodonovan | 26:12d0204be712 | 5 | |
danodonovan | 26:12d0204be712 | 6 | Redistribution and use in source and binary forms, with or without |
danodonovan | 26:12d0204be712 | 7 | modification, are permitted provided that the following conditions are met: |
danodonovan | 26:12d0204be712 | 8 | - Redistributions of source code must retain the above copyright |
danodonovan | 26:12d0204be712 | 9 | notice, this list of conditions and the following disclaimer. |
danodonovan | 26:12d0204be712 | 10 | - Redistributions in binary form must reproduce the above copyright |
danodonovan | 26:12d0204be712 | 11 | notice, this list of conditions and the following disclaimer in |
danodonovan | 26:12d0204be712 | 12 | the documentation and/or other materials provided with the |
danodonovan | 26:12d0204be712 | 13 | distribution. |
danodonovan | 26:12d0204be712 | 14 | - Neither the name of Analog Devices, Inc. nor the names of its |
danodonovan | 26:12d0204be712 | 15 | contributors may be used to endorse or promote products derived |
danodonovan | 26:12d0204be712 | 16 | from this software without specific prior written permission. |
danodonovan | 26:12d0204be712 | 17 | - The use of this software may or may not infringe the patent rights |
danodonovan | 26:12d0204be712 | 18 | of one or more patent holders. This license does not release you |
danodonovan | 26:12d0204be712 | 19 | from the requirement that you obtain separate licenses from these |
danodonovan | 26:12d0204be712 | 20 | patent holders to use this software. |
danodonovan | 26:12d0204be712 | 21 | - Use of the software either in source or binary form, must be run |
danodonovan | 26:12d0204be712 | 22 | on or directly connected to an Analog Devices Inc. component. |
danodonovan | 26:12d0204be712 | 23 | |
danodonovan | 26:12d0204be712 | 24 | THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR |
danodonovan | 26:12d0204be712 | 25 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, |
danodonovan | 26:12d0204be712 | 26 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
danodonovan | 26:12d0204be712 | 27 | IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, |
danodonovan | 26:12d0204be712 | 28 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
danodonovan | 26:12d0204be712 | 29 | LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR |
danodonovan | 26:12d0204be712 | 30 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
danodonovan | 26:12d0204be712 | 31 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
danodonovan | 26:12d0204be712 | 32 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
danodonovan | 26:12d0204be712 | 33 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
danodonovan | 26:12d0204be712 | 34 | */ |
danodonovan | 26:12d0204be712 | 35 | |
Dan O'Donovan |
27:567abf893938 | 36 | /*! |
Dan O'Donovan |
27:567abf893938 | 37 | ****************************************************************************** |
Dan O'Donovan |
27:567abf893938 | 38 | * @file: adi_sense_log.h |
Dan O'Donovan |
27:567abf893938 | 39 | * @brief: ADISENSE OS-dependent wrapper layer for log functions |
Dan O'Donovan |
27:567abf893938 | 40 | *----------------------------------------------------------------------------- |
Dan O'Donovan |
27:567abf893938 | 41 | */ |
Dan O'Donovan |
27:567abf893938 | 42 | |
danodonovan | 26:12d0204be712 | 43 | #ifndef __ADI_SENSE_LOG_H__ |
danodonovan | 26:12d0204be712 | 44 | #define __ADI_SENSE_LOG_H__ |
danodonovan | 26:12d0204be712 | 45 | |
danodonovan | 26:12d0204be712 | 46 | #include "inc/adi_sense_types.h" |
danodonovan | 26:12d0204be712 | 47 | |
danodonovan | 26:12d0204be712 | 48 | /*! @ingroup ADISENSE_Host */ |
danodonovan | 26:12d0204be712 | 49 | |
danodonovan | 26:12d0204be712 | 50 | /*! @addtogroup ADISENSE_Log ADISENSE Host Logging functions |
danodonovan | 26:12d0204be712 | 51 | * @{ |
danodonovan | 26:12d0204be712 | 52 | */ |
danodonovan | 26:12d0204be712 | 53 | |
danodonovan | 26:12d0204be712 | 54 | /*! Macro function for logging an error message */ |
danodonovan | 26:12d0204be712 | 55 | #define ADI_SENSE_LOG_ERROR(...) \ |
danodonovan | 26:12d0204be712 | 56 | adi_sense_Log(ADI_SENSE_LOG_LEVEL_ERROR, "[ERROR] " __VA_ARGS__) |
danodonovan | 26:12d0204be712 | 57 | /*! Macro function for logging a warning message */ |
danodonovan | 26:12d0204be712 | 58 | #define ADI_SENSE_LOG_WARN(...) \ |
danodonovan | 26:12d0204be712 | 59 | adi_sense_Log(ADI_SENSE_LOG_LEVEL_WARN, "[WARN] " __VA_ARGS__) |
danodonovan | 26:12d0204be712 | 60 | /*! Macro function for logging an information message */ |
danodonovan | 26:12d0204be712 | 61 | #define ADI_SENSE_LOG_INFO(...) \ |
danodonovan | 26:12d0204be712 | 62 | adi_sense_Log(ADI_SENSE_LOG_LEVEL_INFO, "[INFO] " __VA_ARGS__) |
danodonovan | 26:12d0204be712 | 63 | /*! Macro function for logging a debug message */ |
danodonovan | 26:12d0204be712 | 64 | #define ADI_SENSE_LOG_DEBUG(...) \ |
danodonovan | 26:12d0204be712 | 65 | adi_sense_Log(ADI_SENSE_LOG_LEVEL_DEBUG, "[DEBUG] " __VA_ARGS__) |
danodonovan | 26:12d0204be712 | 66 | |
danodonovan | 26:12d0204be712 | 67 | /*! |
danodonovan | 26:12d0204be712 | 68 | * Log message priority levels |
danodonovan | 26:12d0204be712 | 69 | */ |
danodonovan | 26:12d0204be712 | 70 | typedef enum |
danodonovan | 26:12d0204be712 | 71 | { |
danodonovan | 26:12d0204be712 | 72 | ADI_SENSE_LOG_LEVEL_ERROR = 0, /*!< Error message priority */ |
danodonovan | 26:12d0204be712 | 73 | ADI_SENSE_LOG_LEVEL_WARN, /*!< Warning message priority */ |
danodonovan | 26:12d0204be712 | 74 | ADI_SENSE_LOG_LEVEL_INFO, /*!< Information message priority */ |
danodonovan | 26:12d0204be712 | 75 | ADI_SENSE_LOG_LEVEL_DEBUG, /*!< Debug message priority */ |
danodonovan | 26:12d0204be712 | 76 | } ADI_SENSE_LOG_LEVEL; |
danodonovan | 26:12d0204be712 | 77 | |
danodonovan | 26:12d0204be712 | 78 | |
danodonovan | 26:12d0204be712 | 79 | #ifdef __cplusplus |
Dan O'Donovan |
27:567abf893938 | 80 | extern "C" |
danodonovan | 26:12d0204be712 | 81 | { |
danodonovan | 26:12d0204be712 | 82 | #endif |
danodonovan | 26:12d0204be712 | 83 | |
danodonovan | 26:12d0204be712 | 84 | /*! |
danodonovan | 26:12d0204be712 | 85 | * @brief Initialise the Log interface and allocate resources. |
danodonovan | 26:12d0204be712 | 86 | * |
danodonovan | 26:12d0204be712 | 87 | * @return Status |
danodonovan | 26:12d0204be712 | 88 | * - #ADI_SENSE_SUCCESS Call completed successfully. |
danodonovan | 26:12d0204be712 | 89 | * - #ADI_SENSE_NO_MEM Failed to allocate memory for device context. |
danodonovan | 26:12d0204be712 | 90 | */ |
danodonovan | 26:12d0204be712 | 91 | ADI_SENSE_RESULT adi_sense_LogOpen( |
danodonovan | 26:12d0204be712 | 92 | void); |
danodonovan | 26:12d0204be712 | 93 | |
danodonovan | 26:12d0204be712 | 94 | /*! |
danodonovan | 26:12d0204be712 | 95 | * @brief Close the Log interface and free resources. |
danodonovan | 26:12d0204be712 | 96 | */ |
danodonovan | 26:12d0204be712 | 97 | void adi_sense_LogClose( |
danodonovan | 26:12d0204be712 | 98 | void); |
danodonovan | 26:12d0204be712 | 99 | |
danodonovan | 26:12d0204be712 | 100 | /*! |
danodonovan | 26:12d0204be712 | 101 | * @brief Print a log message to the platform log interface. |
danodonovan | 26:12d0204be712 | 102 | * |
danodonovan | 26:12d0204be712 | 103 | * @param[in] level Log message priority level |
danodonovan | 26:12d0204be712 | 104 | * @param[in] format Format string and variable argument list, if any |
danodonovan | 26:12d0204be712 | 105 | */ |
danodonovan | 26:12d0204be712 | 106 | void adi_sense_Log( |
danodonovan | 26:12d0204be712 | 107 | ADI_SENSE_LOG_LEVEL level, |
danodonovan | 26:12d0204be712 | 108 | const char * format, |
danodonovan | 26:12d0204be712 | 109 | ...); |
danodonovan | 26:12d0204be712 | 110 | |
danodonovan | 26:12d0204be712 | 111 | #ifdef __cplusplus |
danodonovan | 26:12d0204be712 | 112 | } |
danodonovan | 26:12d0204be712 | 113 | #endif |
danodonovan | 26:12d0204be712 | 114 | |
danodonovan | 26:12d0204be712 | 115 | /*! |
danodonovan | 26:12d0204be712 | 116 | * @} |
danodonovan | 26:12d0204be712 | 117 | */ |
danodonovan | 26:12d0204be712 | 118 | |
danodonovan | 26:12d0204be712 | 119 | #endif /* __ADI_SENSE_LOG_H__ */ |