blob: 36c5f2eb8b86f8b65ef26da0151957f71bed937c [file] [log] [blame]
/*****************************************************************************
* 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:
* ---------
* @file L1Trc_array.h
*
* Description:
* ------------
* @brief Interface of L1 trace array.
* @note This header is included in L1Trc.h, please do not include this header alone!
*
* ==========================================================================
* $Log$
*
****************************************************************************/
#ifndef _DHL_L1TRC_ARRAY_H
#define _DHL_L1TRC_ARRAY_H
/********************************************
* L1/L2 Array Type support
********************************************/
#if defined(__USE_ULSP__)
// shrink the arg_count to max count to avoid whole L1 Trace frame decode fail
#define TRC_OUTPUT_ARRAY_IMPL(func_name, begin_trace_id, array_ptr, align, count, max_count) \
do { \
func_name(begin_trace_id, array_ptr, align, count < max_count ? count : max_count); \
} while(0)
#define TRC_OUTPUT_ARRAY_L1(begin_trace_id, array_ptr, align, count, max_count) TRC_OUTPUT_ARRAY_IMPL(trc_output_array_l1, begin_trace_id, array_ptr, align, count, max_count)
#define TRC_OUTPUT_ARRAY_L2(begin_trace_id, array_ptr, align, count, max_count) TRC_OUTPUT_ARRAY_IMPL(trc_output_array_l2, begin_trace_id, array_ptr, align, count, max_count)
// NON_SMP
#define TRC_OUTPUT_ARRAY_L1_NON_SMP TRC_OUTPUT_ARRAY_L1
#define TRC_OUTPUT_ARRAY_L2_NON_SMP TRC_OUTPUT_ARRAY_L2
extern void trc_output_array_l1(kal_uint16 begin_trace_id, void *array_ptr, kal_uint8 align, kal_uint8 count);
extern void trc_output_array_l2(kal_uint16 begin_trace_id, void *array_ptr, kal_uint8 align, kal_uint8 count);
#else // !defined(__USE_ULSP__)
#define TRC_OUTPUT_ARRAY_L1(BEGIN_TRC_ID, FILTER_ARRAY, FILTER_ARRAY_INDEX, FILTER_CLASS, ARRAY_PTR, ALIGN, COUNT, MAX_COUNT) \
do { \
if(FILTER_CHECK(FILTER_ARRAY, FILTER_ARRAY_INDEX, FILTER_CLASS)) { \
kal_uint32 oldmask=0; \
kal_uint8 vpe_id = 0; \
EXT_ASSERT(0 < COUNT && COUNT <= MAX_COUNT, COUNT, MAX_COUNT, 0); /* suppose SW solution is for internal use only, the assert should be accepted */ \
DHL_LOCK_CPU_INTERRUPT(oldmask); \
vpe_id = kal_get_current_vpe_id(); \
TRC_SEND_ARRAY_DATA_cb[vpe_id](BEGIN_TRC_ID, ARRAY_PTR, ALIGN, COUNT); \
DHL_UNLOCK_CPU_INTERRUPT(oldmask); \
} \
} while(0)
#define TRC_OUTPUT_ARRAY_L2(L2_BUFFER_SETTING, BEGIN_TRC_ID, FILTER_ARRAY, FILTER_ARRAY_INDEX, FILTER_CLASS, ARRAY_PTR, ALIGN, COUNT, MAX_COUNT) \
do { \
if(FILTER_CHECK(FILTER_ARRAY, FILTER_ARRAY_INDEX, FILTER_CLASS)) { \
EXT_ASSERT(0 < COUNT && COUNT <= MAX_COUNT, COUNT, MAX_COUNT, 0); /* suppose SW solution is for internal use only, the assert should be accepted */ \
l2trc_send_array_cb[L2_BUFFER_SETTING](BEGIN_TRC_ID, ARRAY_PTR, ALIGN, COUNT); \
} \
} while(0)
typedef void (*TRC_SEND_ARRAY_DATA_cb_t)(kal_uint16 begin_trace_id, void *array_ptr, kal_uint8 align, kal_uint8 count);
extern TRC_SEND_ARRAY_DATA_cb_t TRC_SEND_ARRAY_DATA_cb[6];
extern TRC_SEND_ARRAY_DATA_cb_t l2trc_send_array_cb[3];
#endif // defined(__USE_ULSP__)
#endif // _DHL_L1TRC_ARRAY_H