1 /* 2 * Copyright (c) 2021 Chipsea Technologies (Shenzhen) Corp., Ltd. All rights reserved. 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 */ 15 #include "dbg.h" 16 #include <string.h> 17 18 #ifdef CFG_RTOS 19 #include "rtos_ohos_al.h" 20 #endif 21 22 /// Debug module environment definition. (moved here for host) 23 struct debug_env_tag dbg_env; 24 25 #if defined(CFG_RTOS) && DBG_MUTEX_ENABLED 26 extern rtos_mutex dbg_mutex; 27 #endif 28 29 dbg_init(void)30void dbg_init(void) 31 { 32 // Reset the environment 33 memset(&dbg_env, 0, sizeof(dbg_env)); 34 35 // Enable only warnings and more critical per default 36 dbg_env.filter_module = DBG_MOD_ALL; 37 dbg_env.filter_severity = DBG_SEV_IDX_ERR; 38 } 39 40 #if defined(CFG_RTOS) && DBG_MUTEX_ENABLED dbg_rtos_init(void)41void dbg_rtos_init(void) 42 { 43 if (rtos_mutex_create(&dbg_mutex)) { 44 dbg("create dbg_mutex err\n"); 45 } 46 } 47 #endif 48