nrf_log_internal.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  1. /**
  2. * Copyright (c) 2016 - 2020, Nordic Semiconductor ASA
  3. *
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without modification,
  7. * are permitted provided that the following conditions are met:
  8. *
  9. * 1. Redistributions of source code must retain the above copyright notice, this
  10. * list of conditions and the following disclaimer.
  11. *
  12. * 2. Redistributions in binary form, except as embedded into a Nordic
  13. * Semiconductor ASA integrated circuit in a product or a software update for
  14. * such product, must reproduce the above copyright notice, this list of
  15. * conditions and the following disclaimer in the documentation and/or other
  16. * materials provided with the distribution.
  17. *
  18. * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
  19. * contributors may be used to endorse or promote products derived from this
  20. * software without specific prior written permission.
  21. *
  22. * 4. This software, with or without modification, must only be used with a
  23. * Nordic Semiconductor ASA integrated circuit.
  24. *
  25. * 5. Any software provided in binary form under this license must not be reverse
  26. * engineered, decompiled, modified and/or disassembled.
  27. *
  28. * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
  29. * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  30. * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
  31. * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
  32. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  33. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  34. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  36. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  37. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  38. *
  39. */
  40. #ifndef NRF_LOG_INTERNAL_H__
  41. #define NRF_LOG_INTERNAL_H__
  42. #include "sdk_common.h"
  43. #include "nrf.h"
  44. #include "nrf_error.h"
  45. #include "app_util.h"
  46. #include <stdint.h>
  47. #include <stdbool.h>
  48. #include "nrf_log_instance.h"
  49. #include "nrf_log_types.h"
  50. #ifndef NRF_LOG_ERROR_COLOR
  51. #define NRF_LOG_ERROR_COLOR NRF_LOG_COLOR_DEFAULT
  52. #endif
  53. #ifndef NRF_LOG_WARNING_COLOR
  54. #define NRF_LOG_WARNING_COLOR NRF_LOG_COLOR_DEFAULT
  55. #endif
  56. #ifndef NRF_LOG_INFO_COLOR
  57. #define NRF_LOG_INFO_COLOR NRF_LOG_COLOR_DEFAULT
  58. #endif
  59. #ifndef NRF_LOG_DEBUG_COLOR
  60. #define NRF_LOG_DEBUG_COLOR NRF_LOG_COLOR_DEFAULT
  61. #endif
  62. #ifndef NRF_LOG_COLOR_DEFAULT
  63. #define NRF_LOG_COLOR_DEFAULT 0
  64. #endif
  65. #ifndef NRF_LOG_DEFAULT_LEVEL
  66. #define NRF_LOG_DEFAULT_LEVEL 0
  67. #endif
  68. #ifndef NRF_LOG_USES_COLORS
  69. #define NRF_LOG_USES_COLORS 0
  70. #endif
  71. #ifndef NRF_LOG_USES_TIMESTAMP
  72. #define NRF_LOG_USES_TIMESTAMP 0
  73. #endif
  74. #ifndef NRF_LOG_FILTERS_ENABLED
  75. #define NRF_LOG_FILTERS_ENABLED 0
  76. #endif
  77. #ifndef NRF_LOG_MODULE_NAME
  78. #define NRF_LOG_MODULE_NAME app
  79. #endif
  80. #define NRF_LOG_LEVEL_BITS 3
  81. #define NRF_LOG_LEVEL_MASK ((1UL << NRF_LOG_LEVEL_BITS) - 1)
  82. #define NRF_LOG_MODULE_ID_BITS 16
  83. #define NRF_LOG_MODULE_ID_POS 16
  84. #define NRF_LOG_MAX_NUM_OF_ARGS 6
  85. #if NRF_LOG_FILTERS_ENABLED && NRF_LOG_ENABLED
  86. #define NRF_LOG_FILTER NRF_LOG_ITEM_DATA_DYNAMIC(NRF_LOG_MODULE_NAME).filter
  87. #define NRF_LOG_INST_FILTER(p_inst) (p_inst)->filter
  88. #else
  89. #undef NRF_LOG_FILTER
  90. #define NRF_LOG_FILTER NRF_LOG_SEVERITY_DEBUG
  91. #define NRF_LOG_INST_FILTER(p_inst) NRF_LOG_SEVERITY_DEBUG
  92. #endif
  93. /**
  94. * @brief Macro for calculating module id based on address and section start address
  95. */
  96. #define NRF_LOG_MODULE_ID_GET_CONST(addr) (((uint32_t)(addr) - \
  97. (uint32_t)NRF_SECTION_START_ADDR(log_const_data)) / \
  98. sizeof(nrf_log_module_const_data_t))
  99. /**
  100. * @brief Macro for calculating module id based on address and section start address
  101. */
  102. #define NRF_LOG_MODULE_ID_GET_DYNAMIC(addr) (((uint32_t)(addr) - \
  103. (uint32_t)NRF_SECTION_START_ADDR(log_dynamic_data)) / \
  104. sizeof(nrf_log_module_dynamic_data_t))
  105. #if NRF_LOG_ENABLED
  106. #define NRF_LOG_MODULE_ID NRF_LOG_MODULE_ID_GET_CONST(&NRF_LOG_ITEM_DATA_CONST(NRF_LOG_MODULE_NAME))
  107. #if NRF_LOG_FILTERS_ENABLED
  108. #define NRF_LOG_INST_ID(p_inst) NRF_LOG_MODULE_ID_GET_DYNAMIC(p_inst)
  109. #else
  110. #define NRF_LOG_INST_ID(p_inst) NRF_LOG_MODULE_ID
  111. #endif
  112. #else
  113. #define NRF_LOG_MODULE_ID 0
  114. #define NRF_LOG_INST_ID(p_inst) 0
  115. #endif
  116. #define LOG_INTERNAL_X(N, ...) CONCAT_2(LOG_INTERNAL_, N) (__VA_ARGS__)
  117. #define LOG_INTERNAL(type, ...) LOG_INTERNAL_X(NUM_VA_ARGS_LESS_1( \
  118. __VA_ARGS__), type, __VA_ARGS__)
  119. #if NRF_LOG_ENABLED
  120. #define NRF_LOG_INTERNAL_LOG_PUSH(_str) nrf_log_push(_str)
  121. #define LOG_INTERNAL_0(type, str) \
  122. nrf_log_frontend_std_0(type, str)
  123. #define LOG_INTERNAL_1(type, str, arg0) \
  124. /*lint -save -e571*/nrf_log_frontend_std_1(type, str, (uint32_t)(arg0))/*lint -restore*/
  125. #define LOG_INTERNAL_2(type, str, arg0, arg1) \
  126. /*lint -save -e571*/nrf_log_frontend_std_2(type, str, (uint32_t)(arg0), \
  127. (uint32_t)(arg1))/*lint -restore*/
  128. #define LOG_INTERNAL_3(type, str, arg0, arg1, arg2) \
  129. /*lint -save -e571*/nrf_log_frontend_std_3(type, str, (uint32_t)(arg0), \
  130. (uint32_t)(arg1), (uint32_t)(arg2))/*lint -restore*/
  131. #define LOG_INTERNAL_4(type, str, arg0, arg1, arg2, arg3) \
  132. /*lint -save -e571*/nrf_log_frontend_std_4(type, str, (uint32_t)(arg0), \
  133. (uint32_t)(arg1), (uint32_t)(arg2), (uint32_t)(arg3))/*lint -restore*/
  134. #define LOG_INTERNAL_5(type, str, arg0, arg1, arg2, arg3, arg4) \
  135. /*lint -save -e571*/nrf_log_frontend_std_5(type, str, (uint32_t)(arg0), \
  136. (uint32_t)(arg1), (uint32_t)(arg2), (uint32_t)(arg3), (uint32_t)(arg4))/*lint -restore*/
  137. #define LOG_INTERNAL_6(type, str, arg0, arg1, arg2, arg3, arg4, arg5) \
  138. /*lint -save -e571*/nrf_log_frontend_std_6(type, str, (uint32_t)(arg0), \
  139. (uint32_t)(arg1), (uint32_t)(arg2), (uint32_t)(arg3), (uint32_t)(arg4), (uint32_t)(arg5))/*lint -restore*/
  140. #else //NRF_LOG_ENABLED
  141. #define NRF_LOG_INTERNAL_LOG_PUSH(_str) (void)(_str)
  142. #define LOG_INTERNAL_0(_type, _str) \
  143. (void)(_type); (void)(_str)
  144. #define LOG_INTERNAL_1(_type, _str, _arg0) \
  145. (void)(_type); (void)(_str); (void)(_arg0)
  146. #define LOG_INTERNAL_2(_type, _str, _arg0, _arg1) \
  147. (void)(_type); (void)(_str); (void)(_arg0); (void)(_arg1)
  148. #define LOG_INTERNAL_3(_type, _str, _arg0, _arg1, _arg2) \
  149. (void)(_type); (void)(_str); (void)(_arg0); (void)(_arg1); (void)(_arg2)
  150. #define LOG_INTERNAL_4(_type, _str, _arg0, _arg1, _arg2, _arg3) \
  151. (void)(_type); (void)(_str); (void)(_arg0); (void)(_arg1); (void)(_arg2); (void)(_arg3)
  152. #define LOG_INTERNAL_5(_type, _str, _arg0, _arg1, _arg2, _arg3, _arg4) \
  153. (void)(_type); (void)(_str); (void)(_arg0); (void)(_arg1); (void)(_arg2); (void)(_arg3); (void)(_arg4)
  154. #define LOG_INTERNAL_6(_type, _str, _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) \
  155. (void)(_type); (void)(_str); (void)(_arg0); (void)(_arg1); (void)(_arg2); (void)(_arg3); (void)(_arg4); (void)(_arg5)
  156. #endif //NRF_LOG_ENABLED
  157. #define LOG_SEVERITY_MOD_ID(severity) ((severity) | NRF_LOG_MODULE_ID << NRF_LOG_MODULE_ID_POS)
  158. #define LOG_SEVERITY_INST_ID(severity,p_inst) ((severity) | NRF_LOG_INST_ID(p_inst) << NRF_LOG_MODULE_ID_POS)
  159. #if NRF_LOG_ENABLED
  160. #define LOG_HEXDUMP(_severity, _p_data, _length) \
  161. nrf_log_frontend_hexdump((_severity), (_p_data), (_length))
  162. #else
  163. #define LOG_HEXDUMP(_severity, _p_data, _length) \
  164. (void)(_severity); (void)(_p_data); (void)_length
  165. #endif
  166. #define NRF_LOG_INTERNAL_INST(level, level_id, p_inst, ...) \
  167. if (NRF_LOG_ENABLED && (NRF_LOG_LEVEL >= level) && \
  168. (level <= NRF_LOG_DEFAULT_LEVEL)) \
  169. { \
  170. if (NRF_LOG_INST_FILTER(p_inst) >= level) \
  171. { \
  172. LOG_INTERNAL(LOG_SEVERITY_INST_ID(level_id, p_inst), __VA_ARGS__); \
  173. } \
  174. }
  175. #define NRF_LOG_INTERNAL_MODULE(level, level_id, ...) \
  176. if (NRF_LOG_ENABLED && (NRF_LOG_LEVEL >= level) && \
  177. (level <= NRF_LOG_DEFAULT_LEVEL)) \
  178. { \
  179. if (NRF_LOG_FILTER >= level) \
  180. { \
  181. LOG_INTERNAL(LOG_SEVERITY_MOD_ID(level_id), __VA_ARGS__); \
  182. } \
  183. }
  184. #define NRF_LOG_INTERNAL_HEXDUMP_INST(level, level_id, p_inst, p_data, len) \
  185. if (NRF_LOG_ENABLED && (NRF_LOG_LEVEL >= level) && \
  186. (level <= NRF_LOG_DEFAULT_LEVEL)) \
  187. { \
  188. if (NRF_LOG_INST_FILTER(p_inst) >= level) \
  189. { \
  190. LOG_HEXDUMP(LOG_SEVERITY_INST_ID(level_id, p_inst), \
  191. (p_data), (len)); \
  192. } \
  193. }
  194. #define NRF_LOG_INTERNAL_HEXDUMP_MODULE(level, level_id, p_data, len) \
  195. if (NRF_LOG_ENABLED && (NRF_LOG_LEVEL >= level) && \
  196. (level <= NRF_LOG_DEFAULT_LEVEL)) \
  197. { \
  198. if (NRF_LOG_FILTER >= level) \
  199. { \
  200. LOG_HEXDUMP(LOG_SEVERITY_MOD_ID(level_id), \
  201. (p_data), (len)); \
  202. } \
  203. }
  204. #define NRF_LOG_INTERNAL_INST_ERROR(p_inst, ...) \
  205. NRF_LOG_INTERNAL_INST(NRF_LOG_SEVERITY_ERROR, NRF_LOG_SEVERITY_ERROR, p_inst, __VA_ARGS__)
  206. #define NRF_LOG_INTERNAL_ERROR(...) \
  207. NRF_LOG_INTERNAL_MODULE(NRF_LOG_SEVERITY_ERROR, NRF_LOG_SEVERITY_ERROR,__VA_ARGS__)
  208. #define NRF_LOG_INTERNAL_HEXDUMP_INST_ERROR(p_inst, p_data, len) \
  209. NRF_LOG_INTERNAL_HEXDUMP_INST(NRF_LOG_SEVERITY_ERROR, NRF_LOG_SEVERITY_ERROR, p_inst, p_data, len)
  210. #define NRF_LOG_INTERNAL_HEXDUMP_ERROR(p_data, len) \
  211. NRF_LOG_INTERNAL_HEXDUMP_MODULE(NRF_LOG_SEVERITY_ERROR, NRF_LOG_SEVERITY_ERROR, p_data, len)
  212. #define NRF_LOG_INTERNAL_INST_WARNING(p_inst, ...) \
  213. NRF_LOG_INTERNAL_INST(NRF_LOG_SEVERITY_WARNING, NRF_LOG_SEVERITY_WARNING, p_inst, __VA_ARGS__)
  214. #define NRF_LOG_INTERNAL_WARNING(...) \
  215. NRF_LOG_INTERNAL_MODULE(NRF_LOG_SEVERITY_WARNING, NRF_LOG_SEVERITY_WARNING,__VA_ARGS__)
  216. #define NRF_LOG_INTERNAL_HEXDUMP_INST_WARNING(p_inst, p_data, len) \
  217. NRF_LOG_INTERNAL_HEXDUMP_INST(NRF_LOG_SEVERITY_WARNING, NRF_LOG_SEVERITY_WARNING, p_inst, p_data, len)
  218. #define NRF_LOG_INTERNAL_HEXDUMP_WARNING(p_data, len) \
  219. NRF_LOG_INTERNAL_HEXDUMP_MODULE(NRF_LOG_SEVERITY_WARNING, NRF_LOG_SEVERITY_WARNING, p_data, len)
  220. #define NRF_LOG_INTERNAL_INST_INFO(p_inst, ...) \
  221. NRF_LOG_INTERNAL_INST(NRF_LOG_SEVERITY_INFO, NRF_LOG_SEVERITY_INFO, p_inst, __VA_ARGS__)
  222. #define NRF_LOG_INTERNAL_INFO(...) \
  223. NRF_LOG_INTERNAL_MODULE(NRF_LOG_SEVERITY_INFO, NRF_LOG_SEVERITY_INFO, __VA_ARGS__)
  224. #define NRF_LOG_INTERNAL_HEXDUMP_INST_INFO(p_inst, p_data, len) \
  225. NRF_LOG_INTERNAL_HEXDUMP_INST(NRF_LOG_SEVERITY_INFO, NRF_LOG_SEVERITY_INFO, p_inst, p_data, len)
  226. #define NRF_LOG_INTERNAL_HEXDUMP_INFO(p_data, len) \
  227. NRF_LOG_INTERNAL_HEXDUMP_MODULE(NRF_LOG_SEVERITY_INFO, NRF_LOG_SEVERITY_INFO, p_data, len)
  228. #define NRF_LOG_INTERNAL_RAW_INFO(...) \
  229. NRF_LOG_INTERNAL_MODULE(NRF_LOG_SEVERITY_INFO, NRF_LOG_SEVERITY_INFO_RAW, __VA_ARGS__)
  230. #define NRF_LOG_INTERNAL_RAW_HEXDUMP_INFO(p_data, len) \
  231. NRF_LOG_INTERNAL_HEXDUMP_MODULE(NRF_LOG_SEVERITY_INFO, NRF_LOG_SEVERITY_INFO_RAW, p_data, len)
  232. #define NRF_LOG_INTERNAL_INST_DEBUG(p_inst, ...) \
  233. NRF_LOG_INTERNAL_INST(NRF_LOG_SEVERITY_DEBUG, NRF_LOG_SEVERITY_DEBUG, p_inst, __VA_ARGS__)
  234. #define NRF_LOG_INTERNAL_DEBUG(...) \
  235. NRF_LOG_INTERNAL_MODULE(NRF_LOG_SEVERITY_DEBUG, NRF_LOG_SEVERITY_DEBUG, __VA_ARGS__)
  236. #define NRF_LOG_INTERNAL_HEXDUMP_INST_DEBUG(p_inst, p_data, len) \
  237. NRF_LOG_INTERNAL_HEXDUMP_INST(NRF_LOG_SEVERITY_DEBUG, NRF_LOG_SEVERITY_DEBUG, p_inst, p_data, len)
  238. #define NRF_LOG_INTERNAL_HEXDUMP_DEBUG(p_data, len) \
  239. NRF_LOG_INTERNAL_HEXDUMP_MODULE(NRF_LOG_SEVERITY_DEBUG, NRF_LOG_SEVERITY_DEBUG, p_data, len)
  240. #if NRF_LOG_ENABLED
  241. #ifdef UNIT_TEST
  242. #define COMPILED_LOG_LEVEL 4
  243. #else
  244. #define COMPILED_LOG_LEVEL NRF_LOG_LEVEL
  245. #endif
  246. #define NRF_LOG_INTERNAL_MODULE_REGISTER() \
  247. NRF_LOG_INTERNAL_ITEM_REGISTER(NRF_LOG_MODULE_NAME, \
  248. STRINGIFY(NRF_LOG_MODULE_NAME), \
  249. NRF_LOG_INFO_COLOR, \
  250. NRF_LOG_DEBUG_COLOR, \
  251. NRF_LOG_INITIAL_LEVEL, \
  252. COMPILED_LOG_LEVEL)
  253. #else
  254. #define NRF_LOG_INTERNAL_MODULE_REGISTER() /*lint -save -e19*/ /*lint -restore*/
  255. #endif
  256. extern nrf_log_module_dynamic_data_t NRF_LOG_ITEM_DATA_DYNAMIC(NRF_LOG_MODULE_NAME);
  257. extern _CONST nrf_log_module_const_data_t NRF_LOG_ITEM_DATA_CONST(NRF_LOG_MODULE_NAME);
  258. /**
  259. * Set of macros for encoding and decoding header for log entries.
  260. * There are 2 types of entries:
  261. * 1. Standard entry (STD)
  262. * An entry consists of header, pointer to string and values. Header contains
  263. * severity leveland determines number of arguments and thus size of the entry.
  264. * Since flash address space starts from 0x00000000 and is limited to kB rather
  265. * than MB 22 bits are used to store the address (4MB). It is used that way to
  266. * save one RAM memory.
  267. *
  268. * --------------------------------
  269. * |TYPE|SEVERITY|NARGS| P_STR |
  270. * |------------------------------|
  271. * | Module_ID (optional) |
  272. * |------------------------------|
  273. * | TIMESTAMP (optional) |
  274. * |------------------------------|
  275. * | ARG0 |
  276. * |------------------------------|
  277. * | .... |
  278. * |------------------------------|
  279. * | ARG(nargs-1) |
  280. * --------------------------------
  281. *
  282. * 2. Hexdump entry (HEXDUMP) is used for dumping raw data. An entry consists of
  283. * header, optional timestamp, pointer to string and data. A header contains
  284. * length (10bit) and offset which is updated after backend processes part of
  285. * data.
  286. *
  287. * --------------------------------
  288. * |TYPE|SEVERITY|NARGS|OFFSET|LEN|
  289. * |------------------------------|
  290. * | Module_ID (optional) |
  291. * |------------------------------|
  292. * | TIMESTAMP (optional) |
  293. * |------------------------------|
  294. * | P_STR |
  295. * |------------------------------|
  296. * | data |
  297. * |------------------------------|
  298. * | data | dummy |
  299. * --------------------------------
  300. *
  301. */
  302. #define STD_ADDR_MASK ((uint32_t)(1U << 22) - 1U)
  303. #define HEADER_TYPE_STD 1U
  304. #define HEADER_TYPE_HEXDUMP 2U
  305. #define HEADER_TYPE_INVALID 3U
  306. typedef struct
  307. {
  308. uint32_t type : 2;
  309. uint32_t in_progress: 1;
  310. uint32_t data : 29;
  311. } nrf_log_generic_header_t;
  312. typedef struct
  313. {
  314. uint32_t type : 2;
  315. uint32_t in_progress: 1;
  316. uint32_t severity : 3;
  317. uint32_t nargs : 4;
  318. uint32_t addr : 22;
  319. } nrf_log_std_header_t;
  320. typedef struct
  321. {
  322. uint32_t type : 2;
  323. uint32_t in_progress: 1;
  324. uint32_t severity : 3;
  325. uint32_t offset : 10;
  326. uint32_t reserved : 6;
  327. uint32_t len : 10;
  328. } nrf_log_hexdump_header_t;
  329. typedef union
  330. {
  331. nrf_log_generic_header_t generic;
  332. nrf_log_std_header_t std;
  333. nrf_log_hexdump_header_t hexdump;
  334. uint32_t raw;
  335. } nrf_log_main_header_t;
  336. typedef struct
  337. {
  338. nrf_log_main_header_t base;
  339. uint16_t module_id;
  340. uint16_t dropped;
  341. uint32_t timestamp;
  342. } nrf_log_header_t;
  343. #define HEADER_SIZE (sizeof(nrf_log_header_t)/sizeof(uint32_t) - \
  344. (NRF_LOG_USES_TIMESTAMP ? 0 : 1))
  345. /**
  346. * @brief A function for logging raw string.
  347. *
  348. * @param severity_mid Severity.
  349. * @param p_str A pointer to a string.
  350. */
  351. void nrf_log_frontend_std_0(uint32_t severity_mid, char const * const p_str);
  352. /**
  353. * @brief A function for logging a formatted string with one argument.
  354. *
  355. * @param severity_mid Severity.
  356. * @param p_str A pointer to a formatted string.
  357. * @param val0 An argument.
  358. */
  359. void nrf_log_frontend_std_1(uint32_t severity_mid,
  360. char const * const p_str,
  361. uint32_t val0);
  362. /**
  363. * @brief A function for logging a formatted string with 2 arguments.
  364. *
  365. * @param severity_mid Severity.
  366. * @param p_str A pointer to a formatted string.
  367. * @param val0, val1 Arguments for formatting string.
  368. */
  369. void nrf_log_frontend_std_2(uint32_t severity_mid,
  370. char const * const p_str,
  371. uint32_t val0,
  372. uint32_t val1);
  373. /**
  374. * @brief A function for logging a formatted string with 3 arguments.
  375. *
  376. * @param severity_mid Severity.
  377. * @param p_str A pointer to a formatted string.
  378. * @param val0, val1, val2 Arguments for formatting string.
  379. */
  380. void nrf_log_frontend_std_3(uint32_t severity_mid,
  381. char const * const p_str,
  382. uint32_t val0,
  383. uint32_t val1,
  384. uint32_t val2);
  385. /**
  386. * @brief A function for logging a formatted string with 4 arguments.
  387. *
  388. * @param severity_mid Severity.
  389. * @param p_str A pointer to a formatted string.
  390. * @param val0, val1, val2, val3 Arguments for formatting string.
  391. */
  392. void nrf_log_frontend_std_4(uint32_t severity_mid,
  393. char const * const p_str,
  394. uint32_t val0,
  395. uint32_t val1,
  396. uint32_t val2,
  397. uint32_t val3);
  398. /**
  399. * @brief A function for logging a formatted string with 5 arguments.
  400. *
  401. * @param severity_mid Severity.
  402. * @param p_str A pointer to a formatted string.
  403. * @param val0, val1, val2, val3, val4 Arguments for formatting string.
  404. */
  405. void nrf_log_frontend_std_5(uint32_t severity_mid,
  406. char const * const p_str,
  407. uint32_t val0,
  408. uint32_t val1,
  409. uint32_t val2,
  410. uint32_t val3,
  411. uint32_t val4);
  412. /**
  413. * @brief A function for logging a formatted string with 6 arguments.
  414. *
  415. * @param severity_mid Severity.
  416. * @param p_str A pointer to a formatted string.
  417. * @param val0, val1, val2, val3, val4, val5 Arguments for formatting string.
  418. */
  419. void nrf_log_frontend_std_6(uint32_t severity_mid,
  420. char const * const p_str,
  421. uint32_t val0,
  422. uint32_t val1,
  423. uint32_t val2,
  424. uint32_t val3,
  425. uint32_t val4,
  426. uint32_t val5);
  427. /**
  428. * @brief A function for logging raw data.
  429. *
  430. * @param severity_mid Severity.
  431. * @param p_str A pointer to a string which is prefixing the data.
  432. * @param p_data A pointer to data to be dumped.
  433. * @param length Length of data (in bytes).
  434. *
  435. */
  436. void nrf_log_frontend_hexdump(uint32_t severity_mid,
  437. const void * const p_data,
  438. uint16_t length);
  439. /**
  440. * @brief A function for reading a byte from log backend.
  441. *
  442. * @return Byte.
  443. */
  444. uint8_t nrf_log_getchar(void);
  445. #endif // NRF_LOG_INTERNAL_H__