1 /* 2 * Copyright (c) 2018 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 #ifndef SAMPLE_INSTANCE_H 7 #define SAMPLE_INSTANCE_H 8 9 #include <zephyr/kernel.h> 10 #include <zephyr/logging/log_instance.h> 11 #include <zephyr/logging/log.h> 12 13 #define SAMPLE_INSTANCE_NAME sample_instance 14 15 struct sample_instance { 16 LOG_INSTANCE_PTR_DECLARE(log); 17 uint32_t cnt; 18 }; 19 20 #define SAMPLE_INSTANCE_DEFINE(_part, _name) \ 21 LOG_INSTANCE_REGISTER(SAMPLE_INSTANCE_NAME, _name, LOG_LEVEL_INF); \ 22 K_APP_DMEM(_part) struct sample_instance _name = { \ 23 LOG_INSTANCE_PTR_INIT(log, SAMPLE_INSTANCE_NAME, _name) \ 24 } 25 26 void sample_instance_call(struct sample_instance *inst); 27 sample_instance_inline_call(struct sample_instance * inst)28static inline void sample_instance_inline_call(struct sample_instance *inst) 29 { 30 LOG_LEVEL_SET(LOG_LEVEL_INF); 31 32 LOG_INST_INF(inst->log, "Inline call."); 33 } 34 35 #endif /*SAMPLE_INSTANCE_H*/ 36