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_DIRHANDLE_H
gmatarrubia 0:820a69dfd200 17 #define MBED_DIRHANDLE_H
gmatarrubia 0:820a69dfd200 18
gmatarrubia 0:820a69dfd200 19 #if defined(__ARMCC_VERSION) || defined(__ICCARM__)
gmatarrubia 0:820a69dfd200 20 # define NAME_MAX 255
gmatarrubia 0:820a69dfd200 21 typedef int mode_t;
gmatarrubia 0:820a69dfd200 22
gmatarrubia 0:820a69dfd200 23 #else
gmatarrubia 0:820a69dfd200 24 # include <sys/syslimits.h>
gmatarrubia 0:820a69dfd200 25 #endif
gmatarrubia 0:820a69dfd200 26
gmatarrubia 0:820a69dfd200 27 #include "FileHandle.h"
gmatarrubia 0:820a69dfd200 28
gmatarrubia 0:820a69dfd200 29 struct dirent {
gmatarrubia 0:820a69dfd200 30 char d_name[NAME_MAX+1];
gmatarrubia 0:820a69dfd200 31 };
gmatarrubia 0:820a69dfd200 32
gmatarrubia 0:820a69dfd200 33 namespace mbed {
gmatarrubia 0:820a69dfd200 34
gmatarrubia 0:820a69dfd200 35 /** Represents a directory stream. Objects of this type are returned
gmatarrubia 0:820a69dfd200 36 * by a FileSystemLike's opendir method. Implementations must define
gmatarrubia 0:820a69dfd200 37 * at least closedir, readdir and rewinddir.
gmatarrubia 0:820a69dfd200 38 *
gmatarrubia 0:820a69dfd200 39 * If a FileSystemLike class defines the opendir method, then the
gmatarrubia 0:820a69dfd200 40 * directories of an object of that type can be accessed by
gmatarrubia 0:820a69dfd200 41 * DIR *d = opendir("/example/directory") (or opendir("/example")
gmatarrubia 0:820a69dfd200 42 * to open the root of the filesystem), and then using readdir(d) etc.
gmatarrubia 0:820a69dfd200 43 *
gmatarrubia 0:820a69dfd200 44 * The root directory is considered to contain all FileLike and
gmatarrubia 0:820a69dfd200 45 * FileSystemLike objects, so the DIR* returned by opendir("/") will
gmatarrubia 0:820a69dfd200 46 * reflect this.
gmatarrubia 0:820a69dfd200 47 */
gmatarrubia 0:820a69dfd200 48 class DirHandle {
gmatarrubia 0:820a69dfd200 49
gmatarrubia 0:820a69dfd200 50 public:
gmatarrubia 0:820a69dfd200 51 /** Closes the directory.
gmatarrubia 0:820a69dfd200 52 *
gmatarrubia 0:820a69dfd200 53 * @returns
gmatarrubia 0:820a69dfd200 54 * 0 on success,
gmatarrubia 0:820a69dfd200 55 * -1 on error.
gmatarrubia 0:820a69dfd200 56 */
gmatarrubia 0:820a69dfd200 57 virtual int closedir()=0;
gmatarrubia 0:820a69dfd200 58
gmatarrubia 0:820a69dfd200 59 /** Return the directory entry at the current position, and
gmatarrubia 0:820a69dfd200 60 * advances the position to the next entry.
gmatarrubia 0:820a69dfd200 61 *
gmatarrubia 0:820a69dfd200 62 * @returns
gmatarrubia 0:820a69dfd200 63 * A pointer to a dirent structure representing the
gmatarrubia 0:820a69dfd200 64 * directory entry at the current position, or NULL on reaching
gmatarrubia 0:820a69dfd200 65 * end of directory or error.
gmatarrubia 0:820a69dfd200 66 */
gmatarrubia 0:820a69dfd200 67 virtual struct dirent *readdir()=0;
gmatarrubia 0:820a69dfd200 68
gmatarrubia 0:820a69dfd200 69 /** Resets the position to the beginning of the directory.
gmatarrubia 0:820a69dfd200 70 */
gmatarrubia 0:820a69dfd200 71 virtual void rewinddir()=0;
gmatarrubia 0:820a69dfd200 72
gmatarrubia 0:820a69dfd200 73 /** Returns the current position of the DirHandle.
gmatarrubia 0:820a69dfd200 74 *
gmatarrubia 0:820a69dfd200 75 * @returns
gmatarrubia 0:820a69dfd200 76 * the current position,
gmatarrubia 0:820a69dfd200 77 * -1 on error.
gmatarrubia 0:820a69dfd200 78 */
gmatarrubia 0:820a69dfd200 79 virtual off_t telldir() { return -1; }
gmatarrubia 0:820a69dfd200 80
gmatarrubia 0:820a69dfd200 81 /** Sets the position of the DirHandle.
gmatarrubia 0:820a69dfd200 82 *
gmatarrubia 0:820a69dfd200 83 * @param location The location to seek to. Must be a value returned by telldir.
gmatarrubia 0:820a69dfd200 84 */
gmatarrubia 0:820a69dfd200 85 virtual void seekdir(off_t location) { }
gmatarrubia 0:820a69dfd200 86
gmatarrubia 0:820a69dfd200 87 virtual ~DirHandle() {}
gmatarrubia 0:820a69dfd200 88 };
gmatarrubia 0:820a69dfd200 89
gmatarrubia 0:820a69dfd200 90 } // namespace mbed
gmatarrubia 0:820a69dfd200 91
gmatarrubia 0:820a69dfd200 92 typedef mbed::DirHandle DIR;
gmatarrubia 0:820a69dfd200 93
gmatarrubia 0:820a69dfd200 94 extern "C" {
gmatarrubia 0:820a69dfd200 95 DIR *opendir(const char*);
gmatarrubia 0:820a69dfd200 96 struct dirent *readdir(DIR *);
gmatarrubia 0:820a69dfd200 97 int closedir(DIR*);
gmatarrubia 0:820a69dfd200 98 void rewinddir(DIR*);
gmatarrubia 0:820a69dfd200 99 long telldir(DIR*);
gmatarrubia 0:820a69dfd200 100 void seekdir(DIR*, long);
gmatarrubia 0:820a69dfd200 101 int mkdir(const char *name, mode_t n);
gmatarrubia 0:820a69dfd200 102 };
gmatarrubia 0:820a69dfd200 103
gmatarrubia 0:820a69dfd200 104 #endif /* MBED_DIRHANDLE_H */