ads1115 only
Fork of mbed by
Diff: SemihostFileHandle.h
- Revision:
- 4:5d1359a283bc
- Parent:
- 3:aefd12a1f1c5
- Child:
- 5:62573be585e9
--- a/SemihostFileHandle.h Fri Nov 14 15:25:20 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* mbed Microcontroller Library - SemihostFileHandle - * Copyright (c) 2007-2008, sford - */ - -#ifndef MBED_SEMIHOSTFILEHANDLE_H -#define MBED_SEMIHOSTFILEHANDLE_H - -#include "rt_sys.h" -#include "FileHandle.h" - -extern "C" int $Super$$_sys_close(FILEHANDLE fh); -extern "C" int $Super$$_sys_write(FILEHANDLE fh, const unsigned char* buffer, unsigned int length, int mode); -extern "C" int $Super$$_sys_read(FILEHANDLE fh, unsigned char* buffer, unsigned int length, int mode); -extern "C" int $Super$$_sys_istty(FILEHANDLE fh); -extern "C" int $Super$$_sys_seek(FILEHANDLE fh, int position); -extern "C" int $Super$$_sys_ensure(FILEHANDLE fh); -extern "C" long $Super$$_sys_flen(FILEHANDLE fh); - -namespace mbed { - -/* Class SemihostFileHandle - * Implements a FileHandle for talking to the standard Semihosting implementation - */ -class SemihostFileHandle : public FileHandle { - -public: - - /* Constructor SemihostFileHandle - * Create a SemihostFileHandle using a standard FILEHANDLE - */ - SemihostFileHandle(FILEHANDLE fh) { - _fh = fh; - } - - virtual int sys_close() { - return $Super$$_sys_close(_fh); - } - // virtual ~SemihostFileHandle() { - // $Super$$_sys_close(_fh); - //} - - virtual int sys_write(const unsigned char* buffer, unsigned int length, int mode) { - return $Super$$_sys_write(_fh, buffer, length, mode); - } - - virtual int sys_read(unsigned char* buffer, unsigned int length, int mode) { - return $Super$$_sys_read(_fh, buffer, length, mode); - } - - virtual int sys_istty() { - return $Super$$_sys_istty(_fh); - } - - virtual int sys_seek(int position) { - return $Super$$_sys_seek(_fh, position); - } - - virtual int sys_ensure() { - return $Super$$_sys_ensure(_fh); - } - - virtual int sys_flen() { - return $Super$$_sys_flen(_fh); - } - -protected: - - FILEHANDLE _fh; - -}; - -} // namespace mbed - -#endif -