1 /* 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 * Description: LOG MEMORY SECTION INTERFACE 15 * Author: 16 * Create: 2018-10-15 17 */ 18 19 #ifndef NON_OS_LOG_MEMORY_SECTION_H 20 #define NON_OS_LOG_MEMORY_SECTION_H 21 22 #include "log_memory_definitions.h" 23 24 /** 25 * @addtogroup connectivity_drivers_non_os_log 26 * @{ 27 */ 28 /** 29 * @brief Log memory section parameters 30 */ 31 typedef struct { 32 uint8_t *start; 33 uint32_t length; 34 } log_memory_section_params_t; 35 36 /** 37 * @brief get the section data for a given region 38 * @param section log memory section 39 * @param section_data pointer where the section data will be stored 40 */ 41 void log_memory_section_get(log_memory_region_section_t section, log_memory_section_params_t *section_data); 42 43 /** 44 * @brief Get a pointer to the section control for a given log memory section 45 * @param section log memory section 46 * @return pointer to the section control for log memory section 47 */ 48 log_memory_section_control_t *log_memory_section_get_control(log_memory_region_section_t section); 49 50 /** Macro to check if a pointer is in the log memory region */ 51 #define pointer_in_log_memory_region(x) (((uint32_t)(x) >= (LOGGING_REGION_START)) && \ 52 ((uint32_t)(x) <= ((LOGGING_REGION_START) + (LOGGING_REGION_LENGTH)))) 53 54 /** 55 * @} 56 */ 57 #endif 58