• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 REGION DEFINITIONS.
15  * Author:
16  * Create:  2018-10-15
17  */
18 
19 #ifndef NON_OS_LOG_MEMORY_DEFINITIONS_H
20 #define NON_OS_LOG_MEMORY_DEFINITIONS_H
21 
22 #include "memory_config.h"
23 #include "stdint.h"
24 #include "chip_definitions.h"
25 #include "platform_core.h"
26 /**
27  * @addtogroup connectivity_drivers_non_os_log
28  * @{
29  */
30 /**
31  * @brief  LOG MEMORY REGIONS
32  */
33 typedef enum {
34     LOG_MEMORY_REGION_SECTION_0 = 0,  // !< LOG_MEMORY_REGION_SECTION_0 for app core
35 #if CORE_NUMS > 1
36     LOG_MEMORY_REGION_SECTION_1,      // !< LOG_MEMORY_REGION_SECTION_1 for application core
37 #endif
38 #if CORE_NUMS > 2
39     LOG_MEMORY_REGION_SECTION_2,      // !< LOG_MEMORY_REGION_SECTION_2 for hifi core when dsp exists.
40 #endif                                // !< Otherwise, for gnss core.
41 #if defined(CHIP_LIBRA) && (CHIP_LIBRA != 0)
42     LOG_MEMORY_REGION_SECTION_3,      // !< LOG_MEMORY_REGION_SECTION_3 for gnss core
43     LOG_MEMORY_REGION_SECTION_4,      // !< LOG_MEMORY_REGION_SECTION_4 for sec core
44 #endif
45     LOG_MEMORY_REGION_MAX_NUMBER,     // !< LOG_MEMORY_REGION_MAX_NUMBER
46 } log_memory_region_section_t;
47 
48 /**
49  * @brief  MASSDATA MEMORY REGIONS
50  */
51 typedef enum {
52     MASS_MEMORY_REGION_SECTION_0 = 0, // !< MASS_MEMORY_REGION_SECTION_0 for security core
53 #if CORE_NUMS > 1
54     MASS_MEMORY_REGION_SECTION_1,     // !< MASS_MEMORY_REGION_SECTION_1 for application core
55 #endif
56     MASS_MEMORY_REGION_MAX_NUMBER,    // !< MASS_MEMORY_REGION_MAX_NUMBER
57 } mass_data_memory_region_section_t;
58 
59 /**
60  * @brief  Log memory control structure for every section
61  */
62 typedef struct {
63     // reader controlled
64     volatile uint32_t read;
65 
66     // writer controlled
67     volatile uint32_t write;
68 } log_memory_section_control_t;
69 
70 /**
71  * @brief  Mass data memory control structure for every section
72  */
73 typedef struct {
74     volatile uint32_t read;
75     volatile uint32_t write;
76     volatile uint32_t flow_flag;   // index if the buffer is overflow write 0-no, 1-yes
77     volatile uint32_t region_len;
78     volatile uint32_t region_start;
79     volatile uint32_t water_line;
80 } massdata_memory_section_control_t;
81 
82 /**
83  * @brief  Log memory area control structure
84  */
85 typedef struct {
86     uint32_t region_num;
87     uint32_t mem_len;
88     massdata_memory_section_control_t section_control[MASS_MEMORY_REGION_MAX_NUMBER];
89 } massdata_memory_region_control_t;
90 
91 /**
92  * @brief  Log memory area control structure
93  */
94 typedef struct {
95     uint32_t offset[LOG_MEMORY_REGION_MAX_NUMBER];
96     uint32_t length;
97     log_memory_section_control_t section_control[LOG_MEMORY_REGION_MAX_NUMBER];
98 } log_memory_region_control_t;
99 
100 /** Macro to get the pointer to the log memory control block */
101 #define LOG_MEMORY_REGION_CONTROL_BLOCK_POINTER ((const log_memory_region_control_t *)(uintptr_t)LOGGING_REGION_START)
102 
103 /**
104  * @}
105  */
106 #endif
107