Mercurial > flash_v2
comparison packages/hal/mn10300/stdeval1/current/src/hal_diag.c @ 2:443894e2e912 ecos-v1_2_1-release
Block commit of eCos version 1.2.1
| author | jlarmour |
|---|---|
| date | Tue, 11 May 1999 12:24:34 +0000 |
| parents | 3111d98ba7b3 |
| children | 641b639be825 |
comparison
equal
deleted
inserted
replaced
| 1:72f549f0d891 | 2:443894e2e912 |
|---|---|
| 1 /*============================================================================= | 1 /*============================================================================= |
| 2 // | 2 // |
| 3 // hal_diag.c | 3 // hal_diag.c |
| 4 // | 4 // |
| 5 // HAL diagnostic output code | 5 // HAL diagnostic output code |
| 6 // | 6 // |
| 7 //============================================================================= | 7 //============================================================================= |
| 8 //####COPYRIGHTBEGIN#### | 8 //####COPYRIGHTBEGIN#### |
| 9 // | 9 // |
| 10 // ------------------------------------------- | 10 // ------------------------------------------- |
| 20 // | 20 // |
| 21 // The Original Code is eCos - Embedded Cygnus Operating System, released | 21 // The Original Code is eCos - Embedded Cygnus Operating System, released |
| 22 // September 30, 1998. | 22 // September 30, 1998. |
| 23 // | 23 // |
| 24 // The Initial Developer of the Original Code is Cygnus. Portions created | 24 // The Initial Developer of the Original Code is Cygnus. Portions created |
| 25 // by Cygnus are Copyright (C) 1998 Cygnus Solutions. All Rights Reserved. | 25 // by Cygnus are Copyright (C) 1998,1999 Cygnus Solutions. All Rights Reserved. |
| 26 // ------------------------------------------- | 26 // ------------------------------------------- |
| 27 // | 27 // |
| 28 //####COPYRIGHTEND#### | 28 //####COPYRIGHTEND#### |
| 29 //============================================================================= | 29 //============================================================================= |
| 30 //#####DESCRIPTIONBEGIN#### | 30 //#####DESCRIPTIONBEGIN#### |
| 31 // | 31 // |
| 32 // Author(s): nickg | 32 // Author(s): nickg |
| 33 // Contributors: nickg | 33 // Contributors: nickg |
| 34 // Date: 1998-03-02 | 34 // Date: 1998-03-02 |
| 35 // Purpose: HAL diagnostic output | 35 // Purpose: HAL diagnostic output |
| 36 // Description: Implementations of HAL diagnostic output support. | 36 // Description: Implementations of HAL diagnostic output support. |
| 37 // | 37 // |
| 38 //####DESCRIPTIONEND#### | 38 //####DESCRIPTIONEND#### |
| 39 // | 39 // |
| 40 //===========================================================================*/ | 40 //===========================================================================*/ |
| 41 | 41 |
| 410 | 410 |
| 411 line[pos++] = c; | 411 line[pos++] = c; |
| 412 | 412 |
| 413 if( c == '\n' || pos == sizeof(line) ) | 413 if( c == '\n' || pos == sizeof(line) ) |
| 414 { | 414 { |
| 415 CYG_INTERRUPT_STATE old; | |
| 416 | |
| 417 // Disable interrupts. This prevents GDB trying to interrupt us | 415 // Disable interrupts. This prevents GDB trying to interrupt us |
| 418 // while we are in the middle of sending a packet. The serial | 416 // while we are in the middle of sending a packet. The serial |
| 419 // receive interrupt will be seen when we re-enable interrupts | 417 // receive interrupt will be seen when we re-enable interrupts |
| 420 // later. | 418 // later. |
| 421 | 419 |
| 422 HAL_DISABLE_INTERRUPTS(old); | 420 CYG_INTERRUPT_STATE oldstate; |
| 421 HAL_DISABLE_INTERRUPTS(oldstate); | |
| 423 | 422 |
| 424 while(1) | 423 while(1) |
| 425 { | 424 { |
| 426 static char hex[] = "0123456789ABCDEF"; | 425 static char hex[] = "0123456789ABCDEF"; |
| 427 cyg_uint8 csum = 0; | 426 cyg_uint8 csum = 0; |
| 450 | 449 |
| 451 hal_diag_read_char_serial( &c1 ); | 450 hal_diag_read_char_serial( &c1 ); |
| 452 | 451 |
| 453 // We must ack the interrupt caused by that read to avoid | 452 // We must ack the interrupt caused by that read to avoid |
| 454 // confusing the GDB stub ROM. | 453 // confusing the GDB stub ROM. |
| 455 HAL_INTERRUPT_ACKNOWLEDGE( CYG_VECTOR_EXTERNAL_2 ); | 454 HAL_INTERRUPT_ACKNOWLEDGE( CYGNUM_HAL_INTERRUPT_EXTERNAL_2 ); |
| 456 | 455 |
| 457 if( c1 == '+' ) break; | 456 if( c1 == '+' ) break; |
| 458 | 457 |
| 459 ai_writes("hal_diag_read_char_serial("); | 458 ai_writes("hal_diag_read_char_serial("); |
| 460 ai_write_char(c1); | 459 ai_write_char(c1); |
| 485 | 484 |
| 486 // Wait for tx buffer to drain | 485 // Wait for tx buffer to drain |
| 487 hal_diag_drain_serial(); | 486 hal_diag_drain_serial(); |
| 488 | 487 |
| 489 // And re-enable interrupts | 488 // And re-enable interrupts |
| 490 HAL_RESTORE_INTERRUPTS(old); | 489 HAL_RESTORE_INTERRUPTS(oldstate); |
| 491 | 490 |
| 492 } | 491 } |
| 493 | 492 |
| 494 #else | 493 #else |
| 495 hal_diag_write_char_serial(c); | 494 hal_diag_write_char_serial(c); |
