Semihosted file handles for targets without DEVICE_SEMIHOST or DEVICE_LOCALFILESYSTEM

Dependents:   SemihostingTest

Committer:
devanlai
Date:
Wed Oct 11 23:14:14 2017 +0000
Revision:
0:d5e731da01f0
Initial Semihosting file I/O shim for devices without DEVICE_SEMIHOST and DEVICE_LOCALFILESYSTEM

Who changed what in which revision?

UserRevisionLine numberNew contents of line
devanlai 0:d5e731da01f0 1
devanlai 0:d5e731da01f0 2 /** \addtogroup platform */
devanlai 0:d5e731da01f0 3 /** @{*/
devanlai 0:d5e731da01f0 4 /* mbed Microcontroller Library
devanlai 0:d5e731da01f0 5 * Copyright (c) 2006-2013 ARM Limited
devanlai 0:d5e731da01f0 6 *
devanlai 0:d5e731da01f0 7 * Licensed under the Apache License, Version 2.0 (the "License");
devanlai 0:d5e731da01f0 8 * you may not use this file except in compliance with the License.
devanlai 0:d5e731da01f0 9 * You may obtain a copy of the License at
devanlai 0:d5e731da01f0 10 *
devanlai 0:d5e731da01f0 11 * http://www.apache.org/licenses/LICENSE-2.0
devanlai 0:d5e731da01f0 12 *
devanlai 0:d5e731da01f0 13 * Unless required by applicable law or agreed to in writing, software
devanlai 0:d5e731da01f0 14 * distributed under the License is distributed on an "AS IS" BASIS,
devanlai 0:d5e731da01f0 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
devanlai 0:d5e731da01f0 16 * See the License for the specific language governing permissions and
devanlai 0:d5e731da01f0 17 * limitations under the License.
devanlai 0:d5e731da01f0 18 */
devanlai 0:d5e731da01f0 19 #ifndef MBED_SEMIHOST_SHIM_H
devanlai 0:d5e731da01f0 20 #define MBED_SEMIHOST_SHIM_H
devanlai 0:d5e731da01f0 21
devanlai 0:d5e731da01f0 22 #include "device.h"
devanlai 0:d5e731da01f0 23 #include "platform/mbed_toolchain.h"
devanlai 0:d5e731da01f0 24
devanlai 0:d5e731da01f0 25 #include "platform/mbed_semihost_api.h"
devanlai 0:d5e731da01f0 26
devanlai 0:d5e731da01f0 27 #ifdef __cplusplus
devanlai 0:d5e731da01f0 28 extern "C" {
devanlai 0:d5e731da01f0 29 #endif
devanlai 0:d5e731da01f0 30
devanlai 0:d5e731da01f0 31 #if !DEVICE_LOCALFILESYSTEM
devanlai 0:d5e731da01f0 32 FILEHANDLE semihost_open(const char* name, int openmode);
devanlai 0:d5e731da01f0 33 int semihost_close (FILEHANDLE fh);
devanlai 0:d5e731da01f0 34 int semihost_read (FILEHANDLE fh, unsigned char* buffer, unsigned int length, int mode);
devanlai 0:d5e731da01f0 35 int semihost_write (FILEHANDLE fh, const unsigned char* buffer, unsigned int length, int mode);
devanlai 0:d5e731da01f0 36 int semihost_ensure(FILEHANDLE fh);
devanlai 0:d5e731da01f0 37 long semihost_flen (FILEHANDLE fh);
devanlai 0:d5e731da01f0 38 int semihost_seek (FILEHANDLE fh, long position);
devanlai 0:d5e731da01f0 39 int semihost_istty (FILEHANDLE fh);
devanlai 0:d5e731da01f0 40
devanlai 0:d5e731da01f0 41 int semihost_remove(const char *name);
devanlai 0:d5e731da01f0 42 int semihost_rename(const char *old_name, const char *new_name);
devanlai 0:d5e731da01f0 43 #endif
devanlai 0:d5e731da01f0 44
devanlai 0:d5e731da01f0 45 #ifdef __cplusplus
devanlai 0:d5e731da01f0 46 }
devanlai 0:d5e731da01f0 47 #endif
devanlai 0:d5e731da01f0 48
devanlai 0:d5e731da01f0 49 #endif
devanlai 0:d5e731da01f0 50
devanlai 0:d5e731da01f0 51 /** @}*/