blob: ea12e5e9c8c7f6688657f6556d47fb46549b5f0f (
plain) (
blame)
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
|
/*
* COPYRIGHT (c) 2003-2012.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems.h>
#include "system.h"
#define RINGBUF_QUEUE_LENGTH 512
#include <rtems/ringbuf.h>
Ring_buffer_t Buffer;
void buffered_io_initialize( void )
{
Ring_buffer_Initialize( &Buffer );
}
void buffered_io_flush(void)
{
char ch;
while ( !Ring_buffer_Is_empty(&Buffer) ) {
Ring_buffer_Remove_character( &Buffer, ch );
fprintf( stderr, "%c", ch );
}
FLUSH_OUTPUT();
}
void buffered_io_add_string( char *s )
{
char *p = s;
while ( *p ) {
Ring_buffer_Add_character( &Buffer, *p++ );
}
}
|