• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_assert.h"
16 #include "dbg.h"
17 //#include "ke_event.h"
18 //#include "hal_machw.h"
19 //#include "reg_sysctrl.h"
20 #include "arch.h"
21 
22 int dbg_assert_block = 1;
23 
24 #if 0
25 void dbg_assert_rec(const char *condition, const char * file, int line)
26 {
27     // Disable the interrupts
28     GLOBAL_INT_DISABLE();
29 
30     // Display a trace message showing the error
31     TRACE("ASSERT recovery: %F:%d", (line >> 24) , line);
32     line = (line & 0xffffff);
33     dbg(D_ERR "ASSERT (%s) at %s:%d\n", condition, file, line);
34 
35     // Restore the interrupts
36     GLOBAL_INT_RESTORE();
37 }
38 #endif
39 
dbg_assert_err(const char * condition,const char * file,int line)40 void dbg_assert_err(const char *condition, const char * file, int line)
41 {
42     TRACE("ASSERT error: %F:%d", (line >> 24) , line);
43     line = (line & 0xffffff);
44 
45     // Stop the interrupts
46     GLOBAL_INT_STOP();
47 
48     // Display a trace message showing the error
49     dbg(D_ERR "ASSERT (%s) at %s:%d\n", condition, file, line);
50 
51     while(dbg_assert_block);
52 }
53 
dbg_assert_warn(const char * condition,const char * file,int line)54 void dbg_assert_warn(const char *condition, const char * file, int line)
55 {
56     TRACE("ASSERT warning: %F:%d", (line >> 24) , line);
57     line = (line & 0xffffff);
58     dbg(D_ERR "WARNING (%s) at %s:%d\n", condition, file, line);
59 }
60 
61