This repo contains the libraries of Mbed for LPC1549 with following changes: - IAP commands. - EEPROM write and read. - UART write and read (public) - CAN can_s -> LPC_C_CAN0_Type *can

Committer:
gmatarrubia
Date:
Tue Apr 14 15:00:13 2015 +0200
Revision:
0:820a69dfd200
Initial repo. IAP commands, EEPROM write/read, UART write/read, CAN

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gmatarrubia 0:820a69dfd200 1 /* mbed Microcontroller Library
gmatarrubia 0:820a69dfd200 2 * Copyright (c) 2006-2013 ARM Limited
gmatarrubia 0:820a69dfd200 3 *
gmatarrubia 0:820a69dfd200 4 * Licensed under the Apache License, Version 2.0 (the "License");
gmatarrubia 0:820a69dfd200 5 * you may not use this file except in compliance with the License.
gmatarrubia 0:820a69dfd200 6 * You may obtain a copy of the License at
gmatarrubia 0:820a69dfd200 7 *
gmatarrubia 0:820a69dfd200 8 * http://www.apache.org/licenses/LICENSE-2.0
gmatarrubia 0:820a69dfd200 9 *
gmatarrubia 0:820a69dfd200 10 * Unless required by applicable law or agreed to in writing, software
gmatarrubia 0:820a69dfd200 11 * distributed under the License is distributed on an "AS IS" BASIS,
gmatarrubia 0:820a69dfd200 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
gmatarrubia 0:820a69dfd200 13 * See the License for the specific language governing permissions and
gmatarrubia 0:820a69dfd200 14 * limitations under the License.
gmatarrubia 0:820a69dfd200 15 */
gmatarrubia 0:820a69dfd200 16 #ifndef MBED_FILESYSTEMLIKE_H
gmatarrubia 0:820a69dfd200 17 #define MBED_FILESYSTEMLIKE_H
gmatarrubia 0:820a69dfd200 18
gmatarrubia 0:820a69dfd200 19 #include "platform.h"
gmatarrubia 0:820a69dfd200 20
gmatarrubia 0:820a69dfd200 21 #include "FileBase.h"
gmatarrubia 0:820a69dfd200 22 #include "FileHandle.h"
gmatarrubia 0:820a69dfd200 23 #include "DirHandle.h"
gmatarrubia 0:820a69dfd200 24
gmatarrubia 0:820a69dfd200 25 namespace mbed {
gmatarrubia 0:820a69dfd200 26
gmatarrubia 0:820a69dfd200 27 /** A filesystem-like object is one that can be used to open files
gmatarrubia 0:820a69dfd200 28 * though it by fopen("/name/filename", mode)
gmatarrubia 0:820a69dfd200 29 *
gmatarrubia 0:820a69dfd200 30 * Implementations must define at least open (the default definitions
gmatarrubia 0:820a69dfd200 31 * of the rest of the functions just return error values).
gmatarrubia 0:820a69dfd200 32 */
gmatarrubia 0:820a69dfd200 33 class FileSystemLike : public FileBase {
gmatarrubia 0:820a69dfd200 34
gmatarrubia 0:820a69dfd200 35 public:
gmatarrubia 0:820a69dfd200 36 /** FileSystemLike constructor
gmatarrubia 0:820a69dfd200 37 *
gmatarrubia 0:820a69dfd200 38 * @param name The name to use for the filesystem.
gmatarrubia 0:820a69dfd200 39 */
gmatarrubia 0:820a69dfd200 40 FileSystemLike(const char *name);
gmatarrubia 0:820a69dfd200 41
gmatarrubia 0:820a69dfd200 42 virtual ~FileSystemLike();
gmatarrubia 0:820a69dfd200 43
gmatarrubia 0:820a69dfd200 44 static DirHandle *opendir();
gmatarrubia 0:820a69dfd200 45 friend class BaseDirHandle;
gmatarrubia 0:820a69dfd200 46
gmatarrubia 0:820a69dfd200 47 /** Opens a file from the filesystem
gmatarrubia 0:820a69dfd200 48 *
gmatarrubia 0:820a69dfd200 49 * @param filename The name of the file to open.
gmatarrubia 0:820a69dfd200 50 * @param flags One of O_RDONLY, O_WRONLY, or O_RDWR, OR'd with
gmatarrubia 0:820a69dfd200 51 * zero or more of O_CREAT, O_TRUNC, or O_APPEND.
gmatarrubia 0:820a69dfd200 52 *
gmatarrubia 0:820a69dfd200 53 * @returns
gmatarrubia 0:820a69dfd200 54 * A pointer to a FileHandle object representing the
gmatarrubia 0:820a69dfd200 55 * file on success, or NULL on failure.
gmatarrubia 0:820a69dfd200 56 */
gmatarrubia 0:820a69dfd200 57 virtual FileHandle *open(const char *filename, int flags) = 0;
gmatarrubia 0:820a69dfd200 58
gmatarrubia 0:820a69dfd200 59 /** Remove a file from the filesystem.
gmatarrubia 0:820a69dfd200 60 *
gmatarrubia 0:820a69dfd200 61 * @param filename the name of the file to remove.
gmatarrubia 0:820a69dfd200 62 * @param returns 0 on success, -1 on failure.
gmatarrubia 0:820a69dfd200 63 */
gmatarrubia 0:820a69dfd200 64 virtual int remove(const char *filename) { return -1; };
gmatarrubia 0:820a69dfd200 65
gmatarrubia 0:820a69dfd200 66 /** Rename a file in the filesystem.
gmatarrubia 0:820a69dfd200 67 *
gmatarrubia 0:820a69dfd200 68 * @param oldname the name of the file to rename.
gmatarrubia 0:820a69dfd200 69 * @param newname the name to rename it to.
gmatarrubia 0:820a69dfd200 70 *
gmatarrubia 0:820a69dfd200 71 * @returns
gmatarrubia 0:820a69dfd200 72 * 0 on success,
gmatarrubia 0:820a69dfd200 73 * -1 on failure.
gmatarrubia 0:820a69dfd200 74 */
gmatarrubia 0:820a69dfd200 75 virtual int rename(const char *oldname, const char *newname) { return -1; };
gmatarrubia 0:820a69dfd200 76
gmatarrubia 0:820a69dfd200 77 /** Opens a directory in the filesystem and returns a DirHandle
gmatarrubia 0:820a69dfd200 78 * representing the directory stream.
gmatarrubia 0:820a69dfd200 79 *
gmatarrubia 0:820a69dfd200 80 * @param name The name of the directory to open.
gmatarrubia 0:820a69dfd200 81 *
gmatarrubia 0:820a69dfd200 82 * @returns
gmatarrubia 0:820a69dfd200 83 * A DirHandle representing the directory stream, or
gmatarrubia 0:820a69dfd200 84 * NULL on failure.
gmatarrubia 0:820a69dfd200 85 */
gmatarrubia 0:820a69dfd200 86 virtual DirHandle *opendir(const char *name) { return NULL; };
gmatarrubia 0:820a69dfd200 87
gmatarrubia 0:820a69dfd200 88 /** Creates a directory in the filesystem.
gmatarrubia 0:820a69dfd200 89 *
gmatarrubia 0:820a69dfd200 90 * @param name The name of the directory to create.
gmatarrubia 0:820a69dfd200 91 * @param mode The permissions to create the directory with.
gmatarrubia 0:820a69dfd200 92 *
gmatarrubia 0:820a69dfd200 93 * @returns
gmatarrubia 0:820a69dfd200 94 * 0 on success,
gmatarrubia 0:820a69dfd200 95 * -1 on failure.
gmatarrubia 0:820a69dfd200 96 */
gmatarrubia 0:820a69dfd200 97 virtual int mkdir(const char *name, mode_t mode) { return -1; }
gmatarrubia 0:820a69dfd200 98
gmatarrubia 0:820a69dfd200 99 // TODO other filesystem functions (mkdir, rm, rn, ls etc)
gmatarrubia 0:820a69dfd200 100 };
gmatarrubia 0:820a69dfd200 101
gmatarrubia 0:820a69dfd200 102 } // namespace mbed
gmatarrubia 0:820a69dfd200 103
gmatarrubia 0:820a69dfd200 104 #endif