rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * Modification Notice: |
| 3 | * -------------------------- |
| 4 | * This software is modified by MediaTek Inc. and the information contained |
| 5 | * herein is confidential. The software may not be copied and the information |
| 6 | * contained herein may not be used or disclosed except with the written |
| 7 | * permission of MediaTek Inc. (C) 2018 |
| 8 | * |
| 9 | * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 10 | * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| 11 | * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| 12 | * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 13 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 14 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 15 | * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 16 | * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 17 | * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| 18 | * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| 19 | * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| 20 | * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| 21 | * |
| 22 | * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| 23 | * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 24 | * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 25 | * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| 26 | * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 27 | * |
| 28 | * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| 29 | * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| 30 | * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| 31 | * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| 32 | * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| 33 | * |
| 34 | *******************************************************************************/ |
| 35 | |
| 36 | /* Doxygene header *********************************************************//** |
| 37 | * |
| 38 | * @file nr_mod.c |
| 39 | * @brief NL1 MODULE source file. |
| 40 | * @details Put your detail descriptions of the purpose and doing what in this file. |
| 41 | * @addtogroup NL1 |
| 42 | * @{ |
| 43 | *//***************************************************************************/ |
| 44 | |
| 45 | #define __NL1_C_FILE__ /* This file belongs to NL1 related C files. */ |
| 46 | #define __NL1_MOD_C_FILE__ /* This file belongs to NL1 MODULE related C files. */ |
| 47 | #define __NR_MOD_C__ /* This file is for MODULE C file. */ |
| 48 | |
| 49 | /******************************************************************************* |
| 50 | * #include |
| 51 | *******************************************************************************/ |
| 52 | #include "nl1_cid.h" |
| 53 | #include "nr_fwk_tool_api.h" |
| 54 | #include "nr_mod.h" |
| 55 | #include "nr_mod_submod.h" |
| 56 | |
| 57 | |
| 58 | ////////// End #include ////////// |
| 59 | |
| 60 | |
| 61 | /******************************************************************************* |
| 62 | * #define |
| 63 | * - All chars are "capital". |
| 64 | * - Use "NL1_" or module name (e.g., "RX_") as prefix. |
| 65 | * - Enclosed by "( )" to avoid ambiguity. |
| 66 | ********************************************************************************/ |
| 67 | //#define MOD_CELL_MAX (8) |
| 68 | |
| 69 | ////////// End #define ////////// |
| 70 | |
| 71 | |
| 72 | /******************************************************************************* |
| 73 | * typedef |
| 74 | * - enum |
| 75 | * - Use module name (e.g., "RX_") as prefix. |
| 76 | * - Add postfix with "_E" |
| 77 | * - Element Naming |
| 78 | * - All chars are "capital". |
| 79 | * - Words are separated by underline "_". |
| 80 | * - Use enum name as prefix (remove "_E"). |
| 81 | * - struct |
| 82 | * - Use module name (e.g., "RX_") as prefix. |
| 83 | * - Add postfix with "_T". |
| 84 | * - Element Naming |
| 85 | * - All chars are "lowercase". |
| 86 | * - Words are separated by underline "_". |
| 87 | *******************************************************************************/ |
| 88 | /** |
| 89 | * @brief |
| 90 | * @details |
| 91 | */ |
| 92 | typedef enum |
| 93 | { |
| 94 | MOD_XXX_0, |
| 95 | MOD_XXX_1, |
| 96 | MOD_XXX_2, |
| 97 | MOD_XXX_NUM, |
| 98 | MOD_XXX_INVALID = 0xFF, |
| 99 | } MOD_XXX_E; |
| 100 | |
| 101 | /** |
| 102 | * @brief |
| 103 | * @details |
| 104 | */ |
| 105 | typedef struct |
| 106 | { |
| 107 | kal_uint8 data_1; ///< Comment 1 |
| 108 | MOD_XXX_E data_2; ///< Comment 2 |
| 109 | kal_uint16 data_3; ///< Comment 3 |
| 110 | } MOD_T; |
| 111 | |
| 112 | ////////// End typedef ////////// |
| 113 | |
| 114 | |
| 115 | /******************************************************************************* |
| 116 | * Module Internal Data |
| 117 | * - Add keyword "static" to make sure that it is only visible in this C file. |
| 118 | * - Constant data |
| 119 | * - All chars are "lowercase". |
| 120 | * - Non-constant data |
| 121 | * - All chars are "capital" and add keyword "const" -> "static const". |
| 122 | * - Use "nl1_" + module name as prefix to name your variables. |
| 123 | * - One or few internal struct data for this module to process. |
| 124 | * - E.g., static NL1_MOD_SUBMOD_T nl1_mod_submod; |
| 125 | * - Easy to analyze and debug. |
| 126 | * - Easy to pass by pointer to callee. |
| 127 | *******************************************************************************/ |
| 128 | static MOD_T nl1_mod; |
| 129 | |
| 130 | ////////// End Module Internal Data ////////// |
| 131 | |
| 132 | |
| 133 | /******************************************************************************* |
| 134 | * Global Data |
| 135 | * - All chars are "capital". |
| 136 | * - Add keyword "const" to make sure not being overwritten by others. |
| 137 | * - Non-constant global data is not allwoed. |
| 138 | * - All system/common parameters shall be designed as input parameters from caller (don't extern or get by API). |
| 139 | * - Some other parameters are wrapped up in one struct to access by pointer (query by one API). |
| 140 | * - The remaining parts are wrapped up by each API (may have performance concern due to function call overhead) |
| 141 | *******************************************************************************/ |
| 142 | const kal_uint8 NL1_MOD_TABLE_1[MOD_XXX_NUM] = { 0, 1, 2 }; |
| 143 | |
| 144 | ////////// End Global Data ////////// |
| 145 | |
| 146 | |
| 147 | /******************************************************************************* |
| 148 | * Module Internal Function Prototype |
| 149 | *******************************************************************************/ |
| 150 | static void nl1_mod_function1( void ); |
| 151 | |
| 152 | ////////// End Module Internal Function Prototype ////////// |
| 153 | |
| 154 | |
| 155 | /******************************************************************************* |
| 156 | * Module Internal Functions |
| 157 | * - All chars are lowercase and add keyword "static" to make sure that it is only visible in this C file |
| 158 | * - Use "nl1_" + module name as prefix |
| 159 | * - E.g., static nl1_template_run( *void ) |
| 160 | *******************************************************************************/ |
| 161 | /******************************************************************************* |
| 162 | * @brief N/A |
| 163 | * @details N/A |
| 164 | * @param[in] N/A |
| 165 | * @param[out] Don't use output type parameter if possible. |
| 166 | * @param[in,out] Don't use output type parameter if possible. |
| 167 | * @return N/A |
| 168 | *******************************************************************************/ |
| 169 | static void nl1_mod_function1( void ) |
| 170 | { |
| 171 | FUNCTION_START(); |
| 172 | FUNCTION_VPETC_CHECK(FN_ALWAYS_BYPASS); /// @todo Need to revise to correct context |
| 173 | |
| 174 | FUNCTION_RETURN(); |
| 175 | return; |
| 176 | |
| 177 | FUNCTION_END(); |
| 178 | } |
| 179 | ////////// End Module Internal Functions ////////// |
| 180 | |
| 181 | |
| 182 | /******************************************************************************* |
| 183 | * Module Inernal Interface Functions |
| 184 | * - Functions would be called outside this file, but still inside the same module. |
| 185 | * - 1st char of each word is capital and others are lowercase and use "NL1_" + module name (all capital) as prefix. |
| 186 | * - E.g., NL1_RX_Start( void ) |
| 187 | *******************************************************************************/ |
| 188 | /******************************************************************************* |
| 189 | * @brief The main entry function of MODULE SUBMODULE. |
| 190 | * @details N/A |
| 191 | * @param[in] N/A |
| 192 | * @param[out] Don't use output type parameter if possible. |
| 193 | * @param[in,out] Don't use output type parameter if possible. |
| 194 | * @return N/A |
| 195 | *******************************************************************************/ |
| 196 | void NL1_MOD_Main( void ) |
| 197 | { |
| 198 | FUNCTION_START(); |
| 199 | FUNCTION_VPETC_CHECK(FN_ALWAYS_BYPASS); /// @todo Need to revise to correct context |
| 200 | |
| 201 | nl1_mod_function1(); |
| 202 | NL1_MOD_SUBMOD_Main(); |
| 203 | |
| 204 | FUNCTION_RETURN(); |
| 205 | return; |
| 206 | |
| 207 | FUNCTION_END(); |
| 208 | } |
| 209 | ////////// End Module Interface Functions ////////// |
| 210 | |
| 211 | |
| 212 | /******************************************************************************* |
| 213 | * Cross-Module Interface Functions "inside" NL1 |
| 214 | * - Public functions for other NL1 modules. |
| 215 | * - 1st char of each word is capital and others are lowercase. |
| 216 | * - Use "NL1_" + module name (all capital) + "_Api_" as prefix. |
| 217 | * - E.g., NL1_RX_Public_Start( void ) |
| 218 | * - NOTE: please check with caller owner of the executed context to avoid race condition. |
| 219 | *******************************************************************************/ |
| 220 | // See nl_mod_api.h for the description of this function. |
| 221 | void NL1_MOD_Api_Set_Xxx_Configuration( void *p_input ) |
| 222 | { |
| 223 | FUNCTION_START(); |
| 224 | FUNCTION_VPETC_CHECK(FN_ALWAYS_BYPASS); /// @todo Need to revise to correct context |
| 225 | |
| 226 | FUNCTION_RETURN(); |
| 227 | return; |
| 228 | |
| 229 | FUNCTION_END(); |
| 230 | } |
| 231 | ////////// End Module Public Interface Functions "inside" NL1 ////////// |
| 232 | |
| 233 | |
| 234 | /******************************************************************************* |
| 235 | * Cross-Layer Interface Functions "outside" NL1 |
| 236 | * - Public functions for other non-NL1 layers. |
| 237 | * - 1st char of each word is capital and others are lowercase. |
| 238 | * - Use "NL1_" + module name (all capital) + "_Public_" as prefix. |
| 239 | * - E.g., NL1_RX_Public_Start( void ) |
| 240 | * - NOTE: please check with caller owner of the executed context to avoid race condition. |
| 241 | *******************************************************************************/ |
| 242 | // See nl1_mod_public.h for the description of this function. |
| 243 | void NL1_MOD_Public_Get_Xxx_Configuration( void ) |
| 244 | { |
| 245 | FUNCTION_START(); |
| 246 | FUNCTION_VPETC_CHECK(FN_ALWAYS_BYPASS); /// @todo Need to revise to correct context |
| 247 | |
| 248 | FUNCTION_RETURN(); |
| 249 | return; |
| 250 | |
| 251 | FUNCTION_END(); |
| 252 | } |
| 253 | ////////// End Cross-Layer Interface Functions "outside" NL1 ////////// |
| 254 | |
| 255 | |
| 256 | /* Doxygene end of defgroup header!!! **********************************//**@}*/ |