o-du/phy
Intel O-RAN/X-RAN Generated Doxygen Documentation
debug.h
Go to the documentation of this file.
1 /******************************************************************************
2 *
3 * Copyright (c) 2019 Intel.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *******************************************************************************/
18 
26 #ifndef _SAMPLEAPP__DEBUG_H_
27 #define _SAMPLEAPP__DEBUG_H_
28 
29 #include <stdio.h>
30 
31 #include "config.h"
32 
33 #define MAX_FILE_NAME_LEN (512)
34 #define MAX_PATH_NAME_LEN (1024)
35 
36 #ifdef _DEBUG
37  #define log_dbg(fmt, ...) \
38  fprintf(stderr, \
39  "DEBUG: %s(%d): " fmt "\n", \
40  __FILE__, \
41  __LINE__, ##__VA_ARGS__)
42 #else
43  #define log_dbg(fmt, ...)
44 #endif
45 
46 #if defined(_DEBUG) || defined(_VERBOSE)
47  #define log_wrn(fmt, ...) \
48  fprintf( \
49  stderr, \
50  "WARNING: %s(%d): " fmt "\n", \
51  __FILE__, \
52  __LINE__, ##__VA_ARGS__)
53 #else
54  #define log_dbg(fmt, ...)
55  #define log_wrn(fmt, ...)
56 #endif
57 
58 
59 #define log_err(fmt, ...) \
60  fprintf(stderr, \
61  "ERROR: %s(%d): " fmt "\n", \
62  __FILE__, \
63  __LINE__, ##__VA_ARGS__)
64 
65 
66 inline void ShowData(void* ptr, unsigned int size)
67 {
68  uint8_t *d = (uint8_t *)ptr;
69  unsigned int i;
70 
71  for(i = 0; i < size; i++)
72  {
73  if ( !(i & 0xf) )
74  printf("\n");
75  printf("%02x ", d[i]);
76  }
77  printf("\n");
78 }
79 
80 
81 #endif /* _SAMPLEAPP__DEBUG_H_ */
void ShowData(void *ptr, unsigned int size)
Definition: debug.h:66