debug.c
1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#include "os_config.h"
#include "regmap.h"
#include "mem_reloc.h"
#include "c_def.h"
#include "debug.h"
//#include "oem.h"
#include "hw_gpio.h"
#include "app_gpio.h"
#include "flash_boot.h"
#if 1
void delay_loop(U32 count) __INTERNAL_RAM_TEXT;
void debug_assert (BOOL condition) __INTERNAL_RAM_TEXT;
#else
void delay_loop(U32 count);
void debug_assert (BOOL condition);
#endif
#if 1
void _Assert(BOOL condition) __LIBKERNAL_RAM_TEXT;
void _Assert(BOOL condition)
{
debug_assert(condition);
}
#endif
void debug_assert (BOOL condition)
{
#if 0
U8 continous = FALSE;
if (condition == FALSE)
{
//DBG_Printf ("DBG Assert Fail\n\r");
while (1)
{
if (continous == TRUE)
{
break;
}
}
}
#else
if (condition != TRUE)
{
#ifdef BOOT_FROM_FLASH
//asm("nop");
#else
asm("break 1,1");
asm("nop");
#endif
}
#endif
}
void debug_int(void)
{
}
void tools_debugAssert( U16 cond )
{
if (!cond)
{
//asm(".half 0xbebe");
asm("nop");
//asm("break 1,1");
}
}
void debug_pin_init(void)
{
app_gpio_output_level_set(DEBEG_PIN, GPIO_LOW);
app_gpio_MUXfunction_select(DEBEG_PIN, MUX_SEL_GPIO_OUTPUT);
app_gpio_output_level_set(DEBEG_PIN2, GPIO_LOW);
app_gpio_MUXfunction_select(DEBEG_PIN2, MUX_SEL_GPIO_OUTPUT);
app_gpio_output_level_set(DEBEG_PIN3, GPIO_LOW);
app_gpio_MUXfunction_select(DEBEG_PIN3, MUX_SEL_GPIO_OUTPUT);
#if 0
while (1)
{
debug_pin_test();
}
#endif
}
void debug_pin(void)
{
#if 1//ndef UART_RX_ENABLE
static U8 status = FALSE;
unsigned int interrupt_save;
if (status)
{
DBG_PIN_HIGH;
status = FALSE;
}
else
{
DBG_PIN_LOW;
status = TRUE;
}
#endif
}
void debug_pin_test(void)
{
#if 1//ndef UART0_RX_ENABLE
static U8 status = TRUE;
while (1)
{
if (status)
{
DBG_PIN_HIGH;
delayms(50);
DBG_PIN_HIGH2;
status = FALSE;
}
else
{
DBG_PIN_LOW;
DBG_PIN_LOW2;
status = TRUE;
}
delayms(500);
}
#endif
}
void delay_loop(U32 count)
{
while (count--)
{
asm("nop");
}
}