/*************************************************************************** * Copyright (c) 2006-2007, Broadcom Corporation * All Rights Reserved * Confidential Property of Broadcom Corporation * * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. * * $brcm_Workfile: bprofile_tick_mips.h $ * $brcm_Revision: 2 $ * $brcm_Date: 1/15/07 10:50a $ * * Module Description: * * Embeddeble profiler library * MIPS Data acquisition module * * Revision History: * * $brcm_Log: /BSEAV/lib/bprofile/bprofile_tick_mips.h $ * * 2 1/15/07 10:50a vsilyaev * PR 25997: Added 7038 performance counters * * 1 12/13/06 7:48p vsilyaev * PR 25997: Generic MIPS profile sampler * *******************************************************************************/ /* MIPS32 performance sampling routine */ #include "bperf_counter.h" #ifndef b_gettick BSTD_INLINE unsigned __attribute__((no_instrument_function)) b_gettick(void) { unsigned b_mips_tick; __asm__ __volatile__( ".set\tmips32\n\t" "mfc0\t%0, $9, 0\n\t" ".set\tmips0\n\t" : "=r" (b_mips_tick)); return b_mips_tick; } #endif BSTD_INLINE void __attribute__((no_instrument_function)) b_sample(bprofile_sample *sample) { sample->time = b_gettick(); #if BPROFILE_CFG_PERF_COUNTER #if B_PERF_BMIPS3300 sample->counters[0] = b_perf_read_one(0); #if BPROFILE_CFG_PERF_COUNTER > 1 sample->counters[1] = b_perf_read_one(1); #endif #if BPROFILE_CFG_PERF_COUNTER > 2 sample->counters[2] = b_perf_read_one(2); #endif #if BPROFILE_CFG_PERF_COUNTER > 3 sample->counters[3] = b_perf_read_one(3); #endif #elif B_PERF_MIPSR5K sample->counters[0] = b_perf_read_one(1); #if BPROFILE_CFG_PERF_COUNTER > 1 sample->counters[1] = b_perf_read_one(3); #endif #if BPROFILE_CFG_PERF_COUNTER > 2 #error "Not supported" #endif #endif /* B_PERF_MIPSR5K */ #endif return; }