rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [diff] [blame] | 1 | /***************************************************************************** |
| 2 | * Copyright Statement: |
| 3 | * -------------------- |
| 4 | * This software is protected by Copyright and the information contained |
| 5 | * herein is confidential. The software may not be copied and the information |
| 6 | * contained herein may not be used or disclosed except with the written |
| 7 | * permission of MediaTek Inc. (C) 2005 |
| 8 | * |
| 9 | * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 10 | * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| 11 | * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| 12 | * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 13 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 14 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 15 | * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 16 | * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 17 | * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| 18 | * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| 19 | * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| 20 | * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| 21 | * |
| 22 | * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| 23 | * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 24 | * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 25 | * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| 26 | * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 27 | * |
| 28 | * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| 29 | * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| 30 | * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| 31 | * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| 32 | * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| 33 | * |
| 34 | *****************************************************************************/ |
| 35 | |
| 36 | /******************************************************************************* |
| 37 | * |
| 38 | * Filename: |
| 39 | * --------- |
| 40 | * dl2cmgr.h |
| 41 | * |
| 42 | * Project: |
| 43 | * -------- |
| 44 | * |
| 45 | * |
| 46 | * Description: |
| 47 | * ------------ |
| 48 | * Dynamic L2 Cache lock Manager |
| 49 | * |
| 50 | * Author: |
| 51 | * ------- |
| 52 | * ------- |
| 53 | * |
| 54 | *============================================================================== |
| 55 | * HISTORY |
| 56 | * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 57 | *------------------------------------------------------------------------------ |
| 58 | * removed! |
| 59 | * removed! |
| 60 | * removed! |
| 61 | * |
| 62 | * removed! |
| 63 | * removed! |
| 64 | * removed! |
| 65 | * |
| 66 | * removed! |
| 67 | * removed! |
| 68 | * removed! |
| 69 | * removed! |
| 70 | * |
| 71 | * removed! |
| 72 | * removed! |
| 73 | * |
| 74 | * removed! |
| 75 | * removed! |
| 76 | * removed! |
| 77 | * removed! |
| 78 | * |
| 79 | * removed! |
| 80 | * removed! |
| 81 | * removed! |
| 82 | * removed! |
| 83 | * |
| 84 | * |
| 85 | *------------------------------------------------------------------------------ |
| 86 | * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 87 | *============================================================================== |
| 88 | *******************************************************************************/ |
| 89 | #ifndef __DL2CMGR_H__ |
| 90 | #define __DL2CMGR_H__ |
| 91 | |
| 92 | /******************************************************************************* |
| 93 | * Included header files |
| 94 | *******************************************************************************/ |
| 95 | #include "custom_dl2cmgr.h" |
| 96 | |
| 97 | /******************************************************************************* |
| 98 | * definition |
| 99 | *******************************************************************************/ |
| 100 | /* section id enum structure will be created in custom_dl2cmgr.h */ |
| 101 | |
| 102 | /* make sure to define TOTAL_DL2CM_SECTION as valuse of DYNAMIC_CACHE_SECTION_NUM */ |
| 103 | #define TOTAL_DL2CM_SECTION (DYNAMIC_CACHE_SECTION_NUM) |
| 104 | #define DL2CM_MAX_NUM (32) |
| 105 | |
| 106 | #define DL2CMGR_DL_KB_SIZE_LIMITATION (1024) |
| 107 | #define DL2CMGR_DL_US_TIME_LIMITATION (200) |
| 108 | |
| 109 | #define DYNAMIC_CACHE_SECTION_NUM L2CACHE_LOCK_SECTION_NUM |
| 110 | |
| 111 | |
| 112 | /* define dl2cm function return status */ |
| 113 | typedef enum { |
| 114 | DL2CM_STATUS_SUCCESS, /* the operation is succeeded */ |
| 115 | DL2CM_STATUS_LOCK_BEFORE, /* the section has been locked before*/ |
| 116 | DL2CM_STATUS_LOCKING, /* the section is locking */ |
| 117 | DL2CM_STATUS_UNLOCKING, /* the section is unlocking */ |
| 118 | DL2CM_STATUS_UNLOCK_NOTHING, /* the section is unlocked */ |
| 119 | } dl2cm_status; |
| 120 | |
| 121 | /* define dl2cm section status */ |
| 122 | typedef enum { |
| 123 | DL2CM_SECTION_UNLOCKED = 0, /* the section is not locked */ |
| 124 | DL2CM_SECTION_LOCKED, /* the section is locked */ |
| 125 | DL2CM_SECTION_LOCKING, /* the section is locking */ |
| 126 | DL2CM_SECTION_UNLOCKING, /* the section is unlocking */ |
| 127 | } dl2cm_section_status; |
| 128 | |
| 129 | /* define dl2cm actions*/ |
| 130 | typedef enum { |
| 131 | DL2CM_ACTION_NON = 0, |
| 132 | DL2CM_ACTION_LOCK_ENTER_LOCK, |
| 133 | DL2CM_ACTION_LOCK_DO_NOTHING_RETURN, |
| 134 | DL2CM_ACTION_LOCK_ERROR_DURING_UNLOCKING_RETURN, |
| 135 | DL2CM_ACTION_LOCK_DURING_LOCKING_RETURN, |
| 136 | DL2CM_ACTION_LOCK_ERROR_SIZE_OVERUSE_RETURN, |
| 137 | DL2CM_ACTION_LOCK_ERROR_SPEED_OVERUSE_RETURN, |
| 138 | DL2CM_ACTION_LOCK_START_LOCKL2, |
| 139 | DL2CM_ACTION_LOCK_END_LOCKL2, |
| 140 | DL2CM_ACTION_UNLOCK_ENTER_UNLOCK = 20, |
| 141 | DL2CM_ACTION_UNLOCK_DO_NOTHING_RETURN, |
| 142 | DL2CM_ACTION_UNLOCK_ERROR_DURING_LOCKING_RETURN, |
| 143 | DL2CM_ACTION_UNLOCK_DURING_UNLOCKING_RETURN, |
| 144 | DL2CM_ACTION_UNLOCK_START_UNLOCKL2, |
| 145 | DL2CM_ACTION_UNLOCK_END_UNLOCKL2, |
| 146 | } dl2cm_action; |
| 147 | |
| 148 | typedef struct _dl1cm_action_record { |
| 149 | dl2cm_section_id dl2cm_section_id; |
| 150 | kal_uint32 dl2cm_section_size; |
| 151 | kal_uint32 dl2cm_current_tick; |
| 152 | dl2cm_action dl2cm_action; |
| 153 | kal_uint32 dl2cm_total_lock_size; |
| 154 | kal_uint32 dl2cm_exceed_and_current_lock_section; |
| 155 | } dl2cm_action_record, *l2dl2cm_action_record_ptr; |
| 156 | |
| 157 | typedef struct _dl2cm_locked_area { |
| 158 | kal_uint32 start; |
| 159 | kal_uint32 size; |
| 160 | } dl2cm_locked_area; |
| 161 | |
| 162 | |
| 163 | /******************************************************************************* |
| 164 | * External Function Declaration |
| 165 | *******************************************************************************/ |
| 166 | typedef void (*dl2cm_trace_f)(const l2dl2cm_action_record_ptr dl2cm_record_ptr); |
| 167 | dl2cm_status dl2cm_lock(dl2cm_section_id dl2cm_section_id, kal_uint32 block_size, kal_uint32 block_number, kal_uint32 *exceed_limitation); |
| 168 | dl2cm_status dl2cm_unlock(dl2cm_section_id dl2cm_current_lock_id); |
| 169 | dl2cm_section_status dl2cm_query_status(dl2cm_section_id dl2cm_section_id, kal_uint32 *section_size); |
| 170 | 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); |
| 171 | void dl2cm_register_trace_api(dl2cm_trace_f dl2cm_trace_cb); |
| 172 | void dl2cm_get_speed_limitation(kal_uint32 *dl_kb_size, kal_uint32 *dl_us_time); |
| 173 | dl2cm_locked_area *dl2cm_getLockedAreas(void); |
| 174 | #endif /*__DL2CMGR_H__*/ |