X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=o-du%2Fphy.git;a=blobdiff_plain;f=fhi_lib%2Fapp%2Fsrc%2Fdebug.h;fp=fhi_lib%2Fapp%2Fsrc%2Fdebug.h;h=d0482a8362b6934ccfd0a89ec80dc423af7f4f29;hp=0000000000000000000000000000000000000000;hb=cef07f74965b1749dd909fc1322e211489fea2ea;hpb=bc60e3a69129edf1c21a01683f84a77483f6e3cc diff --git a/fhi_lib/app/src/debug.h b/fhi_lib/app/src/debug.h new file mode 100644 index 0000000..d0482a8 --- /dev/null +++ b/fhi_lib/app/src/debug.h @@ -0,0 +1,82 @@ +/****************************************************************************** +* +* Copyright (c) 2019 Intel. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*******************************************************************************/ + + +/** + * @brief + * @file + * @ingroup + * @author Intel Corporation + **/ + +#ifndef _SAMPLEAPP__DEBUG_H_ +#define _SAMPLEAPP__DEBUG_H_ + +#include + +#include "config.h" + +#define MAX_FILE_NAME_LEN (512) +#define MAX_PATH_NAME_LEN (1024) + +#ifdef _DEBUG + #define log_dbg(fmt, ...) \ + fprintf(stderr, \ + "DEBUG: %s(%d): " fmt "\n", \ + __FILE__, \ + __LINE__, ##__VA_ARGS__) +#else + #define log_dbg(fmt, ...) +#endif + +#if defined(_DEBUG) || defined(_VERBOSE) + #define log_wrn(fmt, ...) \ + fprintf( \ + stderr, \ + "WARNING: %s(%d): " fmt "\n", \ + __FILE__, \ + __LINE__, ##__VA_ARGS__) +#else + #define log_dbg(fmt, ...) + #define log_wrn(fmt, ...) +#endif + + +#define log_err(fmt, ...) \ + fprintf(stderr, \ + "ERROR: %s(%d): " fmt "\n", \ + __FILE__, \ + __LINE__, ##__VA_ARGS__) + + +inline void ShowData(void* ptr, unsigned int size) +{ + uint8_t *d = (uint8_t *)ptr; + unsigned int i; + + for(i = 0; i < size; i++) + { + if ( !(i & 0xf) ) + printf("\n"); + printf("%02x ", d[i]); + } + printf("\n"); +} + + +#endif /* _SAMPLEAPP__DEBUG_H_ */