| /****************************************************************************** |
| * Modification Notice: |
| * -------------------------- |
| * This software is modified by MediaTek Inc. and the information contained |
| * herein is confidential. The software may not be copied and the information |
| * contained herein may not be used or disclosed except with the written |
| * permission of MediaTek Inc. (C) 2018 |
| * |
| * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| * |
| * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| * |
| * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| * |
| *******************************************************************************/ |
| |
| /* Doxygene header *********************************************************//** |
| * |
| * @file nr_mod.c |
| * @brief NL1 MODULE source file. |
| * @details Put your detail descriptions of the purpose and doing what in this file. |
| * @addtogroup NL1 |
| * @{ |
| *//***************************************************************************/ |
| |
| #define __NL1_C_FILE__ /* This file belongs to NL1 related C files. */ |
| #define __NL1_MOD_C_FILE__ /* This file belongs to NL1 MODULE related C files. */ |
| #define __NR_MOD_C__ /* This file is for MODULE C file. */ |
| |
| /******************************************************************************* |
| * #include |
| *******************************************************************************/ |
| #include "nl1_cid.h" |
| #include "nr_fwk_tool_api.h" |
| #include "nr_mod.h" |
| #include "nr_mod_submod.h" |
| |
| |
| ////////// End #include ////////// |
| |
| |
| /******************************************************************************* |
| * #define |
| * - All chars are "capital". |
| * - Use "NL1_" or module name (e.g., "RX_") as prefix. |
| * - Enclosed by "( )" to avoid ambiguity. |
| ********************************************************************************/ |
| //#define MOD_CELL_MAX (8) |
| |
| ////////// End #define ////////// |
| |
| |
| /******************************************************************************* |
| * typedef |
| * - enum |
| * - Use module name (e.g., "RX_") as prefix. |
| * - Add postfix with "_E" |
| * - Element Naming |
| * - All chars are "capital". |
| * - Words are separated by underline "_". |
| * - Use enum name as prefix (remove "_E"). |
| * - struct |
| * - Use module name (e.g., "RX_") as prefix. |
| * - Add postfix with "_T". |
| * - Element Naming |
| * - All chars are "lowercase". |
| * - Words are separated by underline "_". |
| *******************************************************************************/ |
| /** |
| * @brief |
| * @details |
| */ |
| typedef enum |
| { |
| MOD_XXX_0, |
| MOD_XXX_1, |
| MOD_XXX_2, |
| MOD_XXX_NUM, |
| MOD_XXX_INVALID = 0xFF, |
| } MOD_XXX_E; |
| |
| /** |
| * @brief |
| * @details |
| */ |
| typedef struct |
| { |
| kal_uint8 data_1; ///< Comment 1 |
| MOD_XXX_E data_2; ///< Comment 2 |
| kal_uint16 data_3; ///< Comment 3 |
| } MOD_T; |
| |
| ////////// End typedef ////////// |
| |
| |
| /******************************************************************************* |
| * Module Internal Data |
| * - Add keyword "static" to make sure that it is only visible in this C file. |
| * - Constant data |
| * - All chars are "lowercase". |
| * - Non-constant data |
| * - All chars are "capital" and add keyword "const" -> "static const". |
| * - Use "nl1_" + module name as prefix to name your variables. |
| * - One or few internal struct data for this module to process. |
| * - E.g., static NL1_MOD_SUBMOD_T nl1_mod_submod; |
| * - Easy to analyze and debug. |
| * - Easy to pass by pointer to callee. |
| *******************************************************************************/ |
| static MOD_T nl1_mod; |
| |
| ////////// End Module Internal Data ////////// |
| |
| |
| /******************************************************************************* |
| * Global Data |
| * - All chars are "capital". |
| * - Add keyword "const" to make sure not being overwritten by others. |
| * - Non-constant global data is not allwoed. |
| * - All system/common parameters shall be designed as input parameters from caller (don't extern or get by API). |
| * - Some other parameters are wrapped up in one struct to access by pointer (query by one API). |
| * - The remaining parts are wrapped up by each API (may have performance concern due to function call overhead) |
| *******************************************************************************/ |
| const kal_uint8 NL1_MOD_TABLE_1[MOD_XXX_NUM] = { 0, 1, 2 }; |
| |
| ////////// End Global Data ////////// |
| |
| |
| /******************************************************************************* |
| * Module Internal Function Prototype |
| *******************************************************************************/ |
| static void nl1_mod_function1( void ); |
| |
| ////////// End Module Internal Function Prototype ////////// |
| |
| |
| /******************************************************************************* |
| * Module Internal Functions |
| * - All chars are lowercase and add keyword "static" to make sure that it is only visible in this C file |
| * - Use "nl1_" + module name as prefix |
| * - E.g., static nl1_template_run( *void ) |
| *******************************************************************************/ |
| /******************************************************************************* |
| * @brief N/A |
| * @details N/A |
| * @param[in] N/A |
| * @param[out] Don't use output type parameter if possible. |
| * @param[in,out] Don't use output type parameter if possible. |
| * @return N/A |
| *******************************************************************************/ |
| static void nl1_mod_function1( void ) |
| { |
| FUNCTION_START(); |
| FUNCTION_VPETC_CHECK(FN_ALWAYS_BYPASS); /// @todo Need to revise to correct context |
| |
| FUNCTION_RETURN(); |
| return; |
| |
| FUNCTION_END(); |
| } |
| ////////// End Module Internal Functions ////////// |
| |
| |
| /******************************************************************************* |
| * Module Inernal Interface Functions |
| * - Functions would be called outside this file, but still inside the same module. |
| * - 1st char of each word is capital and others are lowercase and use "NL1_" + module name (all capital) as prefix. |
| * - E.g., NL1_RX_Start( void ) |
| *******************************************************************************/ |
| /******************************************************************************* |
| * @brief The main entry function of MODULE SUBMODULE. |
| * @details N/A |
| * @param[in] N/A |
| * @param[out] Don't use output type parameter if possible. |
| * @param[in,out] Don't use output type parameter if possible. |
| * @return N/A |
| *******************************************************************************/ |
| void NL1_MOD_Main( void ) |
| { |
| FUNCTION_START(); |
| FUNCTION_VPETC_CHECK(FN_ALWAYS_BYPASS); /// @todo Need to revise to correct context |
| |
| nl1_mod_function1(); |
| NL1_MOD_SUBMOD_Main(); |
| |
| FUNCTION_RETURN(); |
| return; |
| |
| FUNCTION_END(); |
| } |
| ////////// End Module Interface Functions ////////// |
| |
| |
| /******************************************************************************* |
| * Cross-Module Interface Functions "inside" NL1 |
| * - Public functions for other NL1 modules. |
| * - 1st char of each word is capital and others are lowercase. |
| * - Use "NL1_" + module name (all capital) + "_Api_" as prefix. |
| * - E.g., NL1_RX_Public_Start( void ) |
| * - NOTE: please check with caller owner of the executed context to avoid race condition. |
| *******************************************************************************/ |
| // See nl_mod_api.h for the description of this function. |
| void NL1_MOD_Api_Set_Xxx_Configuration( void *p_input ) |
| { |
| FUNCTION_START(); |
| FUNCTION_VPETC_CHECK(FN_ALWAYS_BYPASS); /// @todo Need to revise to correct context |
| |
| FUNCTION_RETURN(); |
| return; |
| |
| FUNCTION_END(); |
| } |
| ////////// End Module Public Interface Functions "inside" NL1 ////////// |
| |
| |
| /******************************************************************************* |
| * Cross-Layer Interface Functions "outside" NL1 |
| * - Public functions for other non-NL1 layers. |
| * - 1st char of each word is capital and others are lowercase. |
| * - Use "NL1_" + module name (all capital) + "_Public_" as prefix. |
| * - E.g., NL1_RX_Public_Start( void ) |
| * - NOTE: please check with caller owner of the executed context to avoid race condition. |
| *******************************************************************************/ |
| // See nl1_mod_public.h for the description of this function. |
| void NL1_MOD_Public_Get_Xxx_Configuration( void ) |
| { |
| FUNCTION_START(); |
| FUNCTION_VPETC_CHECK(FN_ALWAYS_BYPASS); /// @todo Need to revise to correct context |
| |
| FUNCTION_RETURN(); |
| return; |
| |
| FUNCTION_END(); |
| } |
| ////////// End Cross-Layer Interface Functions "outside" NL1 ////////// |
| |
| |
| /* Doxygene end of defgroup header!!! **********************************//**@}*/ |