blob: 90955b22e9d74ce692c37f93d5bbdfc570e7add9 [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) 2005
*
* 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:
* ---------
* eint.h
*
* Project:
* --------
* Maui_Software
*
* Description:
* ------------
* This files define external interrupt constants definition
*
* Author:
* -------
* -------
* -------
*
*============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
* removed!
*
* removed!
* removed!
*
* removed!
* removed!
*
* removed!
* removed!
*
* removed!
* removed!
* removed!
* removed!
*
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*============================================================================
****************************************************************************/
#ifndef __EINT_H__
#define __EINT_H__
#include "kal_general_types.h"
#include "dcl.h"
#include "intrCtrl.h"
//#include "Eint_internal.h"
#include "eint_sw.h"
/*************************************************************************
* EINT Configuration
*************************************************************************/
#define LEVEL_HIGH KAL_TRUE
#define LEVEL_LOW KAL_FALSE
#define EINT_MASK_EINT0 0x00000001
#define EINT_INTACK_EINT0 0x00000001
#define EINT_STATUS_EINT0 0x00000001
#if defined(__CIRQ_DESIGN_NEW__)
#define EINTaddr(_no) (*(volatile kal_uint16 *)(EINT0_CON+_no))
#else
#define EINTaddr(_no) (*(volatile kal_uint16 *)(EINT0_CON+(0x4*_no)))
#endif
#define EINT_MASK_EINT(_no) (EINT_MASK_EINT0 << (_no))
#define EINT_INTACK_EINT(_no) (EINT_INTACK_EINT0 << (_no))
#define EINT_STATUS_EINT(_no) (EINT_STATUS_EINT0 << (_no))
#define EINT_CON_HIGHLEVEL 0x0800
#define EINT_CON_LOWLEVEL 0x0000
#define EINT_CON_DEBOUNCE 0x07ff
#define EINT_CON_DEBOUNCE_EN 0x8000
#define EINT_CHANNEL_NOT_EXIST EINT_TOTAL_CHANNEL
/*Engineering mode*/
typedef enum
{
aux_eint_chann,
chrdet_eint_chann,
melody_eint_chann,
clamdet_eint_chann,
touch_panel_eint_chann,
usb_eint_chann,
chr_usb_eint_chann,
bt_eint_chann,
swdbg_eint_chann,
motion_senosr_eint_chann,
tdmb_eint_chann,
cmmb_eint_chann,
wifi_eint_chann,
otg_idpin_eint_chann,
sync_lcm_chann,
extra_a_key_eint_chann,
extra_b_key_eint_chann,
gps_eint_chann,
dcam_vsync_eint_chann,
jogball_up_eint_chann,
jogball_down_eint_chann,
jogball_right_eint_chann,
jogball_left_eint_chann,
bt_co_clock_eint_chann,
wifi_co_clock_eint_chann
} eint_channel_type;
#if defined(__MD93__)
typedef struct
{
DCL_HANDLE eint_sw_debounce_handle;
kal_bool eint_intr_allow;
kal_uint8 eint_no;
} EINT_SW_DEBOUNCE_STRUCT;
#elif defined(__MD95__)
#elif defined(__MD97__)
#elif defined(__MD97P__)
#else
#error "no chip match"
#endif
typedef struct
{
void (*eint_func[EINT_TOTAL_CHANNEL])(void);
kal_bool eint_active[EINT_TOTAL_CHANNEL];
kal_bool eint_auto_umask[EINT_TOTAL_CHANNEL];
} eint_func;
typedef struct
{
void (*deint_func[DEDICATED_EINT_TOTAL_CHANNEL])(void);
kal_bool deint_active[DEDICATED_EINT_TOTAL_CHANNEL];
kal_bool deint_auto_umask[DEDICATED_EINT_TOTAL_CHANNEL];
} dedicated_eint_func;
extern void EINT_Registration(kal_uint8 eintno, kal_bool Dbounce_En, kal_bool ACT_Polarity, void (reg_hisr)(void), kal_bool auto_umask);
extern void EXTRA_EINT_Registration(kal_uint8 eintno, kal_bool ACT_Polarity, void (reg_hisr)(void), kal_bool auto_umask);
extern void DEINT_Registration(kal_uint8 deintno,void (reg_hisr)(void));
extern kal_uint32 EINT_Query_HW_Debounce(void);
extern void EINT_Set_HW_Debounce(kal_uint8 eintno, kal_uint32 ms);
extern void EINT_Set_HW_Debounce_Enable(kal_uint8 eintno, kal_uint32 debounce_en);
extern void EINT_Set_Polarity(kal_uint8 eintno, kal_bool ACT_Polarity);
extern kal_uint32 EINT_Set_Sensitivity(kal_uint8 eintno, kal_bool sens);
extern void EINT_LISR(kal_uint32 irq_id);
extern void EINT_Mask(kal_uint8 eintno);
extern void EINT_UnMask(kal_uint8 eintno);
extern kal_uint32 EINT_SaveAndMask(kal_uint8 eintno);
extern void EINT_RestoreMask(kal_uint8 eintno, kal_uint32 val);
//extern void EINT_DISABLE(kal_uint8 eintno);
#if defined(__MD93__)
extern kal_int32 EINT_SW_Debounce_Modify(kal_uint8 eintno, kal_uint8 debounce_time);
#elif defined(__MD95__)
#elif defined(__MD97__)
#elif defined(__MD97P__)
#else
#error "no chip match"
#endif
extern kal_uint32 EINT_SaveAndMaskAll(void);
extern void EINT_RestoreMaskAll(kal_uint32 val);
extern void EINT_SetSWRegister(kal_uint8 eintno);
extern void EINT_ResetSWRegister(kal_uint8 eintno);
extern void SWWAR_EINT_Registration(kal_uint8 eintno, kal_bool Dbounce_En, kal_bool ACT_Polarity);
extern void SWWAR_EINT_LISR_Registration(kal_uint8 eintno, void (*reg_lisr)(void));
extern void SWWAR_EINT_LISR(void);
extern void SWWAR_EINT_First_UnMask(kal_uint8 eintno);
//for MT6290 to set HW debounce 32k cycle, which is maximum persion
extern void EINT_Set_HW_Debounce_32KCycle(kal_uint8 eintno, kal_uint32 count_of_32kcycle);
/*************************************************************************
* Customized functions' prototype
*************************************************************************/
extern kal_uint8 *custom_config_eint_sw_debounce_time_delay(void);
extern kal_uint8 custom_eint_get_channel(eint_channel_type type);
#endif /* __EINT_H__ */