|
| 1 | +/* |
| 2 | +* SPDX-License-Identifier: Apache-2.0 |
| 3 | +* Copyright 2019-2021 Western Digital Corporation or its affiliates. |
| 4 | +* |
| 5 | +* Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +* you may not use this file except in compliance with the License. |
| 7 | +* You may obtain a copy of the License at |
| 8 | +* |
| 9 | +* http:*www.apache.org/licenses/LICENSE-2.0 |
| 10 | +* |
| 11 | +* Unless required by applicable law or agreed to in writing, software |
| 12 | +* distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +* See the License for the specific language governing permissions and |
| 15 | +* limitations under the License. |
| 16 | +*/ |
| 17 | +/** |
| 18 | +* @file comrv_config.h |
| 19 | +* @author Ronen Haen |
| 20 | +* @date 11.06.2019 |
| 21 | +* @brief The file defines the COM-RV configuration |
| 22 | +*/ |
| 23 | +#ifndef __COMRV_CONFIG_H__ |
| 24 | +#define __COMRV_CONFIG_H__ |
| 25 | + |
| 26 | +/** |
| 27 | +* include files |
| 28 | +*/ |
| 29 | + |
| 30 | +/** |
| 31 | +* definitions |
| 32 | +*/ |
| 33 | +/* specify eviction policy */ |
| 34 | +//#define D_COMRV_EVICTION_POLICY=1 |
| 35 | + |
| 36 | +/* enable multi-group support */ |
| 37 | +#ifdef D_COMRV_ENABLE_MULTI_GROUP_SUPPORT |
| 38 | + #define D_COMRV_MULTI_GROUP_SUPPORT |
| 39 | + /* this will use upto 2^8 -1 multi groups; if not defined, |
| 40 | + the maximum number of groups will be used (2^16 - 1) */ |
| 41 | + #ifdef D_COMRV_ENABLE_MIN_NUM_OF_MULTI_GROUP_SUPPORT |
| 42 | + #define D_COMRV_MIN_NUM_OF_MULTI_GROUPS |
| 43 | + #endif /* D_COMRV_ENABLE_MAX_MULTI_GROUP_SIZE_SUPPORT */ |
| 44 | +#endif /* D_COMRV_USE_MULTI_GROUP_SUPPORT */ |
| 45 | + |
| 46 | +/* enable instrumentation */ |
| 47 | +#ifdef D_COMRV_ENABLE_FW_INSTRUMENTATION_SUPPORT |
| 48 | + #define D_COMRV_FW_INSTRUMENTATION |
| 49 | +#endif /* D_COMRV_ENABLE_FW_INSTRUMENTATION_SUPPORT */ |
| 50 | + |
| 51 | +#ifdef D_COMRV_ALLOW_CALLS_AFTER_SEARCH_LOAD_SUPPORT |
| 52 | + /* Mark we allow non comrv function calls after search and load |
| 53 | + indication - applies only for rtos support to handle |
| 54 | + cases where we get a context switch during calls to such functions */ |
| 55 | + #define D_COMRV_ALLOW_CALLS_AFTER_SEARCH_LOAD |
| 56 | +#endif /* D_COMRV_ENABLE_FW_INSTRUMENTATION_NON_ATOMIC_SUPPORT */ |
| 57 | + |
| 58 | +/* enable init vars run time validation */ |
| 59 | +#ifdef D_COMRV_ENABLE_VERIFY_INIT_ARGS_SUPPORT |
| 60 | + #define D_COMRV_VERIFY_INIT_ARGS |
| 61 | +#endif /* D_COMRV_ENABLE_VERIFY_INIT_ARGS_SUPPORT */ |
| 62 | + |
| 63 | +/* enable overlay data usage */ |
| 64 | +#ifdef D_COMRV_ENABLE_OVL_DATA_SUPPORT |
| 65 | + #define D_COMRV_OVL_DATA_SUPPORT |
| 66 | +#endif /* D_COMRV_ENABLE_OVL_DATA_SUPPORT */ |
| 67 | + |
| 68 | +/* enable CRC */ |
| 69 | +#ifdef D_COMRV_ENABLE_CRC_SUPPORT |
| 70 | + #define D_COMRV_CRC |
| 71 | +#endif /* D_COMRV_ENABLE_CRC_SUPPORT */ |
| 72 | + |
| 73 | +#ifdef D_COMRV_ENABLE_DEBUG_SUPPORT |
| 74 | + #define D_COMRV_DEBUG |
| 75 | +#endif /* D_COMRV_ENABLE_DEBUG_SUPPORT */ |
| 76 | + |
| 77 | +/* enable the ability to enable/disable comrv */ |
| 78 | +#ifdef D_COMRV_ENABLE_CONTROL_SUPPORT |
| 79 | + #define D_COMRV_CONTROL_SUPPORT |
| 80 | +#endif /* D_COMRV_ENABLE_CONTROL_SUPPORT */ |
| 81 | + |
| 82 | +/* enable comrv error notifications */ |
| 83 | +#ifdef D_COMRV_ENABLE_ERROR_NOTIFICATIONS |
| 84 | + #define D_COMRV_ERROR_NOTIFICATIONS |
| 85 | +#endif /* M_COMRV_ENABLE_ERROR_NOTIFICATIONS */ |
| 86 | + |
| 87 | +/* enable rtos support */ |
| 88 | +#ifdef D_COMRV_ENABLE_RTOS_SUPPORT |
| 89 | + #define D_COMRV_RTOS_SUPPORT |
| 90 | +#endif /* D_COMRV_ENABLE_RTOS_SUPPORT */ |
| 91 | + |
| 92 | +/* enable comrv asserts */ |
| 93 | +#ifdef D_COMRV_ENABLE_ASSERT_SUPPORT |
| 94 | + #define D_COMRV_ASSERT_ENABLED |
| 95 | +#endif /* D_COMRV_ENABLE_ASSERT_SUPPORT */ |
| 96 | + |
| 97 | +/* minimum size of an overlay group */ |
| 98 | +#if D_COMRV_MIN_GROUP_SIZE_IN_BYTES > 0 |
| 99 | + #if D_COMRV_MIN_GROUP_SIZE_IN_BYTES < 512 |
| 100 | + #error "unsupported size D_COMRV_MIN_GROUP_SIZE_IN_BYTES provided" |
| 101 | + #endif /* D_COMRV_MIN_GROUP_SIZE_IN_BYTES < 512 */ |
| 102 | + #define D_COMRV_OVL_GROUP_SIZE_MIN D_COMRV_MIN_GROUP_SIZE_IN_BYTES |
| 103 | +#else |
| 104 | + #define D_COMRV_OVL_GROUP_SIZE_MIN 512 |
| 105 | +#endif /* D_COMRV_MIN_GROUP_SIZE_IN_BYTES */ |
| 106 | + |
| 107 | +/* maximum size of an overlay group */ |
| 108 | +#if D_COMRV_MAX_GROUP_SIZE_IN_BYTES > 0 |
| 109 | + #if D_COMRV_MAX_GROUP_SIZE_IN_BYTES > 4096 |
| 110 | + #error "unsupported size D_COMRV_MAX_GROUP_SIZE_IN_BYTES provided" |
| 111 | + #endif /* D_COMRV_MAX_GROUP_SIZE_IN_BYTES > 4096 */ |
| 112 | + #define D_COMRV_OVL_GROUP_SIZE_MAX D_COMRV_MAX_GROUP_SIZE_IN_BYTES |
| 113 | +#else |
| 114 | + #define D_COMRV_OVL_GROUP_SIZE_MAX 4096 |
| 115 | +#endif /* D_COMRV_MAX_GROUP_SIZE_IN_BYTES */ |
| 116 | + |
| 117 | +/* maximum number of overlay calls depth within the |
| 118 | + entire application; if the application contains several tasks |
| 119 | + this define must cover the max number at any given time */ |
| 120 | +#if D_COMRV_MAX_CALL_STACK_DEPTH > 0 |
| 121 | + #define D_COMRV_CALL_STACK_DEPTH D_COMRV_MAX_CALL_STACK_DEPTH |
| 122 | +#else |
| 123 | + #define D_COMRV_CALL_STACK_DEPTH 10 |
| 124 | +#endif /* D_COMRV_MAX_CALL_STACK_DEPTH */ |
| 125 | + |
| 126 | +/* size of the overlay cache - the size of the RAM provided |
| 127 | + for loading and executing the overlay groups; granularity |
| 128 | + expressed in bytes */ |
| 129 | +#if D_COMRV_MAX_OVL_CACHE_SIZE_IN_BYTES > 0 |
| 130 | + #define D_COMRV_OVL_CACHE_SIZE_IN_BYTES D_COMRV_MAX_OVL_CACHE_SIZE_IN_BYTES |
| 131 | +#else |
| 132 | + #define D_COMRV_OVL_CACHE_SIZE_IN_BYTES 1536 |
| 133 | +#endif /* D_COMRV_MAX_OVL_CACHE_SIZE_IN_BYTES */ |
| 134 | + |
| 135 | +/* eviction algorithm definition */ |
| 136 | +#if (D_COMRV_EVICTION_POLICY == 0) |
| 137 | + #ifndef D_COMRV_EVICTION_POLICY |
| 138 | + /* can be that D_COMRV_EVICTION_POLICY wasn't defined - same as if it was |
| 139 | + set to 0 so set it to 1 - 0 and 1 are the same - lru */ |
| 140 | + #define D_COMRV_EVICTION_POLICY 1 |
| 141 | + #endif /* D_COMRV_EVICTION_POLICY */ |
| 142 | + #define D_COMRV_EVICTION_LRU |
| 143 | +#elif (D_COMRV_EVICTION_POLICY == 1) |
| 144 | + #define D_COMRV_EVICTION_LRU |
| 145 | +#elif (D_COMRV_EVICTION_POLICY == 2) |
| 146 | + #define D_COMRV_EVICTION_LFU |
| 147 | +#elif (D_COMRV_EVICTION_POLICY == 3) |
| 148 | + #define D_COMRV_EVICTION_MIX_LRU_LFU |
| 149 | +#endif /* */ |
| 150 | + |
| 151 | +#ifdef D_COMRV_ENABLE_LOAD_CONFIG_SUPPORT |
| 152 | + #define D_COMRV_LOAD_CONFIG_SUPPORT |
| 153 | +#endif /* D_COMRV_ENABLE_LOAD_CONFIG_SUPPORT */ |
| 154 | + |
| 155 | + |
| 156 | +#ifdef D_COMRV_ENABLE_OVL_DATA_SUPPORT |
| 157 | + #define D_COMRV_OVL_DATA_SUPPORT |
| 158 | +#endif /* D_COMRV_ENABLE_LOAD_CONFIG_SUPPORT */ |
| 159 | + |
| 160 | +#ifdef D_COMRV_ENABLE_CODE_SIZE |
| 161 | + #define D_COMRV_CODE_SIZE_SUPPORT |
| 162 | +#endif /* D_COMRV_ENABLE_CODE_SIZE */ |
| 163 | + |
| 164 | +#endif /* __COMRV_CONFIG_H__ */ |
| 165 | + |
0 commit comments