rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [diff] [blame] | 1 | /***************************************************************************** |
| 2 | * Copyright Statement: |
| 3 | * -------------------- |
| 4 | * This software is protected by Copyright 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) 2012 |
| 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 | /******************************************************************************* |
| 37 | * Filename: |
| 38 | * --------- |
| 39 | * lte_macros.h |
| 40 | * |
| 41 | * Project: |
| 42 | * -------- |
| 43 | * MOLY |
| 44 | * |
| 45 | * Description: |
| 46 | * ------------ |
| 47 | * |
| 48 | * |
| 49 | * Author: |
| 50 | * ------- |
| 51 | * ------- |
| 52 | * |
| 53 | * |
| 54 | * ========================================================================== |
| 55 | * $Log$ |
| 56 | * |
| 57 | * 01 16 2014 moja.hsu |
| 58 | * [MOLY00053980] Fix complier warning |
| 59 | * . |
| 60 | * |
| 61 | * 01 07 2014 moja.hsu |
| 62 | * [MOLY00052548] Add trace for ERT boot up procedure time |
| 63 | * add SWLA log. |
| 64 | * |
| 65 | * 01 06 2014 moja.hsu |
| 66 | * [MOLY00052548] Add trace for ERT boot up procedure time |
| 67 | * . |
| 68 | * |
| 69 | * 05 15 2013 moja.hsu |
| 70 | * [MOLY00007625] Maintain code |
| 71 | * integrate from firstcall |
| 72 | * ERT TASK TO ert HISR. |
| 73 | * DSP lisr2hisr. |
| 74 | * LTM, edyn, etmr trace. |
| 75 | * EDYN EM Channel |
| 76 | ****************************************************************************/ |
| 77 | /** |
| 78 | * @file lte_macros.h |
| 79 | * @brief Common LTE Module Macros |
| 80 | * |
| 81 | * @author Moja Hsu, moja_hsu@mtk.com.tw |
| 82 | * @date 2012/06/19 16:26:04 |
| 83 | * |
| 84 | **/ |
| 85 | |
| 86 | #ifndef LTE_MACROS_INC |
| 87 | #define LTE_MACROS_INC |
| 88 | |
| 89 | #include "kal_general_types.h" |
| 90 | #include "kal_public_defs.h" |
| 91 | |
| 92 | /** |
| 93 | * Goal: |
| 94 | * To reduce construct/destroy 2000 CPU Cycles. |
| 95 | * For some special condition(e.g. we know the receiver should finish the ILM before sender next action) |
| 96 | * We can use the following marcos to keep local parameter memory. |
| 97 | * |
| 98 | * Usage example: |
| 99 | * //Use static buffer and init it first.. |
| 100 | * nonFreeLocalPara_Init(&g_elx.xx_para, (sizeof(xxx_yyy_t)); |
| 101 | * |
| 102 | * //sender usage |
| 103 | * nonFreeLocalPara_Hold(g_elx.xx_local_para_ptr); |
| 104 | * //fill some blah, blah data... |
| 105 | * msg_send6( |
| 106 | MOD_ELX, |
| 107 | MOD_ELY, |
| 108 | XX_YY_SAP, |
| 109 | MSG_ID_XX_YY_IND, |
| 110 | (local_para_struct*)g_elx.xx_local_para_ptr, |
| 111 | NULL |
| 112 | ); |
| 113 | * |
| 114 | * //receiver usage |
| 115 | * //When receive finish, it only need to use the macro for ilm. |
| 116 | * nonFreeILM_Release(p_ilm); |
| 117 | */ |
| 118 | #define nonFreeLocalPara_Init(_local_para_ptr, _size) \ |
| 119 | do{ \ |
| 120 | (_local_para_ptr)->msg_len = _size; \ |
| 121 | (_local_para_ptr)->ref_count = 1; \ |
| 122 | }while(0) |
| 123 | |
| 124 | /** |
| 125 | * @brief nonFreeLocalPara_Hold |
| 126 | * Used to hold local parameter and check if the local parameter is released by receiver module. |
| 127 | * |
| 128 | * @param _local_para_ptr |
| 129 | * |
| 130 | * @return |
| 131 | */ |
| 132 | #define nonFreeLocalPara_Hold(_local_para_ptr) \ |
| 133 | do { \ |
| 134 | ASSERT((_local_para_ptr)->ref_count == 1); \ |
| 135 | (_local_para_ptr)->ref_count++; \ |
| 136 | }while(0) |
| 137 | |
| 138 | /** |
| 139 | * @brief nonFreeLocalPara_Release |
| 140 | * Release local parameter and set the local_para_ptr to NULL on ILM. |
| 141 | * |
| 142 | * @param _ilm_ptr |
| 143 | * |
| 144 | * @return |
| 145 | */ |
| 146 | #define nonFreeLocalPara_Release(_ilm_ptr) \ |
| 147 | do { \ |
| 148 | (_ilm_ptr)->local_para_ptr->ref_count--; \ |
| 149 | (_ilm_ptr)->local_para_ptr = NULL; \ |
| 150 | }while(0) |
| 151 | |
| 152 | /** |
| 153 | * @brief nonFreeLocalPara_Hold2, nonFreeLocalPara_Release2 |
| 154 | * Used for pure hold and release case. |
| 155 | * If the loca parameter will need to be hold, but also don't want to release. |
| 156 | * user the macros. |
| 157 | * |
| 158 | * @param _local_para_ptr |
| 159 | * |
| 160 | * @return |
| 161 | */ |
| 162 | #define nonFreeLocalPara_Hold2(_local_para_ptr) \ |
| 163 | do { \ |
| 164 | (_local_para_ptr)->ref_count++; \ |
| 165 | }while(0) |
| 166 | #define nonFreeLocalPara_Release2(_local_para_ptr) \ |
| 167 | do { \ |
| 168 | (_local_para_ptr)->ref_count--; \ |
| 169 | }while(0) |
| 170 | |
| 171 | /** |
| 172 | * Used for init time trace |
| 173 | */ |
| 174 | #ifdef __MTK_TARGET__ |
| 175 | #include "kal_public_api.h" |
| 176 | #include "cpu.h" |
| 177 | #include "TrcMod.h" |
| 178 | //prevent compiler warning. So user need to include the header file by itself |
| 179 | //#include "edyn_str.h" |
| 180 | #include "swla_public.h" |
| 181 | /* used to declare variable*/ |
| 182 | #define EINIT_LOG_HEAD() \ |
| 183 | kal_uint32 __c1, __c2, __sys1, __sys2; |
| 184 | |
| 185 | /* used to get cycles*/ |
| 186 | #define EINIT_LOG_START(_a) \ |
| 187 | do { \ |
| 188 | cpu_event_counter_get_cycle(__c1); \ |
| 189 | __sys1 = kal_get_systicks(); \ |
| 190 | EINIT_TIME(0, _a, __c1, __sys1); \ |
| 191 | SLA_CustomLogging((kal_char *)einit_str_tbl[_a],SA_start); \ |
| 192 | }while(0) |
| 193 | |
| 194 | #define EINIT_LOG_END(_a) \ |
| 195 | do { \ |
| 196 | cpu_event_counter_get_cycle(__c2); \ |
| 197 | __sys2 = kal_get_systicks(); \ |
| 198 | EINIT_TIME(1, _a, cpu_event_get_duration(__c1, __c2), __sys2 - __sys1); \ |
| 199 | SLA_CustomLogging((kal_char *)einit_str_tbl[_a],SA_stop); \ |
| 200 | }while(0) |
| 201 | |
| 202 | #else/*MODIS case, just empty them*/ |
| 203 | #define EINIT_LOG_HEAD() |
| 204 | #define EINIT_LOG_START(_a) |
| 205 | #define EINIT_LOG_END(_a) |
| 206 | #endif/*__MTK_TARGET__*/ |
| 207 | |
| 208 | #endif /* ----- #ifndef LTE_MACROS_INC ----- */ |
| 209 | |