blob: 2ade9efaf8ca7dd191a208c236d226a413ede214 [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:
* ---------
* cpu.h
*
* Project:
* --------
* TATAKA
*
* Description:
* ------------
* For CPU related functions
*
* Author:
* -------
* -------
*
* ==========================================================================
* $Log$
*
* 11 20 2017 tungchieh.tsai
* [MOLY00290533] [UMOLYA] Phase out CPU_CLOCK_MHZ relative API
*
* 12 13 2016 tungchieh.tsai
* [MOLY00216138] Integrate MDMCU macro
*
* 12 08 2016 tungchieh.tsai
* [MOLY00216138] Integrate MDMCU macro
*
* 12 08 2016 tungchieh.tsai
* [MOLY00216138] Integrate MDMCU macro
*
* 06 03 2016 yh.peng
* [MOLY00182649] [UMOLY/UMOLYA] Fix build warning.
* .
*
* 10 06 2015 yh.peng
* [MOLY00142591] [6292] 91Plus merge back to UMOLY
* Check in CPU cycle counter API.
*
* 08 14 2015 yh.peng
* [MOLY00136315] [System Service] [91 plus] Merge Back To UMOLY TRUNK
* Check in for Fix build error.
*
* 05 13 2015 yh.peng
* [MOLY00110737] [MT6291+] Check in init code.
* .Fix all assembly code to sw break.
*
* 04 30 2015 hc.yang
* [MOLY00110489] [MT6291PLUS] Modify files for BASIC_P load
* Phase in necessary modified files for BASIC_P load for MIPS compiler.
*
* 07 16 2013 cindy.tu
* [MOLY00027330] [ARM7toMOLY] ARM7 Build/SYSGEN/Functions Update to TRUNK
*
* 04 16 2013 chin-chieh.hung
* [MOLY00013348] [MT6290 Bring-up] Basic Platform Support
* Firstcall branch, MOLY Trunk Code Sync
*
* 04 08 2013 chin-chieh.hung
* [MOLY00013348] [MT6290 Bring-up] Basic Platform Support
* update CR4 performance monitor counter macro setting
*
* 03 27 2013 chin-chieh.hung
* [MOLY00012803] malmo asm software tracer support
* Add MALMO-SWTR support for MT6290
*
* 02 05 2013 cindy.tu
* [MOLY00009879] Rename MT7208 projects to MT6290
* <saved by Perforce>
*
* 02 04 2013 cindy.tu
* [MOLY00009879] Rename MT7208 projects to MT6290
* <saved by Perforce>
****************************************************************************/
#ifndef __DEVDRV_CPU_H__
#define __DEVDRV_CPU_H__
#include "kal_public_defs.h"
#include "mips_ia_utils_public.h"
/*************************************************************************
* Define constants
*************************************************************************/
#define CPU_PMU_COUNTER_WRAP (0xFFFFFFFFUL)
/*************************************************************************
* Define MACROS
*************************************************************************/
/* the input(start, end) is 32-bit PMU ticks */
#define cpu_event_get_duration(start, end) \
(((end) >= (start))? ((end) - (start)): ((CPU_PMU_COUNTER_WRAP - (start) + (end) + 1)))
#define cpu_event_counter_get_cycle(counter) \
do { \
counter = miu_cycle_counter_read(); \
} while(0)
#endif /* __DEVDRV_CPU_H__ */