1 /* 2 * Copyright (c) 2019, Nordic Semiconductor ASA 3 * All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions are met: 9 * 10 * 1. Redistributions of source code must retain the above copyright notice, this 11 * list of conditions and the following disclaimer. 12 * 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its 18 * contributors may be used to endorse or promote products derived from this 19 * software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 * POSSIBILITY OF SUCH DAMAGE. 32 * 33 */ 34 35 #ifndef NRF_802154_DEBUG_LOG_CODES_H_ 36 #define NRF_802154_DEBUG_LOG_CODES_H_ 37 38 #include "nrf_802154_sl_log.h" 39 40 /** 41 * @brief List of C modules in nRF 802.15.4 Driver, with theirs ID-s 42 * 43 * Range of possible values for the 802.15.4 Driver modules has been indicated 44 * in nrf_802154_sl_log.h (see "Distribution of IDs for Debug Logs" in there) 45 * Prefix "NRF_802154_DRV_MODULE_ID_" is mandatory here, 46 * the final part is the module name to be presented by "event_decoder" tool. 47 * 48 * @note Certain NRF_802154_DRV_MODULE_ID.. value may be shared 49 * between alternative implementations of module 50 * (e.g. random_stdlib/random_zephyr/random_newlib) 51 * In other cases they must be unique. 52 * This enum must exist in .elf file to provide metadata for decoder.html tool 53 * (enum is extracted from .elf in the preparatory stage before using decoder.html) 54 */ 55 typedef enum 56 { 57 NRF_802154_DRV_MODULE_ID_APPLICATION = 1U, 58 NRF_802154_DRV_MODULE_ID_CORE = 2U, 59 NRF_802154_DRV_MODULE_ID_CRITICAL_SECTION = 3U, 60 NRF_802154_DRV_MODULE_ID_TRX = 4U, 61 NRF_802154_DRV_MODULE_ID_CSMACA = 5U, 62 NRF_802154_DRV_MODULE_ID_DELAYED_TRX = 6U, 63 NRF_802154_DRV_MODULE_ID_ACK_TIMEOUT = 7U, 64 NRF_802154_DRV_MODULE_ID_TRX_PPI = 8U, 65 NRF_802154_DRV_MODULE_ID_NOTIFICATION = 9U, 66 NRF_802154_DRV_MODULE_ID_CO = 10U 67 } nrf_802154_drv_modules_list_t; 68 69 /** 70 * @brief List of LOCAL EVENTS generated by module CORE 71 * 72 * To define elements of this enum, use 73 * - syntax: NRF_802154_LOG_LOCAL_EVENT_ID_{m}__{e} = {nID} 74 * or 75 * - macro: NRF_802154_LOG_L_EVENT_DEFINE({m},{e},{nID},{p_values}) 76 * where: 77 * {m} is the name of module 78 * {e} is the name of local event 79 * {nID} is numeric ID of local event (unique in module {m}) 80 * {p_values} further enum that defines the set of possible values of parameter for event {e} 81 * 82 * Both options (syntax/macro) are equivalent, except that using the macro causes additional 83 * link creation to {p_values}. See below - currently in the module CORE there is an local 84 * event SET_STATE, that has id 1 and possible parameter values for this event are as in 85 * enum radio_state_t 86 */ 87 typedef enum 88 { 89 NRF_802154_LOG_L_EVENT_DEFINE(CORE, SET_STATE, 1, radio_state_t) 90 } nrf_802154_drv_local_events_in_CORE_t; 91 92 /** 93 * @brief List of GLOBAL EVENTS generated in 802.15.4 Driver modules 94 * 95 * Range of possible values for the 802.15.4 Driver modules has been indicated 96 * in nrf_802154_sl_log.h (see "Distribution of IDs for Debug Logs" in there) 97 */ 98 typedef enum 99 { 100 NRF_802154_LOG_GLOBAL_EVENT_ID_RADIO_RESET = 1U 101 // Possible "RADIO_RESET" parameter values are : 0 (the only possible value) 102 } nrf_802154_drv_global_events_list_t; 103 104 typedef enum 105 { 106 NRF_802154_LOG_L_EVENT_DEFINE(DELAYED_TRX, SET_STATE, 1, delayed_trx_op_state_t) 107 } nrf_802154_drv_local_events_in_DELAYED_TRX_t; 108 109 typedef enum 110 { 111 NRF_802154_LOG_L_EVENT_DEFINE(CSMACA, SET_STATE, 1, csma_ca_state_t) 112 } nrf_802154_drv_local_events_in_CSMACA_t; 113 114 /** 115 * @brief List of all definitions that are needed for the correct presentation of debug logs 116 * 117 * All of the 'typedefs' defined above that are not used anywhere else in the code should occur 118 * in the union below, to ensure that information about them will appear in the final .elf file 119 */ 120 typedef union 121 { 122 uint8_t dummy00tag; 123 nrf_802154_drv_modules_list_t dummy01tag; 124 nrf_802154_drv_global_events_list_t dummy02tag; 125 nrf_802154_drv_local_events_in_CORE_t dummy03tag; 126 nrf_802154_drv_local_events_in_DELAYED_TRX_t dummy04tag; 127 nrf_802154_drv_local_events_in_CSMACA_t dummy05tag; 128 } nrf_802154_drv_typedefs_to_save_in_elf_t; 129 130 #endif /* NRF_802154_DEBUG_LOG_CODES_H_ */ 131