mbed library sources. Supersedes mbed-src. Fixed broken STM32F1xx RTC on rtc_api.c

Dependents:   Nucleo_F103RB_RTC_battery_bkup_pwr_off_okay

Fork of mbed-dev by mbed official

Committer:
AnnaBridge
Date:
Wed Jun 21 17:46:44 2017 +0100
Revision:
167:e84263d55307
Child:
168:9672193075cf
This updates the lib to the mbed lib v 145

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 167:e84263d55307 1 /* mbed Microcontroller Library
AnnaBridge 167:e84263d55307 2 * Copyright (c) 2006-2013 ARM Limited
AnnaBridge 167:e84263d55307 3 *
AnnaBridge 167:e84263d55307 4 * Licensed under the Apache License, Version 2.0 (the "License");
AnnaBridge 167:e84263d55307 5 * you may not use this file except in compliance with the License.
AnnaBridge 167:e84263d55307 6 * You may obtain a copy of the License at
AnnaBridge 167:e84263d55307 7 *
AnnaBridge 167:e84263d55307 8 * http://www.apache.org/licenses/LICENSE-2.0
AnnaBridge 167:e84263d55307 9 *
AnnaBridge 167:e84263d55307 10 * Unless required by applicable law or agreed to in writing, software
AnnaBridge 167:e84263d55307 11 * distributed under the License is distributed on an "AS IS" BASIS,
AnnaBridge 167:e84263d55307 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
AnnaBridge 167:e84263d55307 13 * See the License for the specific language governing permissions and
AnnaBridge 167:e84263d55307 14 * limitations under the License.
AnnaBridge 167:e84263d55307 15 */
AnnaBridge 167:e84263d55307 16 #ifndef MBED_STREAM_H
AnnaBridge 167:e84263d55307 17 #define MBED_STREAM_H
AnnaBridge 167:e84263d55307 18
AnnaBridge 167:e84263d55307 19 #include "platform/platform.h"
AnnaBridge 167:e84263d55307 20 #include "platform/FileLike.h"
AnnaBridge 167:e84263d55307 21 #include "platform/FileHandle.h"
AnnaBridge 167:e84263d55307 22 #include <cstdio>
AnnaBridge 167:e84263d55307 23 #include <cstdarg>
AnnaBridge 167:e84263d55307 24
AnnaBridge 167:e84263d55307 25 namespace mbed {
AnnaBridge 167:e84263d55307 26 /** \addtogroup platform */
AnnaBridge 167:e84263d55307 27 /** @{*/
AnnaBridge 167:e84263d55307 28
AnnaBridge 167:e84263d55307 29 extern void mbed_set_unbuffered_stream(std::FILE *_file);
AnnaBridge 167:e84263d55307 30 extern int mbed_getc(std::FILE *_file);
AnnaBridge 167:e84263d55307 31 extern char* mbed_gets(char *s, int size, std::FILE *_file);
AnnaBridge 167:e84263d55307 32 /** @}*/
AnnaBridge 167:e84263d55307 33
AnnaBridge 167:e84263d55307 34 /** File stream
AnnaBridge 167:e84263d55307 35 *
AnnaBridge 167:e84263d55307 36 * @note Synchronization level: Set by subclass
AnnaBridge 167:e84263d55307 37 * @ingroup platform
AnnaBridge 167:e84263d55307 38 */
AnnaBridge 167:e84263d55307 39 class Stream : public FileLike {
AnnaBridge 167:e84263d55307 40
AnnaBridge 167:e84263d55307 41 public:
AnnaBridge 167:e84263d55307 42 Stream(const char *name=NULL);
AnnaBridge 167:e84263d55307 43 virtual ~Stream();
AnnaBridge 167:e84263d55307 44
AnnaBridge 167:e84263d55307 45 int putc(int c);
AnnaBridge 167:e84263d55307 46 int puts(const char *s);
AnnaBridge 167:e84263d55307 47 int getc();
AnnaBridge 167:e84263d55307 48 char *gets(char *s, int size);
AnnaBridge 167:e84263d55307 49 int printf(const char* format, ...);
AnnaBridge 167:e84263d55307 50 int scanf(const char* format, ...);
AnnaBridge 167:e84263d55307 51 int vprintf(const char* format, std::va_list args);
AnnaBridge 167:e84263d55307 52 int vscanf(const char* format, std::va_list args);
AnnaBridge 167:e84263d55307 53
AnnaBridge 167:e84263d55307 54 operator std::FILE*() {return _file;}
AnnaBridge 167:e84263d55307 55
AnnaBridge 167:e84263d55307 56 protected:
AnnaBridge 167:e84263d55307 57 virtual int close();
AnnaBridge 167:e84263d55307 58 virtual ssize_t write(const void* buffer, size_t length);
AnnaBridge 167:e84263d55307 59 virtual ssize_t read(void* buffer, size_t length);
AnnaBridge 167:e84263d55307 60 virtual off_t seek(off_t offset, int whence);
AnnaBridge 167:e84263d55307 61 virtual off_t tell();
AnnaBridge 167:e84263d55307 62 virtual void rewind();
AnnaBridge 167:e84263d55307 63 virtual int isatty();
AnnaBridge 167:e84263d55307 64 virtual int sync();
AnnaBridge 167:e84263d55307 65 virtual off_t size();
AnnaBridge 167:e84263d55307 66
AnnaBridge 167:e84263d55307 67 virtual int _putc(int c) = 0;
AnnaBridge 167:e84263d55307 68 virtual int _getc() = 0;
AnnaBridge 167:e84263d55307 69
AnnaBridge 167:e84263d55307 70 std::FILE *_file;
AnnaBridge 167:e84263d55307 71
AnnaBridge 167:e84263d55307 72 /** Acquire exclusive access to this object.
AnnaBridge 167:e84263d55307 73 */
AnnaBridge 167:e84263d55307 74 virtual void lock() {
AnnaBridge 167:e84263d55307 75 // Stub
AnnaBridge 167:e84263d55307 76 }
AnnaBridge 167:e84263d55307 77
AnnaBridge 167:e84263d55307 78 /** Release exclusive access to this object.
AnnaBridge 167:e84263d55307 79 */
AnnaBridge 167:e84263d55307 80 virtual void unlock() {
AnnaBridge 167:e84263d55307 81 // Stub
AnnaBridge 167:e84263d55307 82 }
AnnaBridge 167:e84263d55307 83
AnnaBridge 167:e84263d55307 84 /* disallow copy constructor and assignment operators */
AnnaBridge 167:e84263d55307 85 private:
AnnaBridge 167:e84263d55307 86 Stream(const Stream&);
AnnaBridge 167:e84263d55307 87 Stream & operator = (const Stream&);
AnnaBridge 167:e84263d55307 88 };
AnnaBridge 167:e84263d55307 89
AnnaBridge 167:e84263d55307 90 } // namespace mbed
AnnaBridge 167:e84263d55307 91
AnnaBridge 167:e84263d55307 92 #endif
AnnaBridge 167:e84263d55307 93