| /***************************************************************************** |
| * Copyright Statement: |
| * -------------------- |
| * This software is protected by Copyright 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) 2012 |
| * |
| * 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). |
| * |
| *****************************************************************************/ |
| |
| /******************************************************************************* |
| * Filename: |
| * --------- |
| * lte_macros.h |
| * |
| * Project: |
| * -------- |
| * MOLY |
| * |
| * Description: |
| * ------------ |
| * |
| * |
| * Author: |
| * ------- |
| * ------- |
| * |
| * |
| * ========================================================================== |
| * $Log$ |
| * |
| * 01 16 2014 moja.hsu |
| * [MOLY00053980] Fix complier warning |
| * . |
| * |
| * 01 07 2014 moja.hsu |
| * [MOLY00052548] Add trace for ERT boot up procedure time |
| * add SWLA log. |
| * |
| * 01 06 2014 moja.hsu |
| * [MOLY00052548] Add trace for ERT boot up procedure time |
| * . |
| * |
| * 05 15 2013 moja.hsu |
| * [MOLY00007625] Maintain code |
| * integrate from firstcall |
| * ERT TASK TO ert HISR. |
| * DSP lisr2hisr. |
| * LTM, edyn, etmr trace. |
| * EDYN EM Channel |
| ****************************************************************************/ |
| /** |
| * @file lte_macros.h |
| * @brief Common LTE Module Macros |
| * |
| * @author Moja Hsu, moja_hsu@mtk.com.tw |
| * @date 2012/06/19 16:26:04 |
| * |
| **/ |
| |
| #ifndef LTE_MACROS_INC |
| #define LTE_MACROS_INC |
| |
| #include "kal_general_types.h" |
| #include "kal_public_defs.h" |
| |
| /** |
| * Goal: |
| * To reduce construct/destroy 2000 CPU Cycles. |
| * For some special condition(e.g. we know the receiver should finish the ILM before sender next action) |
| * We can use the following marcos to keep local parameter memory. |
| * |
| * Usage example: |
| * //Use static buffer and init it first.. |
| * nonFreeLocalPara_Init(&g_elx.xx_para, (sizeof(xxx_yyy_t)); |
| * |
| * //sender usage |
| * nonFreeLocalPara_Hold(g_elx.xx_local_para_ptr); |
| * //fill some blah, blah data... |
| * msg_send6( |
| MOD_ELX, |
| MOD_ELY, |
| XX_YY_SAP, |
| MSG_ID_XX_YY_IND, |
| (local_para_struct*)g_elx.xx_local_para_ptr, |
| NULL |
| ); |
| * |
| * //receiver usage |
| * //When receive finish, it only need to use the macro for ilm. |
| * nonFreeILM_Release(p_ilm); |
| */ |
| #define nonFreeLocalPara_Init(_local_para_ptr, _size) \ |
| do{ \ |
| (_local_para_ptr)->msg_len = _size; \ |
| (_local_para_ptr)->ref_count = 1; \ |
| }while(0) |
| |
| /** |
| * @brief nonFreeLocalPara_Hold |
| * Used to hold local parameter and check if the local parameter is released by receiver module. |
| * |
| * @param _local_para_ptr |
| * |
| * @return |
| */ |
| #define nonFreeLocalPara_Hold(_local_para_ptr) \ |
| do { \ |
| ASSERT((_local_para_ptr)->ref_count == 1); \ |
| (_local_para_ptr)->ref_count++; \ |
| }while(0) |
| |
| /** |
| * @brief nonFreeLocalPara_Release |
| * Release local parameter and set the local_para_ptr to NULL on ILM. |
| * |
| * @param _ilm_ptr |
| * |
| * @return |
| */ |
| #define nonFreeLocalPara_Release(_ilm_ptr) \ |
| do { \ |
| (_ilm_ptr)->local_para_ptr->ref_count--; \ |
| (_ilm_ptr)->local_para_ptr = NULL; \ |
| }while(0) |
| |
| /** |
| * @brief nonFreeLocalPara_Hold2, nonFreeLocalPara_Release2 |
| * Used for pure hold and release case. |
| * If the loca parameter will need to be hold, but also don't want to release. |
| * user the macros. |
| * |
| * @param _local_para_ptr |
| * |
| * @return |
| */ |
| #define nonFreeLocalPara_Hold2(_local_para_ptr) \ |
| do { \ |
| (_local_para_ptr)->ref_count++; \ |
| }while(0) |
| #define nonFreeLocalPara_Release2(_local_para_ptr) \ |
| do { \ |
| (_local_para_ptr)->ref_count--; \ |
| }while(0) |
| |
| /** |
| * Used for init time trace |
| */ |
| #ifdef __MTK_TARGET__ |
| #include "kal_public_api.h" |
| #include "cpu.h" |
| #include "TrcMod.h" |
| //prevent compiler warning. So user need to include the header file by itself |
| //#include "edyn_str.h" |
| #include "swla_public.h" |
| /* used to declare variable*/ |
| #define EINIT_LOG_HEAD() \ |
| kal_uint32 __c1, __c2, __sys1, __sys2; |
| |
| /* used to get cycles*/ |
| #define EINIT_LOG_START(_a) \ |
| do { \ |
| cpu_event_counter_get_cycle(__c1); \ |
| __sys1 = kal_get_systicks(); \ |
| EINIT_TIME(0, _a, __c1, __sys1); \ |
| SLA_CustomLogging((kal_char *)einit_str_tbl[_a],SA_start); \ |
| }while(0) |
| |
| #define EINIT_LOG_END(_a) \ |
| do { \ |
| cpu_event_counter_get_cycle(__c2); \ |
| __sys2 = kal_get_systicks(); \ |
| EINIT_TIME(1, _a, cpu_event_get_duration(__c1, __c2), __sys2 - __sys1); \ |
| SLA_CustomLogging((kal_char *)einit_str_tbl[_a],SA_stop); \ |
| }while(0) |
| |
| #else/*MODIS case, just empty them*/ |
| #define EINIT_LOG_HEAD() |
| #define EINIT_LOG_START(_a) |
| #define EINIT_LOG_END(_a) |
| #endif/*__MTK_TARGET__*/ |
| |
| #endif /* ----- #ifndef LTE_MACROS_INC ----- */ |
| |