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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
|
//==========================================================================
//
// buffer.cxx
//
// Memory buffered trace and assert functions
//
//==========================================================================
// ####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later
// version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License
// along with eCos; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// As a special exception, if other files instantiate templates or use
// macros or inline functions from this file, or you compile this file
// and link it with other works to produce a work based on this file,
// this file does not by itself cause the resulting work to be covered by
// the GNU General Public License. However the source code for this file
// must still be made available in accordance with section (3) of the GNU
// General Public License v2.
//
// This exception does not invalidate any other reasons why a work based
// on this file might be covered by the GNU General Public License.
// -------------------------------------------
// ####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): nickg
// Contributors: nickg
// Date: 1998-10-16
// Purpose: Buffered Trace and assert functions
// Description: The functions in this file are a buffered implementation
// of the standard trace and assert functions. These store
// trace messages in a memory buffer and emit them when an
// assert is hit, or when requested to.
//
//####DESCRIPTIONEND####
//
//==========================================================================
#include <pkgconf/system.h>
#include <pkgconf/infra.h>
#ifdef CYGDBG_INFRA_DEBUG_TRACE_ASSERT_BUFFER
#include <cyg/infra/cyg_type.h> // base types
#include <cyg/infra/cyg_trac.h> // tracing macros
#include <cyg/infra/cyg_ass.h> // assertion macros
#include <pkgconf/hal.h> // HAL configury
#include <cyg/infra/diag.h> // HAL polled output
#include <cyg/hal/hal_arch.h> // architectural stuff for...
#include <cyg/hal/hal_intr.h> // interrupt control
#ifdef CYGPKG_KERNEL
#include <pkgconf/kernel.h> // kernel configury
#include <cyg/kernel/thread.hxx> // thread id to print
#include <cyg/kernel/sched.hxx> // ancillaries for above
#include <cyg/kernel/thread.inl> // ancillaries for above
#endif
// -------------------------------------------------------------------------
// Local Configuration: hack me!
// these are generally:
// if 0, feature is disabled
// if 1, feature is enabled, printing is default width
// if >1, field is padded up to that width if necessary
// (not truncated ever)
#define CYG_FILENAME 20
#define CYG_THREADID 1
#define CYG_LINENUM 4
#define CYG_FUNCNAME 100
#define CYG_DIAG_PRINTF 1
#define CYG_FUNC_INDENT 2
#ifndef CYGPKG_KERNEL
# undef CYG_THREADID
# define CYG_THREADID 0
#endif
#if CYG_FUNCNAME == 1
#define CYG_FBUF_SIZE 100
#else
#define CYG_FBUF_SIZE (CYG_FUNCNAME+20)
#endif
// -------------------------------------------------------------------------
// Trace buffer
#ifdef CYGDBG_USE_TRACING
struct Cyg_TraceRecord
{
cyg_uint32 what;
cyg_uint32 tid;
const char *function;
const char *file;
const char *message;
cyg_uint32 line;
cyg_uint32 narg;
CYG_ADDRWORD arg[8];
};
Cyg_TraceRecord cyg_infra_trace_buffer[CYGDBG_INFRA_DEBUG_TRACE_BUFFER_SIZE];
static cyg_uint32 cyg_infra_trace_buffer_pos = 0;
static cyg_bool cyg_infra_trace_buffer_enable = true;
static cyg_bool cyg_infra_trace_buffer_wrap = false;
// -------------------------------------------------------------------------
// Functions to trim file names and function names down to printable lengths
// (these are shared between trace and assert functions)
#if 0
static char * tracepremsgs[] = {
" INFO:",
"ENTER :",
"ARGS :",
"RETURN:",
"bad code"
};
#endif
static char * tracepremsgs[] = {
"'",
"{{",
"((",
"}}",
"bad code"
};
static char * tracepostmsgs[] = {
"'",
"",
"))",
"",
"bad code"
};
static void
write_whattrace( cyg_uint32 what )
{
#if CYG_FUNC_INDENT
static cyg_int32 cyg_indent = 0;
if ( 3 == what )
cyg_indent -= CYG_FUNC_INDENT;
cyg_int32 i = cyg_indent;
for ( ; i > 0; i-- )
diag_write_string( " " );
#endif // CYG_FUNC_INDENT
diag_write_string( tracepremsgs[ what > 4 ? 4 : what ] );
#if CYG_FUNC_INDENT
if ( 1 == what )
cyg_indent += CYG_FUNC_INDENT;
#endif // CYG_FUNC_INDENT
}
static void
write_whattracepost( cyg_uint32 what )
{
diag_write_string( tracepostmsgs[ what > 4 ? 4 : what ] );
}
#endif // CYGDBG_USE_TRACING
// -------------------------------------------------------------------------
#if defined(CYGDBG_USE_TRACING) || defined(CYGDBG_USE_ASSERTS)
static const char *trim_file(const char *file)
{
#if CYG_FILENAME
if ( NULL == file )
file = "<nofile>";
#if 1 == CYG_FILENAME
const char *f = file;
while( *f ) f++;
while( *f != '/' && f != file ) f--;
return f==file?f:(f+1);
#else
static char fbuf2[100];
const char *f = file;
char *g = fbuf2;
while( *f ) f++;
while( *f != '/' && f != file ) f--;
if ( f > file ) f++;
while( *f ) *g++ = *f++;
while( CYG_FILENAME > (g - fbuf2) ) *g++ = ' ';
*g = 0;
return fbuf2;
#endif
#else
return "";
#endif
}
static const char *trim_func(const char *func)
{
#if CYG_FUNCNAME
static char fbuf[CYG_FBUF_SIZE];
cyg_count32 i;
if ( NULL == func )
func = "<nofunc>";
for( i = 0; func[i] && func[i] != '(' && i < CYG_FBUF_SIZE-4 ; i++ )
fbuf[i] = func[i];
fbuf[i++] = '(';
fbuf[i++] = ')';
fbuf[i ] = 0;
i=0;
#if 1 == CYG_FUNCNAME
return &fbuf[i];
#else
char *p = &fbuf[i];
while ( *p ) p++;
while ( CYG_FUNCNAME > (p - (&fbuf[i])) ) *p++ = ' ';
*p = 0;
return &fbuf[i];
#endif
#else
return "";
#endif
}
static void write_lnum( cyg_uint32 lnum)
{
#if CYG_LINENUM
diag_write_char('[');
#if 1 < CYG_LINENUM
cyg_uint32 i, j;
for ( i = 2, j = 100; i < CYG_LINENUM ; i++, j *= 10 )
if ( lnum < j )
diag_write_char(' ');
#endif
diag_write_dec(lnum);
diag_write_char(']');
diag_write_char(' ');
#endif
}
#endif // defined(CYGDBG_USE_TRACING) || defined(CYGDBG_USE_ASSERTS)
// -------------------------------------------------------------------------
#if defined(CYGDBG_USE_TRACING) || defined(CYGDBG_USE_ASSERTS)
#if CYG_THREADID
static cyg_uint32 get_tid(void)
{
Cyg_Thread *t = Cyg_Thread::self();
cyg_uint16 tid = 0xFFFF;
if( t != NULL ) tid = t->get_unique_id();
return tid;
}
#else
# define get_tid() (0xFFFF)
#endif
#endif // defined(CYGDBG_USE_TRACING) || defined(CYGDBG_USE_ASSERTS)
#ifdef CYGDBG_USE_ASSERTS
static void write_thread_id()
{
#if CYG_THREADID
cyg_uint16 tid = get_tid();
diag_write_char('<');
diag_write_hex(tid);
diag_write_char('>');
#endif
}
#endif
// -------------------------------------------------------------------------
// Trace functions:
#ifdef CYGDBG_USE_TRACING
static void print_trace_buffer(void)
{
cyg_count32 start = cyg_infra_trace_buffer_pos;
cyg_count32 end = start;
cyg_count32 i;
// If the buffer has wrapped we want to display the records from
// the current pos and around back to the same place. If the buffer
// has not wrapped, we want to display from the start to pos.
if( !cyg_infra_trace_buffer_wrap )
start = 0;
i = start;
do
{
Cyg_TraceRecord *rec = &cyg_infra_trace_buffer[i];
cyg_uint32 old_ints;
const char *psz_msg = rec->message;
HAL_DISABLE_INTERRUPTS(old_ints);
DIAG_DEVICE_START_SYNC();
if ( NULL == psz_msg )
psz_msg = "<nomsg>";
diag_write_string( "TRACE: " );
#if CYG_THREADID
diag_write_char('<');
diag_write_hex(rec->tid);
diag_write_char('>');
#endif
diag_write_string(trim_file(rec->file));
write_lnum(rec->line);
diag_write_string(trim_func(rec->function));
diag_write_char(' ');
write_whattrace( rec->what );
#if CYG_DIAG_PRINTF
diag_printf( psz_msg,
rec->arg[0], rec->arg[1],
rec->arg[2], rec->arg[3],
rec->arg[4], rec->arg[5],
rec->arg[6], rec->arg[7] );
#else
diag_write_string(psz_msg);
diag_write_char(' ');
for( cyg_count8 j = 0; j < rec->narg ; j++ )
{
diag_write_hex(rec->arg[j]);
diag_write_char(' ');
}
#endif
write_whattracepost( rec->what );
diag_write_char('\n');
DIAG_DEVICE_END_SYNC();
HAL_RESTORE_INTERRUPTS(old_ints);
i++;
if( i == CYGDBG_INFRA_DEBUG_TRACE_BUFFER_SIZE )
i = 0;
} while( i != end );
}
static void increment_buffer_pos()
{
cyg_infra_trace_buffer_pos++;
if( cyg_infra_trace_buffer_pos == CYGDBG_INFRA_DEBUG_TRACE_BUFFER_SIZE )
{
#if defined(CYGDBG_INFRA_DEBUG_TRACE_BUFFER_WRAP)
cyg_infra_trace_buffer_pos = 0;
cyg_infra_trace_buffer_wrap = true;
#elif defined(CYGDBG_INFRA_DEBUG_TRACE_BUFFER_HALT)
cyg_infra_trace_buffer_enable = false;
#elif defined(CYGDBG_INFRA_DEBUG_TRACE_BUFFER_PRINT)
cyg_infra_trace_buffer_pos = 0;
print_trace_buffer();
#else
#error No trace buffer full mode set
#endif
}
}
// -------------------------------------------------------------------------
externC void
cyg_tracenomsg( const char *psz_func, const char *psz_file, cyg_uint32 linenum )
{
cyg_uint32 old_ints;
if( !cyg_infra_trace_buffer_enable ) return;
HAL_DISABLE_INTERRUPTS(old_ints);
Cyg_TraceRecord *rec = &cyg_infra_trace_buffer[cyg_infra_trace_buffer_pos];
rec->what = 0;
rec->tid = get_tid();
rec->function = psz_func;
rec->file = psz_file;
rec->line = linenum;
rec->message = 0;
rec->narg = 0;
increment_buffer_pos();
HAL_RESTORE_INTERRUPTS(old_ints);
};
// provide every other one of these as a space/caller bloat compromise.
externC void
cyg_tracemsg( cyg_uint32 what,
const char *psz_func, const char *psz_file, cyg_uint32 linenum,
const char *psz_msg )
{
cyg_uint32 old_ints;
if( !cyg_infra_trace_buffer_enable ) return;
HAL_DISABLE_INTERRUPTS(old_ints);
Cyg_TraceRecord *rec = &cyg_infra_trace_buffer[cyg_infra_trace_buffer_pos];
rec->what = what;
rec->tid = get_tid();
rec->function = psz_func;
rec->file = psz_file;
rec->line = linenum;
rec->message = psz_msg;
rec->narg = 0;
increment_buffer_pos();
HAL_RESTORE_INTERRUPTS(old_ints);
};
externC void
cyg_tracemsg2( cyg_uint32 what,
const char *psz_func, const char *psz_file, cyg_uint32 linenum,
const char *psz_msg,
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1 )
{
cyg_uint32 old_ints;
if( !cyg_infra_trace_buffer_enable ) return;
HAL_DISABLE_INTERRUPTS(old_ints);
Cyg_TraceRecord *rec = &cyg_infra_trace_buffer[cyg_infra_trace_buffer_pos];
rec->what = what;
rec->tid = get_tid();
rec->function = psz_func;
rec->file = psz_file;
rec->line = linenum;
rec->message = psz_msg;
rec->narg = 2;
rec->arg[0] = arg0;
rec->arg[1] = arg1;
increment_buffer_pos();
HAL_RESTORE_INTERRUPTS(old_ints);
};
externC void
cyg_tracemsg4( cyg_uint32 what,
const char *psz_func, const char *psz_file, cyg_uint32 linenum,
const char *psz_msg,
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1,
CYG_ADDRWORD arg2, CYG_ADDRWORD arg3 )
{
cyg_uint32 old_ints;
if( !cyg_infra_trace_buffer_enable ) return;
HAL_DISABLE_INTERRUPTS(old_ints);
Cyg_TraceRecord *rec = &cyg_infra_trace_buffer[cyg_infra_trace_buffer_pos];
rec->what = what;
rec->tid = get_tid();
rec->function = psz_func;
rec->file = psz_file;
rec->line = linenum;
rec->message = psz_msg;
rec->narg = 4;
rec->arg[0] = arg0;
rec->arg[1] = arg1;
rec->arg[2] = arg2;
rec->arg[3] = arg3;
increment_buffer_pos();
HAL_RESTORE_INTERRUPTS(old_ints);
};
externC void
cyg_tracemsg6( cyg_uint32 what,
const char *psz_func, const char *psz_file, cyg_uint32 linenum,
const char *psz_msg,
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1,
CYG_ADDRWORD arg2, CYG_ADDRWORD arg3,
CYG_ADDRWORD arg4, CYG_ADDRWORD arg5 )
{
cyg_uint32 old_ints;
if( !cyg_infra_trace_buffer_enable ) return;
HAL_DISABLE_INTERRUPTS(old_ints);
Cyg_TraceRecord *rec = &cyg_infra_trace_buffer[cyg_infra_trace_buffer_pos];
rec->what = what;
rec->tid = get_tid();
rec->function = psz_func;
rec->file = psz_file;
rec->line = linenum;
rec->message = psz_msg;
rec->narg = 6;
rec->arg[0] = arg0;
rec->arg[1] = arg1;
rec->arg[2] = arg2;
rec->arg[3] = arg3;
rec->arg[4] = arg4;
rec->arg[5] = arg5;
increment_buffer_pos();
HAL_RESTORE_INTERRUPTS(old_ints);
};
externC void
cyg_tracemsg8( cyg_uint32 what,
const char *psz_func, const char *psz_file, cyg_uint32 linenum,
const char *psz_msg,
CYG_ADDRWORD arg0, CYG_ADDRWORD arg1,
CYG_ADDRWORD arg2, CYG_ADDRWORD arg3,
CYG_ADDRWORD arg4, CYG_ADDRWORD arg5,
CYG_ADDRWORD arg6, CYG_ADDRWORD arg7 )
{
cyg_uint32 old_ints;
if( !cyg_infra_trace_buffer_enable ) return;
HAL_DISABLE_INTERRUPTS(old_ints);
Cyg_TraceRecord *rec = &cyg_infra_trace_buffer[cyg_infra_trace_buffer_pos];
rec->what = what;
rec->tid = get_tid();
rec->function = psz_func;
rec->file = psz_file;
rec->line = linenum;
rec->message = psz_msg;
rec->narg = 6;
rec->arg[0] = arg0;
rec->arg[1] = arg1;
rec->arg[2] = arg2;
rec->arg[3] = arg3;
rec->arg[4] = arg4;
rec->arg[5] = arg5;
rec->arg[6] = arg6;
rec->arg[7] = arg7;
increment_buffer_pos();
HAL_RESTORE_INTERRUPTS(old_ints);
};
// -------------------------------------------------------------------------
externC void
cyg_trace_print(void)
{
cyg_bool old_enable = cyg_infra_trace_buffer_enable;
cyg_infra_trace_buffer_enable = false;
print_trace_buffer();
cyg_infra_trace_buffer_pos = 0;
cyg_infra_trace_buffer_wrap = false;
cyg_infra_trace_buffer_enable = old_enable;
}
// -------------------------------------------------------------------------
externC void
cyg_trace_dump(void)
{
#if defined(CYGPKG_KERNEL) && defined(CYG_DIAG_PRINTF)
{
diag_printf("\nScheduler:\n\n");
Cyg_Scheduler *sched = &Cyg_Scheduler::scheduler;
diag_printf("Lock: %d\n",sched->get_sched_lock() );
# ifdef CYGVAR_KERNEL_THREADS_NAME
diag_printf("Current Thread: %s\n",sched->get_current_thread()->get_name());
# else
diag_printf("Current Thread: %d\n",sched->get_current_thread()->get_unique_id());
# endif
}
# ifdef CYGVAR_KERNEL_THREADS_LIST
{
Cyg_Thread *t = Cyg_Thread::get_list_head();
diag_printf("\nThreads:\n\n");
while( NULL != t )
{
cyg_uint32 state = t->get_state();
char tstate[7];
char *tstate1 = "SCUKX";
static char *(reasons[8]) =
{
"NONE", // No recorded reason
"WAIT", // Wait with no timeout
"DELAY", // Simple time delay
"TIMEOUT", // Wait with timeout/timeout expired
"BREAK", // forced break out of sleep
"DESTRUCT", // wait object destroyed[note]
"EXIT", // forced termination
"DONE" // Wait/delay complete
};
if( 0 != state )
{
// Knock out chars that do not correspond to set bits.
for( int i = 0; i < 6 ; i++ )
if( 0 == (state & (1<<i)) )
tstate[i] = ' ';
else tstate[i] = tstate1[i];
tstate[6] = 0;
}
else tstate[0] = 'R', tstate[1] = 0;
# ifdef CYGVAR_KERNEL_THREADS_NAME
diag_printf( "%20s pri = %3d state = %6s id = %3d\n",
t->get_name(),
t->get_priority(),
tstate,
t->get_unique_id()
);
# else
diag_printf( "Thread %3d pri = %3d state = %6s\n",
t->get_unique_id(),
t->get_priority(),
tstate
);
# endif
diag_printf( "%20s stack base = %08x ptr = %08x size = %08x\n",
"",
t->get_stack_base(),
#ifdef CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT
(int) t->get_saved_context(),
#else
0,
#endif
t->get_stack_size()
);
diag_printf( "%20s sleep reason %8s wake reason %8s\n",
"",
reasons[t->get_sleep_reason()],
reasons[t->get_wake_reason()]
);
diag_printf( "%20s queue = %08x wait info = %08x\n",
"",
(int) t->get_current_queue(),
t->get_wait_info()
);
diag_printf("\n");
t = t->get_list_next();
}
}
# endif // CYGVAR_KERNEL_THREADS_LIST
#endif // CYG_DIAG_PRINTF
}
#endif // CYGDBG_USE_TRACING
// -------------------------------------------------------------------------
// Assert functions:
#ifdef CYGDBG_USE_ASSERTS
externC void
cyg_assert_fail( const char *psz_func, const char *psz_file,
cyg_uint32 linenum, const char *psz_msg ) __THROW
{
cyg_uint32 old_ints;
HAL_DISABLE_INTERRUPTS(old_ints);
DIAG_DEVICE_START_SYNC();
diag_write_string("ASSERT FAIL: ");
write_thread_id();
diag_write_string(trim_file(psz_file));
write_lnum(linenum);
diag_write_string(trim_func(psz_func));
diag_write_char(' ');
diag_write_string(psz_msg);
diag_write_char('\n');
#ifdef CYGDBG_INFRA_DEBUG_TRACE_BUFFER_PRINT_ON_ASSERT
cyg_trace_print();
cyg_trace_dump();
#endif
#ifdef CYGHWR_TEST_PROGRAM_EXIT
CYGHWR_TEST_PROGRAM_EXIT();
#endif
for(;;);
// DIAG_DEVICE_END_SYNC();
// HAL_RESTORE_INTERRUPTS(old_ints);
};
extern "C"
{
extern unsigned long _stext;
extern unsigned long _etext;
unsigned long stext_addr = (unsigned long)&_stext;
unsigned long etext_addr = (unsigned long)&_etext;
};
externC cyg_bool cyg_check_data_ptr(const void *ptr)
{
unsigned long p = (unsigned long)ptr;
if( p == 0 ) return false;
if( p > stext_addr && p < etext_addr ) return false;
return true;
}
externC cyg_bool cyg_check_func_ptr(void (*ptr)(void))
{
unsigned long p = (unsigned long)ptr;
if( p == 0 ) return false;
if( p < stext_addr && p > etext_addr ) return false;
return true;
}
#endif // CYGDBG_USE_ASSERTS
#endif // CYGDBG_INFRA_DEBUG_TRACE_ASSERT_BUFFER
// -------------------------------------------------------------------------
// EOF buffer.cxx
|