| /***************************************************************************** |
| * 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: |
| * --------- |
| * dl2cmgr.h |
| * |
| * Project: |
| * -------- |
| * |
| * |
| * Description: |
| * ------------ |
| * Dynamic L2 Cache lock Manager |
| * |
| * 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! |
| * |
| * |
| *------------------------------------------------------------------------------ |
| * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| *============================================================================== |
| *******************************************************************************/ |
| #ifndef __DL2CMGR_H__ |
| #define __DL2CMGR_H__ |
| |
| /******************************************************************************* |
| * Included header files |
| *******************************************************************************/ |
| #include "custom_dl2cmgr.h" |
| |
| /******************************************************************************* |
| * definition |
| *******************************************************************************/ |
| /* section id enum structure will be created in custom_dl2cmgr.h */ |
| |
| /* make sure to define TOTAL_DL2CM_SECTION as valuse of DYNAMIC_CACHE_SECTION_NUM */ |
| #define TOTAL_DL2CM_SECTION (DYNAMIC_CACHE_SECTION_NUM) |
| #define DL2CM_MAX_NUM (32) |
| |
| #define DL2CMGR_DL_KB_SIZE_LIMITATION (1024) |
| #define DL2CMGR_DL_US_TIME_LIMITATION (200) |
| |
| #define DYNAMIC_CACHE_SECTION_NUM L2CACHE_LOCK_SECTION_NUM |
| |
| |
| /* define dl2cm function return status */ |
| typedef enum { |
| DL2CM_STATUS_SUCCESS, /* the operation is succeeded */ |
| DL2CM_STATUS_LOCK_BEFORE, /* the section has been locked before*/ |
| DL2CM_STATUS_LOCKING, /* the section is locking */ |
| DL2CM_STATUS_UNLOCKING, /* the section is unlocking */ |
| DL2CM_STATUS_UNLOCK_NOTHING, /* the section is unlocked */ |
| } dl2cm_status; |
| |
| /* define dl2cm section status */ |
| typedef enum { |
| DL2CM_SECTION_UNLOCKED = 0, /* the section is not locked */ |
| DL2CM_SECTION_LOCKED, /* the section is locked */ |
| DL2CM_SECTION_LOCKING, /* the section is locking */ |
| DL2CM_SECTION_UNLOCKING, /* the section is unlocking */ |
| } dl2cm_section_status; |
| |
| /* define dl2cm actions*/ |
| typedef enum { |
| DL2CM_ACTION_NON = 0, |
| DL2CM_ACTION_LOCK_ENTER_LOCK, |
| DL2CM_ACTION_LOCK_DO_NOTHING_RETURN, |
| DL2CM_ACTION_LOCK_ERROR_DURING_UNLOCKING_RETURN, |
| DL2CM_ACTION_LOCK_DURING_LOCKING_RETURN, |
| DL2CM_ACTION_LOCK_ERROR_SIZE_OVERUSE_RETURN, |
| DL2CM_ACTION_LOCK_ERROR_SPEED_OVERUSE_RETURN, |
| DL2CM_ACTION_LOCK_START_LOCKL2, |
| DL2CM_ACTION_LOCK_END_LOCKL2, |
| DL2CM_ACTION_UNLOCK_ENTER_UNLOCK = 20, |
| DL2CM_ACTION_UNLOCK_DO_NOTHING_RETURN, |
| DL2CM_ACTION_UNLOCK_ERROR_DURING_LOCKING_RETURN, |
| DL2CM_ACTION_UNLOCK_DURING_UNLOCKING_RETURN, |
| DL2CM_ACTION_UNLOCK_START_UNLOCKL2, |
| DL2CM_ACTION_UNLOCK_END_UNLOCKL2, |
| } dl2cm_action; |
| |
| typedef struct _dl1cm_action_record { |
| dl2cm_section_id dl2cm_section_id; |
| kal_uint32 dl2cm_section_size; |
| kal_uint32 dl2cm_current_tick; |
| dl2cm_action dl2cm_action; |
| kal_uint32 dl2cm_total_lock_size; |
| kal_uint32 dl2cm_exceed_and_current_lock_section; |
| } dl2cm_action_record, *l2dl2cm_action_record_ptr; |
| |
| typedef struct _dl2cm_locked_area { |
| kal_uint32 start; |
| kal_uint32 size; |
| } dl2cm_locked_area; |
| |
| |
| /******************************************************************************* |
| * External Function Declaration |
| *******************************************************************************/ |
| typedef void (*dl2cm_trace_f)(const l2dl2cm_action_record_ptr dl2cm_record_ptr); |
| dl2cm_status dl2cm_lock(dl2cm_section_id dl2cm_section_id, kal_uint32 block_size, kal_uint32 block_number, kal_uint32 *exceed_limitation); |
| dl2cm_status dl2cm_unlock(dl2cm_section_id dl2cm_current_lock_id); |
| dl2cm_section_status dl2cm_query_status(dl2cm_section_id dl2cm_section_id, kal_uint32 *section_size); |
| void dl2cm_query_status_all( kal_uint32 *dl2cm_current_lock_id, kal_uint32 *dl2cm_current_lock_size, kal_uint32 *dl2cm_current_locking_id, kal_uint32 *dl2cm_current_locking_size); |
| void dl2cm_register_trace_api(dl2cm_trace_f dl2cm_trace_cb); |
| void dl2cm_get_speed_limitation(kal_uint32 *dl_kb_size, kal_uint32 *dl_us_time); |
| dl2cm_locked_area *dl2cm_getLockedAreas(void); |
| #endif /*__DL2CMGR_H__*/ |