diff --git a/arch/Kconfig b/arch/Kconfig index 4935dc12fd13..818c9333f69f 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -53,6 +53,14 @@ endchoice menu "General Architecture Options" +module = ARCH +module-str = arch +source "subsys/logging/Kconfig.template.log_config" + +module = MPU +module-str = mpu +source "subsys/logging/Kconfig.template.log_config" + config HW_STACK_PROTECTION bool "Hardware Stack Protection" depends on ARCH_HAS_STACK_PROTECTION diff --git a/arch/arc/core/mpu/arc_core_mpu.c b/arch/arc/core/mpu/arc_core_mpu.c index b7825670a314..3897981de7a7 100644 --- a/arch/arc/core/mpu/arc_core_mpu.c +++ b/arch/arc/core/mpu/arc_core_mpu.c @@ -9,7 +9,10 @@ #include #include #include -#include + +#define LOG_LEVEL CONFIG_MPU_LOG_LEVEL +#include +LOG_MODULE_REGISTER(mpu); /* * @brief Configure MPU for the thread @@ -81,7 +84,7 @@ void configure_mpu_stack_guard(struct k_thread *thread) */ void configure_mpu_user_context(struct k_thread *thread) { - SYS_LOG_DBG("configure user thread %p's context", thread); + LOG_DBG("configure user thread %p's context", thread); arc_core_mpu_configure_user_context(thread); } @@ -96,7 +99,7 @@ void configure_mpu_user_context(struct k_thread *thread) */ void configure_mpu_mem_domain(struct k_thread *thread) { - SYS_LOG_DBG("configure thread %p's domain", thread); + LOG_DBG("configure thread %p's domain", thread); arc_core_mpu_configure_mem_domain(thread->mem_domain_info.mem_domain); } diff --git a/arch/arc/core/mpu/arc_mpu.c b/arch/arc/core/mpu/arc_mpu.c index 1eb0754a3f9b..55ae3659b9c8 100644 --- a/arch/arc/core/mpu/arc_mpu.c +++ b/arch/arc/core/mpu/arc_mpu.c @@ -12,8 +12,10 @@ #include #include #include -#include +#define LOG_LEVEL CONFIG_MPU_LOG_LEVEL +#include +LOG_MODULE_DECLARE(mpu); #define AUX_MPU_RDB_VALID_MASK (0x1) #define AUX_MPU_EN_ENABLE (0x40000000) @@ -330,7 +332,7 @@ void arc_core_mpu_configure(u8_t type, u32_t base, u32_t size) u32_t region_index = _get_region_index_by_type(type); u32_t region_attr = _get_region_attr_by_type(type); - SYS_LOG_DBG("Region info: 0x%x 0x%x", base, size); + LOG_DBG("Region info: 0x%x 0x%x", base, size); if (region_attr == 0) { return; @@ -488,11 +490,11 @@ void arc_core_mpu_configure_mem_domain(struct k_mem_domain *mem_domain) struct k_mem_partition *pparts; if (mem_domain) { - SYS_LOG_DBG("configure domain: %p", mem_domain); + LOG_DBG("configure domain: %p", mem_domain); num_partitions = mem_domain->num_partitions; pparts = mem_domain->partitions; } else { - SYS_LOG_DBG("disable domain partition regions"); + LOG_DBG("disable domain partition regions"); num_partitions = 0; pparts = NULL; } @@ -511,13 +513,13 @@ void arc_core_mpu_configure_mem_domain(struct k_mem_domain *mem_domain) for (; region_index < num_regions; region_index++) { #endif if (num_partitions && pparts->size) { - SYS_LOG_DBG("set region 0x%x 0x%x 0x%x", + LOG_DBG("set region 0x%x 0x%x 0x%x", region_index, pparts->start, pparts->size); _region_init(region_index, pparts->start, pparts->size, pparts->attr); num_partitions--; } else { - SYS_LOG_DBG("disable region 0x%x", region_index); + LOG_DBG("disable region 0x%x", region_index); /* Disable region */ _region_init(region_index, 0, 0, 0); } @@ -537,15 +539,15 @@ void arc_core_mpu_configure_mem_partition(u32_t part_index, u32_t region_index = _get_region_index_by_type(THREAD_DOMAIN_PARTITION_REGION); - SYS_LOG_DBG("configure partition index: %u", part_index); + LOG_DBG("configure partition index: %u", part_index); if (part) { - SYS_LOG_DBG("set region 0x%x 0x%x 0x%x", + LOG_DBG("set region 0x%x 0x%x 0x%x", region_index + part_index, part->start, part->size); _region_init(region_index, part->start, part->size, part->attr); } else { - SYS_LOG_DBG("disable region 0x%x", region_index + part_index); + LOG_DBG("disable region 0x%x", region_index + part_index); /* Disable region */ _region_init(region_index + part_index, 0, 0, 0); } @@ -561,7 +563,7 @@ void arc_core_mpu_mem_partition_remove(u32_t part_index) u32_t region_index = _get_region_index_by_type(THREAD_DOMAIN_PARTITION_REGION); - SYS_LOG_DBG("disable region 0x%x", region_index + part_index); + LOG_DBG("disable region 0x%x", region_index + part_index); /* Disable region */ _region_init(region_index + part_index, 0, 0, 0); } diff --git a/arch/arm/core/cortex_m/mpu/arm_core_mpu.c b/arch/arm/core/cortex_m/mpu/arm_core_mpu.c index 2b3e971e33f2..ab1066271d11 100644 --- a/arch/arm/core/cortex_m/mpu/arm_core_mpu.c +++ b/arch/arm/core/cortex_m/mpu/arm_core_mpu.c @@ -10,7 +10,10 @@ #include #include #include -#include + +#define LOG_LEVEL CONFIG_MPU_LOG_LEVEL +#include +LOG_MODULE_REGISTER(mpu); #if defined(CONFIG_MPU_STACK_GUARD) /* @@ -50,7 +53,7 @@ void configure_mpu_stack_guard(struct k_thread *thread) */ void configure_mpu_user_context(struct k_thread *thread) { - SYS_LOG_DBG("configure user thread %p's context", thread); + LOG_DBG("configure user thread %p's context", thread); arm_core_mpu_disable(); arm_core_mpu_configure_user_context(thread); arm_core_mpu_enable(); @@ -66,7 +69,7 @@ void configure_mpu_user_context(struct k_thread *thread) */ void configure_mpu_mem_domain(struct k_thread *thread) { - SYS_LOG_DBG("configure thread %p's domain", thread); + LOG_DBG("configure thread %p's domain", thread); arm_core_mpu_disable(); arm_core_mpu_configure_mem_domain(thread->mem_domain_info.mem_domain); arm_core_mpu_enable(); diff --git a/arch/arm/core/cortex_m/mpu/arm_mpu.c b/arch/arm/core/cortex_m/mpu/arm_mpu.c index 770a8f15bb3f..58ae89661267 100644 --- a/arch/arm/core/cortex_m/mpu/arm_mpu.c +++ b/arch/arm/core/cortex_m/mpu/arm_mpu.c @@ -11,9 +11,12 @@ #include #include #include -#include #include +#define LOG_LEVEL CONFIG_MPU_LOG_LEVEL +#include +LOG_MODULE_DECLARE(mpu); + #if defined(CONFIG_CPU_CORTEX_M0PLUS) || \ defined(CONFIG_CPU_CORTEX_M3) || \ defined(CONFIG_CPU_CORTEX_M4) || \ @@ -149,7 +152,7 @@ static inline void _disable_region(u32_t r_index) "Index 0x%x out-of-bound (supported regions: 0x%x)\n", r_index, _get_num_regions()); - SYS_LOG_DBG("disable region 0x%x", r_index); + LOG_DBG("disable region 0x%x", r_index); /* Disable region */ ARM_MPU_ClrRegion(r_index); } @@ -165,7 +168,7 @@ void arm_core_mpu_configure(u8_t type, u32_t base, u32_t size) { struct arm_mpu_region region_conf; - SYS_LOG_DBG("Region info: 0x%x 0x%x", base, size); + LOG_DBG("Region info: 0x%x 0x%x", base, size); u32_t region_index = _get_region_index_by_type(type); if (_get_region_attr_by_type(®ion_conf.attr, type, base, size)) { @@ -208,18 +211,18 @@ void arm_core_mpu_configure_mem_domain(struct k_mem_domain *mem_domain) struct arm_mpu_region region_conf; if (mem_domain) { - SYS_LOG_DBG("configure domain: %p", mem_domain); + LOG_DBG("configure domain: %p", mem_domain); num_partitions = mem_domain->num_partitions; pparts = mem_domain->partitions; } else { - SYS_LOG_DBG("disable domain partition regions"); + LOG_DBG("disable domain partition regions"); num_partitions = 0; pparts = NULL; } for (; region_index < _get_num_regions(); region_index++) { if (num_partitions && pparts->size) { - SYS_LOG_DBG("set region 0x%x 0x%x 0x%x", + LOG_DBG("set region 0x%x 0x%x 0x%x", region_index, pparts->start, pparts->size); region_conf.base = pparts->start; _get_ram_region_attr_by_conf(®ion_conf.attr, @@ -246,11 +249,11 @@ void arm_core_mpu_configure_mem_partition(u32_t part_index, _get_region_index_by_type(THREAD_DOMAIN_PARTITION_REGION); struct arm_mpu_region region_conf; - SYS_LOG_DBG("configure partition index: %u", part_index); + LOG_DBG("configure partition index: %u", part_index); if (part && (region_index + part_index < _get_num_regions())) { - SYS_LOG_DBG("set region 0x%x 0x%x 0x%x", + LOG_DBG("set region 0x%x 0x%x 0x%x", region_index + part_index, part->start, part->size); _get_ram_region_attr_by_conf(®ion_conf.attr, part->attr, part->start, part->size); @@ -327,7 +330,7 @@ static int arm_mpu_init(struct device *arg) return -1; } - SYS_LOG_DBG("total region count: %d", _get_num_regions()); + LOG_DBG("total region count: %d", _get_num_regions()); arm_core_mpu_disable(); diff --git a/arch/arm/core/cortex_m/mpu/arm_mpu_v7_internal.h b/arch/arm/core/cortex_m/mpu/arm_mpu_v7_internal.h index de9a6083d79c..71ff8b5c4ecd 100644 --- a/arch/arm/core/cortex_m/mpu/arm_mpu_v7_internal.h +++ b/arch/arm/core/cortex_m/mpu/arm_mpu_v7_internal.h @@ -8,6 +8,10 @@ #ifndef ZEPHYR_ARCH_ARM_CORE_CORTEX_M_MPU_ARM_MPU_V7_INTERNAL_H_ #define ZEPHYR_ARCH_ARM_CORE_CORTEX_M_MPU_ARM_MPU_V7_INTERNAL_H_ + +#define LOG_LEVEL CONFIG_MPU_LOG_LEVEL +#include + /* Global MPU configuration at system initialization. */ static void _mpu_init(void) { @@ -27,7 +31,7 @@ static void _region_init(u32_t index, struct arm_mpu_region *region_conf) MPU->RBAR = (region_conf->base & MPU_RBAR_ADDR_Msk) | MPU_RBAR_VALID_Msk | index; MPU->RASR = region_conf->attr.rasr | MPU_RASR_ENABLE_Msk; - SYS_LOG_DBG("[%d] 0x%08x 0x%08x", + LOG_DBG("[%d] 0x%08x 0x%08x", index, region_conf->base, region_conf->attr.rasr); } diff --git a/arch/arm/core/cortex_m/mpu/arm_mpu_v8_internal.h b/arch/arm/core/cortex_m/mpu/arm_mpu_v8_internal.h index d353ca12dbc3..f24c3e58bffc 100644 --- a/arch/arm/core/cortex_m/mpu/arm_mpu_v8_internal.h +++ b/arch/arm/core/cortex_m/mpu/arm_mpu_v8_internal.h @@ -9,6 +9,8 @@ #define ZEPHYR_ARCH_ARM_CORE_CORTEX_M_MPU_ARM_MPU_V8_INTERNAL_H_ #include +#define LOG_LEVEL CONFIG_MPU_LOG_LEVEL +#include /* Global MPU configuration at system initialization. */ static void _mpu_init(void) @@ -49,7 +51,7 @@ static void _region_init(u32_t index, struct arm_mpu_region *region_conf) | MPU_RLAR_EN_Msk ); - SYS_LOG_DBG("[%d] 0x%08x 0x%08x 0x%08x 0x%08x", + LOG_DBG("[%d] 0x%08x 0x%08x 0x%08x 0x%08x", index, region_conf->base, region_conf->attr.rbar, region_conf->attr.mair_idx, region_conf->attr.r_limit); } diff --git a/arch/arm/core/cortex_m/mpu/nxp_mpu.c b/arch/arm/core/cortex_m/mpu/nxp_mpu.c index 133efea064ce..625c254e992d 100644 --- a/arch/arm/core/cortex_m/mpu/nxp_mpu.c +++ b/arch/arm/core/cortex_m/mpu/nxp_mpu.c @@ -10,10 +10,13 @@ #include #include #include -#include #include #include +#define LOG_LEVEL CONFIG_MPU_LOG_LEVEL +#include +LOG_MODULE_DECLARE(mpu); + /* NXP MPU Enabled state */ static u8_t nxp_mpu_enabled; @@ -92,11 +95,11 @@ static void _region_init(u32_t index, u32_t region_base, SYSMPU->WORD[index][3] = SYSMPU_WORD_VLD_MASK; } - SYS_LOG_DBG("[%d] 0x%08x 0x%08x 0x%08x 0x%08x", index, - SYSMPU->WORD[index][0], - SYSMPU->WORD[index][1], - SYSMPU->WORD[index][2], - SYSMPU->WORD[index][3]); + LOG_DBG("[%d] 0x%08x 0x%08x 0x%08x 0x%08x", index, + (u32_t)SYSMPU->WORD[index][0], + (u32_t)SYSMPU->WORD[index][1], + (u32_t)SYSMPU->WORD[index][2], + (u32_t)SYSMPU->WORD[index][3]); } /** @@ -225,7 +228,7 @@ void arm_core_mpu_disable(void) */ void arm_core_mpu_configure(u8_t type, u32_t base, u32_t size) { - SYS_LOG_DBG("Region info: 0x%x 0x%x", base, size); + LOG_DBG("Region info: 0x%x 0x%x", base, size); u32_t region_index = _get_region_index_by_type(type); u32_t region_attr = _get_region_attr_by_type(type); @@ -265,11 +268,11 @@ void arm_core_mpu_configure_mem_domain(struct k_mem_domain *mem_domain) struct k_mem_partition *pparts; if (mem_domain) { - SYS_LOG_DBG("configure domain: %p", mem_domain); + LOG_DBG("configure domain: %p", mem_domain); num_partitions = mem_domain->num_partitions; pparts = mem_domain->partitions; } else { - SYS_LOG_DBG("disable domain partition regions"); + LOG_DBG("disable domain partition regions"); num_partitions = 0; pparts = NULL; } @@ -280,7 +283,7 @@ void arm_core_mpu_configure_mem_domain(struct k_mem_domain *mem_domain) */ for (; region_index < _get_num_usable_regions(); region_index++) { if (num_partitions && pparts->size) { - SYS_LOG_DBG("set region 0x%x 0x%x 0x%x", + LOG_DBG("set region 0x%x 0x%x 0x%x", region_index, pparts->start, pparts->size); region_attr = pparts->attr; _region_init(region_index, pparts->start, @@ -288,7 +291,7 @@ void arm_core_mpu_configure_mem_domain(struct k_mem_domain *mem_domain) region_attr); num_partitions--; } else { - SYS_LOG_DBG("disable region 0x%x", region_index); + LOG_DBG("disable region 0x%x", region_index); /* Disable region */ SYSMPU->WORD[region_index][0] = 0; SYSMPU->WORD[region_index][1] = 0; @@ -312,17 +315,17 @@ void arm_core_mpu_configure_mem_partition(u32_t part_index, _get_region_index_by_type(THREAD_DOMAIN_PARTITION_REGION); u32_t region_attr; - SYS_LOG_DBG("configure partition index: %u", part_index); + LOG_DBG("configure partition index: %u", part_index); if (part) { - SYS_LOG_DBG("set region 0x%x 0x%x 0x%x", + LOG_DBG("set region 0x%x 0x%x 0x%x", region_index + part_index, part->start, part->size); region_attr = part->attr; _region_init(region_index + part_index, part->start, ENDADDR_ROUND(part->start + part->size), region_attr); } else { - SYS_LOG_DBG("disable region 0x%x", region_index); + LOG_DBG("disable region 0x%x", region_index); /* Disable region */ SYSMPU->WORD[region_index + part_index][0] = 0; SYSMPU->WORD[region_index + part_index][1] = 0; @@ -341,7 +344,7 @@ void arm_core_mpu_mem_partition_remove(u32_t part_index) u32_t region_index = _get_region_index_by_type(THREAD_DOMAIN_PARTITION_REGION); - SYS_LOG_DBG("disable region 0x%x", region_index); + LOG_DBG("disable region 0x%x", region_index); /* Disable region */ SYSMPU->WORD[region_index + part_index][0] = 0; SYSMPU->WORD[region_index + part_index][1] = 0; @@ -424,7 +427,7 @@ static void _nxp_mpu_config(void) __ASSERT(mpu_config.num_regions <= _get_num_regions(), "too many static MPU regions defined"); - SYS_LOG_DBG("total region count: %d", _get_num_regions()); + LOG_DBG("total region count: %d", _get_num_regions()); /* Disable MPU */ SYSMPU->CESR &= ~SYSMPU_CESR_VLD_MASK; @@ -491,7 +494,7 @@ static int nxp_mpu_init(struct device *arg) return 0; } -#if defined(CONFIG_SYS_LOG) +#if defined(CONFIG_LOG) /* To have logging the driver needs to be initialized later */ SYS_INIT(nxp_mpu_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); diff --git a/drivers/adc/Kconfig b/drivers/adc/Kconfig index 241bc05b0d9c..98de617a19ac 100644 --- a/drivers/adc/Kconfig +++ b/drivers/adc/Kconfig @@ -31,26 +31,9 @@ config ADC_ASYNC help This option enables the asynchronous API calls. -config SYS_LOG_ADC_LEVEL - int "ADC drivers log level" - depends on SYS_LOG - default 0 - range 0 4 - help - - Sets log level for ADC driver. - - Levels are: - - - 0 OFF, do not write - - - 1 ERROR, only write SYS_LOG_ERR - - - 2 WARNING, write SYS_LOG_WRN in addition to previous level - - - 3 INFO, write SYS_LOG_INF in addition to previous levels - - - 4 DEBUG, write SYS_LOG_DBG in addition to previous levels +module = ADC +module-str = ADC +source "subsys/logging/Kconfig.template.log_config" config ADC_INIT_PRIORITY int "Init priority" diff --git a/drivers/adc/adc_dw.c b/drivers/adc/adc_dw.c index f2e321242846..99b2ce3f9fea 100644 --- a/drivers/adc/adc_dw.c +++ b/drivers/adc/adc_dw.c @@ -19,7 +19,10 @@ #define ADC_CONTEXT_USES_KERNEL_TIMER #include "adc_context.h" #include "adc_dw.h" -#include + +#define LOG_LEVEL CONFIG_ADC_LOG_LEVEL +#include +LOG_MODULE_REGISTER(adc_dw); #define ADC_CLOCK_GATE (1 << 31) #define ADC_DEEP_POWER_DOWN 0x01 @@ -231,27 +234,27 @@ static int adc_dw_channel_setup(struct device *dev, struct adc_info *info = dev->driver_data; if (channel_id >= DW_CHANNEL_COUNT) { - SYS_LOG_ERR("Invalid channel id"); + LOG_ERR("Invalid channel id"); return -EINVAL; } if (channel_cfg->gain != ADC_GAIN_1) { - SYS_LOG_ERR("Invalid channel gain"); + LOG_ERR("Invalid channel gain"); return -EINVAL; } if (channel_cfg->reference != ADC_REF_INTERNAL) { - SYS_LOG_ERR("Invalid channel reference"); + LOG_ERR("Invalid channel reference"); return -EINVAL; } if (channel_cfg->acquisition_time != ADC_ACQ_TIME_DEFAULT) { - SYS_LOG_ERR("Invalid channel acquisition time"); + LOG_ERR("Invalid channel acquisition time"); return -EINVAL; } if (info->state != ADC_STATE_IDLE) { - SYS_LOG_ERR("ADC is busy or in error state"); + LOG_ERR("ADC is busy or in error state"); return -EAGAIN; } diff --git a/drivers/adc/adc_intel_quark_d2000.c b/drivers/adc/adc_intel_quark_d2000.c index 88b2b31eb889..35e8b07414f7 100644 --- a/drivers/adc/adc_intel_quark_d2000.c +++ b/drivers/adc/adc_intel_quark_d2000.c @@ -14,9 +14,9 @@ #include #include -#define SYS_LOG_DOMAIN "dev/adc_quark_d2000" -#define SYS_LOG_LEVEL CONFIG_SYS_LOG_ADC_LEVEL -#include +#define LOG_LEVEL CONFIG_ADC_LOG_LEVEL +#include +LOG_MODULE_REGISTER(adc_intel_quark_d2000); #define ADC_CONTEXT_USES_KERNEL_TIMER #include "adc_context.h" @@ -201,27 +201,27 @@ static int adc_quark_d2000_channel_setup(struct device *dev, u8_t channel_id = channel_cfg->channel_id; if (channel_id > MAX_CHANNELS) { - SYS_LOG_ERR("Channel %d is not valid", channel_id); + LOG_ERR("Channel %d is not valid", channel_id); return -EINVAL; } if (channel_cfg->acquisition_time != ADC_ACQ_TIME_DEFAULT) { - SYS_LOG_ERR("Invalid channel acquisition time"); + LOG_ERR("Invalid channel acquisition time"); return -EINVAL; } if (channel_cfg->differential) { - SYS_LOG_ERR("Differential channels are not supported"); + LOG_ERR("Differential channels are not supported"); return -EINVAL; } if (channel_cfg->gain != ADC_GAIN_1) { - SYS_LOG_ERR("Invalid channel gain"); + LOG_ERR("Invalid channel gain"); return -EINVAL; } if (channel_cfg->reference != ADC_REF_INTERNAL) { - SYS_LOG_ERR("Invalid channel reference"); + LOG_ERR("Invalid channel reference"); return -EINVAL; } diff --git a/drivers/adc/adc_mcux_adc16.c b/drivers/adc/adc_mcux_adc16.c index 0d62499ef87b..77ec65ad660c 100644 --- a/drivers/adc/adc_mcux_adc16.c +++ b/drivers/adc/adc_mcux_adc16.c @@ -8,8 +8,9 @@ #include #include -#define SYS_LOG_LEVEL CONFIG_SYS_LOG_ADC_LEVEL -#include +#define LOG_LEVEL CONFIG_ADC_LOG_LEVEL +#include +LOG_MODULE_REGISTER(adc_mcux_adc16); #define ADC_CONTEXT_USES_KERNEL_TIMER #include "adc_context.h" @@ -34,27 +35,27 @@ static int mcux_adc16_channel_setup(struct device *dev, u8_t channel_id = channel_cfg->channel_id; if (channel_id > (ADC_SC1_ADCH_MASK >> ADC_SC1_ADCH_SHIFT)) { - SYS_LOG_ERR("Channel %d is not valid", channel_id); + LOG_ERR("Channel %d is not valid", channel_id); return -EINVAL; } if (channel_cfg->acquisition_time != ADC_ACQ_TIME_DEFAULT) { - SYS_LOG_ERR("Invalid channel acquisition time"); + LOG_ERR("Invalid channel acquisition time"); return -EINVAL; } if (channel_cfg->differential) { - SYS_LOG_ERR("Differential channels are not supported"); + LOG_ERR("Differential channels are not supported"); return -EINVAL; } if (channel_cfg->gain != ADC_GAIN_1) { - SYS_LOG_ERR("Invalid channel gain"); + LOG_ERR("Invalid channel gain"); return -EINVAL; } if (channel_cfg->reference != ADC_REF_INTERNAL) { - SYS_LOG_ERR("Invalid channel reference"); + LOG_ERR("Invalid channel reference"); return -EINVAL; } @@ -69,7 +70,7 @@ static int start_read(struct device *dev, const struct adc_sequence *sequence) int error; if (sequence->resolution != 12) { - SYS_LOG_ERR("Invalid resolution"); + LOG_ERR("Invalid resolution"); return -EINVAL; } @@ -90,7 +91,7 @@ static int start_read(struct device *dev, const struct adc_sequence *sequence) mode = kADC16_HardwareAverageCount32; break; default: - SYS_LOG_ERR("Invalid oversampling"); + LOG_ERR("Invalid oversampling"); return -EINVAL; } ADC16_SetHardwareAverage(config->base, mode); @@ -136,7 +137,7 @@ static void mcux_adc16_start_channel(struct device *dev) data->channel_id = find_lsb_set(data->channels) - 1; - SYS_LOG_DBG("Starting channel %d", data->channel_id); + LOG_DBG("Starting channel %d", data->channel_id); #if defined(FSL_FEATURE_ADC16_HAS_DIFF_MODE) && FSL_FEATURE_ADC16_HAS_DIFF_MODE channel_config.enableDifferentialConversion = false; @@ -177,7 +178,7 @@ static void mcux_adc16_isr(void *arg) u16_t result; result = ADC16_GetChannelConversionValue(base, channel_group); - SYS_LOG_DBG("Finished channel %d. Result is 0x%04x", + LOG_DBG("Finished channel %d. Result is 0x%04x", data->channel_id, result); *data->buffer++ = result; diff --git a/drivers/adc/adc_nrfx_adc.c b/drivers/adc/adc_nrfx_adc.c index 5fe4a19e5910..4224f42e1662 100644 --- a/drivers/adc/adc_nrfx_adc.c +++ b/drivers/adc/adc_nrfx_adc.c @@ -8,9 +8,9 @@ #include "adc_context.h" #include -#define SYS_LOG_DOMAIN "adc_nrfx_adc" -#define SYS_LOG_LEVEL CONFIG_SYS_LOG_ADC_LEVEL -#include +#define LOG_LEVEL CONFIG_ADC_LOG_LEVEL +#include +LOG_MODULE_REGISTER(adc_mcux_adc16); struct driver_data { struct adc_context ctx; @@ -40,12 +40,12 @@ static int adc_nrfx_channel_setup(struct device *dev, } if (channel_cfg->acquisition_time != ADC_ACQ_TIME_DEFAULT) { - SYS_LOG_ERR("Selected ADC acquisition time is not valid"); + LOG_ERR("Selected ADC acquisition time is not valid"); return -EINVAL; } if (channel_cfg->differential) { - SYS_LOG_ERR("Differential channels are not supported"); + LOG_ERR("Differential channels are not supported"); return -EINVAL; } @@ -60,7 +60,7 @@ static int adc_nrfx_channel_setup(struct device *dev, config->scaling = NRF_ADC_CONFIG_SCALING_INPUT_FULL_SCALE; break; default: - SYS_LOG_ERR("Selected ADC gain is not valid"); + LOG_ERR("Selected ADC gain is not valid"); return -EINVAL; } @@ -86,7 +86,7 @@ static int adc_nrfx_channel_setup(struct device *dev, config->extref = NRF_ADC_CONFIG_EXTREFSEL_AREF1; break; default: - SYS_LOG_ERR("Selected ADC reference is not valid"); + LOG_ERR("Selected ADC reference is not valid"); return -EINVAL; } @@ -126,7 +126,7 @@ static int check_buffer_size(const struct adc_sequence *sequence, } if (sequence->buffer_size < needed_buffer_size) { - SYS_LOG_ERR("Provided buffer is too small (%u/%u)", + LOG_ERR("Provided buffer is too small (%u/%u)", sequence->buffer_size, needed_buffer_size); return -ENOMEM; } @@ -148,12 +148,12 @@ static int start_read(struct device *dev, const struct adc_sequence *sequence) if (!selected_channels || (selected_channels & ~BIT_MASK(CONFIG_ADC_NRFX_ADC_CHANNEL_COUNT))) { - SYS_LOG_ERR("Invalid selection of channels"); + LOG_ERR("Invalid selection of channels"); return -EINVAL; } if (sequence->oversampling != 0) { - SYS_LOG_ERR("Oversampling is not supported"); + LOG_ERR("Oversampling is not supported"); return -EINVAL; } @@ -168,7 +168,7 @@ static int start_read(struct device *dev, const struct adc_sequence *sequence) nrf_resolution = NRF_ADC_CONFIG_RES_10BIT; break; default: - SYS_LOG_ERR("ADC resolution value %d is not valid", + LOG_ERR("ADC resolution value %d is not valid", sequence->resolution); return -EINVAL; } @@ -248,7 +248,7 @@ static int init_adc(struct device *dev) nrfx_err_t result = nrfx_adc_init(&config, event_handler); if (result != NRFX_SUCCESS) { - SYS_LOG_ERR("Failed to initialize device: %s", + LOG_ERR("Failed to initialize device: %s", dev->config->name); return -EBUSY; } diff --git a/drivers/adc/adc_nrfx_saadc.c b/drivers/adc/adc_nrfx_saadc.c index d751e96f7ffe..4f8db7b6b3b2 100644 --- a/drivers/adc/adc_nrfx_saadc.c +++ b/drivers/adc/adc_nrfx_saadc.c @@ -8,9 +8,9 @@ #include "adc_context.h" #include -#define SYS_LOG_DOMAIN "adc_nrfx_saadc" -#define SYS_LOG_LEVEL CONFIG_SYS_LOG_ADC_LEVEL -#include +#define LOG_LEVEL CONFIG_ADC_LOG_LEVEL +#include +LOG_MODULE_REGISTER(adc_nrfx_saadc); struct driver_data { struct adc_context ctx; @@ -66,7 +66,7 @@ static int adc_nrfx_channel_setup(struct device *dev, config.gain = NRF_SAADC_GAIN4; break; default: - SYS_LOG_ERR("Selected ADC gain is not valid"); + LOG_ERR("Selected ADC gain is not valid"); return -EINVAL; } @@ -78,7 +78,7 @@ static int adc_nrfx_channel_setup(struct device *dev, config.reference = NRF_SAADC_REFERENCE_VDD4; break; default: - SYS_LOG_ERR("Selected ADC reference is not valid"); + LOG_ERR("Selected ADC reference is not valid"); return -EINVAL; } @@ -103,7 +103,7 @@ static int adc_nrfx_channel_setup(struct device *dev, config.acq_time = NRF_SAADC_ACQTIME_40US; break; default: - SYS_LOG_ERR("Selected ADC acquisition time is not valid"); + LOG_ERR("Selected ADC acquisition time is not valid"); return -EINVAL; } @@ -168,7 +168,7 @@ static int set_resolution(const struct adc_sequence *sequence) nrf_resolution = NRF_SAADC_RESOLUTION_14BIT; break; default: - SYS_LOG_ERR("ADC resolution value %d is not valid", + LOG_ERR("ADC resolution value %d is not valid", sequence->resolution); return -EINVAL; } @@ -183,7 +183,7 @@ static int set_oversampling(const struct adc_sequence *sequence, nrf_saadc_oversample_t nrf_oversampling; if ((active_channels > 1) && (sequence->oversampling > 0)) { - SYS_LOG_ERR( + LOG_ERR( "Oversampling is supported for single channel only"); return -EINVAL; } @@ -217,7 +217,7 @@ static int set_oversampling(const struct adc_sequence *sequence, nrf_oversampling = NRF_SAADC_OVERSAMPLE_256X; break; default: - SYS_LOG_ERR("Oversampling value %d is not valid", + LOG_ERR("Oversampling value %d is not valid", sequence->oversampling); return -EINVAL; } @@ -237,7 +237,7 @@ static int check_buffer_size(const struct adc_sequence *sequence, } if (sequence->buffer_size < needed_buffer_size) { - SYS_LOG_ERR("Provided buffer is too small (%u/%u)", + LOG_ERR("Provided buffer is too small (%u/%u)", sequence->buffer_size, needed_buffer_size); return -ENOMEM; } @@ -257,7 +257,7 @@ static int start_read(struct device *dev, const struct adc_sequence *sequence) */ if (!selected_channels || (selected_channels & ~BIT_MASK(NRF_SAADC_CHANNEL_COUNT))) { - SYS_LOG_ERR("Invalid selection of channels"); + LOG_ERR("Invalid selection of channels"); return -EINVAL; } @@ -273,7 +273,7 @@ static int start_read(struct device *dev, const struct adc_sequence *sequence) * configured yet. */ if (m_data.positive_inputs[channel_id] == 0) { - SYS_LOG_ERR("Channel %u not configured", + LOG_ERR("Channel %u not configured", channel_id); return -EINVAL; } diff --git a/drivers/adc/adc_sam_afec.c b/drivers/adc/adc_sam_afec.c index d964b26eb5f1..89e812667005 100644 --- a/drivers/adc/adc_sam_afec.c +++ b/drivers/adc/adc_sam_afec.c @@ -23,9 +23,9 @@ #define ADC_CONTEXT_USES_KERNEL_TIMER #include "adc_context.h" -#define SYS_LOG_DOMAIN "dev/adc_sam_afec" -#define SYS_LOG_LEVEL CONFIG_SYS_LOG_ADC_LEVEL -#include +#define LOG_LEVEL CONFIG_ADC_LOG_LEVEL +#include +LOG_MODULE_REGISTER(adc_sam_afec); #define NUM_CHANNELS 12 @@ -88,22 +88,22 @@ static int adc_sam_channel_setup(struct device *dev, afec->AFEC_CGR |= (2 << (channel_id * 2)); break; default: - SYS_LOG_ERR("Selected ADC gain is not valid"); + LOG_ERR("Selected ADC gain is not valid"); return -EINVAL; } if (channel_cfg->acquisition_time != ADC_ACQ_TIME_DEFAULT) { - SYS_LOG_ERR("Selected ADC acquisition time is not valid"); + LOG_ERR("Selected ADC acquisition time is not valid"); return -EINVAL; } if (channel_cfg->reference != ADC_REF_EXTERNAL0) { - SYS_LOG_ERR("Selected reference is not valid"); + LOG_ERR("Selected reference is not valid"); return -EINVAL; } if (channel_cfg->differential) { - SYS_LOG_ERR("Differential input is not supported"); + LOG_ERR("Differential input is not supported"); return -EINVAL; } @@ -124,7 +124,7 @@ static void adc_sam_start_conversion(struct device *dev) data->channel_id = find_lsb_set(data->channels) - 1; - SYS_LOG_DBG("Starting channel %d", data->channel_id); + LOG_DBG("Starting channel %d", data->channel_id); /* Disable all channels. */ afec->AFEC_CHDR = 0xfff; @@ -174,7 +174,7 @@ static int check_buffer_size(const struct adc_sequence *sequence, needed_buffer_size *= (1 + sequence->options->extra_samplings); } if (sequence->buffer_size < needed_buffer_size) { - SYS_LOG_ERR("Provided buffer is too small (%u/%u)", + LOG_ERR("Provided buffer is too small (%u/%u)", sequence->buffer_size, needed_buffer_size); return -ENOMEM; } @@ -194,12 +194,12 @@ static int start_read(struct device *dev, const struct adc_sequence *sequence) */ if (channels == 0 || (channels & (~0UL << NUM_CHANNELS))) { - SYS_LOG_ERR("Invalid selection of channels"); + LOG_ERR("Invalid selection of channels"); return -EINVAL; } if (sequence->oversampling != 0) { - SYS_LOG_ERR("Oversampling is not supported"); + LOG_ERR("Oversampling is not supported"); return -EINVAL; } @@ -207,7 +207,7 @@ static int start_read(struct device *dev, const struct adc_sequence *sequence) /* TODO JKW: Support the Enhanced Resolution Mode 50.6.3 page * 1544. */ - SYS_LOG_ERR("ADC resolution value %d is not valid", + LOG_ERR("ADC resolution value %d is not valid", sequence->resolution); return -EINVAL; } diff --git a/drivers/adc/adc_ti_adc108s102.c b/drivers/adc/adc_ti_adc108s102.c index 4d483a1c0d3d..a0d857ff2002 100644 --- a/drivers/adc/adc_ti_adc108s102.c +++ b/drivers/adc/adc_ti_adc108s102.c @@ -10,12 +10,13 @@ #include #include -#define SYS_LOG_LEVEL CONFIG_SYS_LOG_ADC_LEVEL -#include #include #include #include "adc_ti_adc108s102.h" +#define LOG_LEVEL CONFIG_ADC_LOG_LEVEL +#include +LOG_MODULE_REGISTER(adc_ti_adc108s102); static inline int _ti_adc108s102_sampling(struct device *dev) { @@ -37,7 +38,7 @@ static inline int _ti_adc108s102_sampling(struct device *dev) .count = 1 }; - SYS_LOG_DBG("Sampling!"); + LOG_DBG("Sampling!"); return spi_transceive(adc->spi, &adc->spi_cfg, &tx, &rx); } @@ -50,7 +51,7 @@ static inline void _ti_adc108s102_handle_result(struct device *dev) struct adc_seq_entry *entry; u32_t s_i, i; - SYS_LOG_DBG("_ti_adc108s102_handle_result()"); + LOG_DBG("_ti_adc108s102_handle_result()"); for (i = 0, s_i = 1; i < seq_table->num_entries; i++, s_i++) { entry = &seq_table->entries[i]; @@ -87,7 +88,7 @@ static inline s32_t _ti_adc108s102_prepare(struct device *dev) continue; } - SYS_LOG_DBG("Requesting channel %d", entry->channel_id); + LOG_DBG("Requesting channel %d", entry->channel_id); adc->cmd_buffer[adc->cmd_buf_len] = ADC108S102_CHANNEL_CMD(entry->channel_id); @@ -105,7 +106,7 @@ static inline s32_t _ti_adc108s102_prepare(struct device *dev) adc->cmd_buffer[adc->cmd_buf_len] = 0; adc->cmd_buf_len++; - SYS_LOG_DBG("ADC108S102 is prepared..."); + LOG_DBG("ADC108S102 is prepared..."); return sampling_delay; } @@ -221,7 +222,7 @@ static int ti_adc108s102_init(struct device *dev) adc->spi_cfg.slave = CONFIG_ADC_TI_ADC108S102_SPI_SLAVE; - SYS_LOG_DBG("ADC108s102 initialized"); + LOG_DBG("ADC108s102 initialized"); dev->driver_api = &ti_adc108s102_api; diff --git a/drivers/audio/Kconfig b/drivers/audio/Kconfig index 46c7f33b6d4b..5de26185e420 100644 --- a/drivers/audio/Kconfig +++ b/drivers/audio/Kconfig @@ -28,18 +28,9 @@ config AUDIO_CODEC_INIT_PRIORITY help Audio codec device driver initialization priority. -config SYS_LOG_AUDIO_CODEC_LEVEL - int "Audio codec driver log level" - depends on SYS_LOG - default 0 - help - Sets log level for Audio codec drivers. - Levels are: - - 0 OFF, do not write - - 1 ERROR, only write SYS_LOG_ERR - - 2 WARNING, write SYS_LOG_WRN in addition to previous level - - 3 INFO, write SYS_LOG_INF in addition to previous levels - - 4 DEBUG, write SYS_LOG_DBG in addition to previous levels +module = AUDIO_CODEC +module-str = audio codec +source "subsys/logging/Kconfig.template.log_config" source "drivers/audio/Kconfig.tlv320dac" diff --git a/drivers/audio/tlv320dac310x.c b/drivers/audio/tlv320dac310x.c index eca4b23952b8..be62b93ffc19 100644 --- a/drivers/audio/tlv320dac310x.c +++ b/drivers/audio/tlv320dac310x.c @@ -6,10 +6,6 @@ #include -#define SYS_LOG_DOMAIN "dev/codec" -#define SYS_LOG_LEVEL CONFIG_SYS_LOG_AUDIO_CODEC_LEVEL -#include - #include #include @@ -18,6 +14,10 @@ #include