Commit 630ee18b authored by Robert Schmidt's avatar Robert Schmidt

Use BladeRF log level directly without OAI Log Levels

- bladerf depends on UTIL via common_lib.h
- use header guards
parent 91329928
pkg_check_modules(bladeRF REQUIRED libbladeRF) pkg_check_modules(bladeRF REQUIRED libbladeRF)
add_library(oai_bladerfdevif MODULE bladerf_lib.c) add_library(oai_bladerfdevif MODULE bladerf_lib.c)
target_link_libraries(oai_bladerfdevif PRIVATE bladeRF) target_link_libraries(oai_bladerfdevif PRIVATE bladeRF)
target_link_libraries(oai_bladerfdevif PRIVATE UTIL)
set_target_properties(oai_bladerfdevif PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) set_target_properties(oai_bladerfdevif PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
add_custom_command(TARGET oai_bladerfdevif POST_BUILD add_custom_command(TARGET oai_bladerfdevif POST_BUILD
COMMAND ${CMAKE_COMMAND} -E create_symlink liboai_bladerfdevif.so liboai_device.so COMMAND ${CMAKE_COMMAND} -E create_symlink liboai_bladerfdevif.so liboai_device.so
......
...@@ -1131,7 +1131,16 @@ int device_init(openair0_device *device, ...@@ -1131,7 +1131,16 @@ int device_init(openair0_device *device,
printf("[BRF] calibration OK\n"); printf("[BRF] calibration OK\n");
#endif #endif
bladerf_log_set_verbosity(get_brf_log_level(openair0_cfg->log_level)); /* set log to info, available log levels are:
* - BLADERF_LOG_LEVEL_VERBOSE
* - BLADERF_LOG_LEVEL_DEBUG
* - BLADERF_LOG_LEVEL_INFO
* - BLADERF_LOG_LEVEL_WARNING
* - BLADERF_LOG_LEVEL_ERROR
* - BLADERF_LOG_LEVEL_CRITICAL
* - BLADERF_LOG_LEVEL_SILENT
*/
bladerf_log_set_verbosity(BLADERF_LOG_LEVEL_INFO);
printf("BLADERF: Initializing openair0_device\n"); printf("BLADERF: Initializing openair0_device\n");
device->Mod_id = num_devices++; device->Mod_id = num_devices++;
...@@ -1208,38 +1217,4 @@ struct bladerf * open_bladerf_from_serial(const char *serial) ...@@ -1208,38 +1217,4 @@ struct bladerf * open_bladerf_from_serial(const char *serial)
return dev; return dev;
} }
} }
/*! \brief Get BladeRF log level
* \param log_level log level
* \returns log level of BLADERF device
*/
int get_brf_log_level(int log_level)
{
int level=BLADERF_LOG_LEVEL_INFO;
return BLADERF_LOG_LEVEL_INFO;
switch(log_level) {
case LOG_DEBUG:
level=BLADERF_LOG_LEVEL_DEBUG;
break;
case LOG_INFO:
level= BLADERF_LOG_LEVEL_INFO;
break;
case LOG_WARNING:
level=BLADERF_LOG_LEVEL_WARNING;
break;
case LOG_ERR:
level=BLADERF_LOG_LEVEL_ERROR;
break;
case LOG_CRIT:
level=BLADERF_LOG_LEVEL_CRITICAL;
break;
case LOG_EMERG:
level = BLADERF_LOG_LEVEL_SILENT;
break;
default:
break;
}
return level;
}
/*@}*/ /*@}*/
...@@ -24,10 +24,12 @@ ...@@ -24,10 +24,12 @@
* Author: navid nikaein * Author: navid nikaein
*/ */
#ifndef BLADERF_LIB_H
#define BLADERF_LIB_H
#include <libbladeRF.h> #include <libbladeRF.h>
#include "common_lib.h" #include "common_lib.h"
#include "LOG/log.h"
/** @addtogroup _BLADERF_PHY_RF_INTERFACE_ /** @addtogroup _BLADERF_PHY_RF_INTERFACE_
* @{ * @{
...@@ -109,12 +111,6 @@ int trx_brf_init(openair0_device *device); ...@@ -109,12 +111,6 @@ int trx_brf_init(openair0_device *device);
*/ */
openair0_timestamp trx_get_timestamp(openair0_device *device, bladerf_module module); openair0_timestamp trx_get_timestamp(openair0_device *device, bladerf_module module);
/*! \brief Get BladeRF log level
* \param log_level log level
* \returns log level of BLADERF device
*/
int get_brf_log_level(int log_level);
/*! \brief bladeRF error report /*! \brief bladeRF error report
* \param status * \param status
* \returns 0 on success * \returns 0 on success
...@@ -122,3 +118,5 @@ int get_brf_log_level(int log_level); ...@@ -122,3 +118,5 @@ int get_brf_log_level(int log_level);
int brf_error(int status); int brf_error(int status);
/*@}*/ /*@}*/
#endif /* BLADERF_LIB_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment