1 /* 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 * Description: osal adapt debug 15 * Create: 2023-5-17 16 */ 17 #ifdef OSAL_IRQ_RECORD_DEBUG 18 #ifndef __OSAL_ADAPT_DEBUG_H__ 19 #define __OSAL_ADAPT_DEBUG_H__ 20 21 #include "td_type.h" 22 #include "soc_osal.h" 23 24 #ifdef __cplusplus 25 #if __cplusplus 26 extern "C" { 27 #endif 28 #endif 29 30 #define RECORD_CNT_MAX 5 31 32 typedef enum { 33 IRQ_LOCK = 0, 34 IRQ_UNLOCK, 35 IRQ_RESTORE, 36 IRQ_TYPE_BUFF 37 } irq_type_enum; 38 39 typedef struct record { 40 td_u32 caller[IRQ_TYPE_BUFF][RECORD_CNT_MAX]; 41 td_u32 stauts[IRQ_TYPE_BUFF][RECORD_CNT_MAX]; 42 td_u32 idx[IRQ_TYPE_BUFF]; 43 } debug_irq_record; 44 45 debug_irq_record *osal_get_irq_record(void); 46 void osal_irq_record(irq_type_enum type, td_u32 caller, td_u32 stauts); 47 void osal_clear_irq_record(void); 48 void osal_print_irq_record(void); 49 50 #ifdef __cplusplus 51 #if __cplusplus 52 } 53 #endif 54 #endif 55 56 #endif 57 #endif /* #ifdef OSAL_IRQ_RECORD_DEBUG */