forked from haraldwolff/avr-fw-modules
31 lines
428 B
C
31 lines
428 B
C
|
#include <stdio.h>
|
||
|
#include <sys/atomic.h>
|
||
|
|
||
|
#ifndef __HWO_STDIO__
|
||
|
|
||
|
#undef fdevopen
|
||
|
|
||
|
FILE* fdevopen_ts (int(*put)(char, FILE *),int(*get )(FILE *))
|
||
|
{
|
||
|
ATOMIC
|
||
|
|
||
|
return fdevopen(put,get);
|
||
|
};
|
||
|
|
||
|
#else
|
||
|
|
||
|
FILE* fdevopen_ts (int(*put)(char, FILE *),int(*get )(FILE *))
|
||
|
{
|
||
|
ATOMIC
|
||
|
|
||
|
FILE *stream = malloc( sizeof( FILE ) );
|
||
|
if (stream) {
|
||
|
stream->put = put;
|
||
|
stream->get = get;
|
||
|
stream->udata = 0L;
|
||
|
};
|
||
|
return stream;
|
||
|
};
|
||
|
|
||
|
#endif
|