mbed library for NZ32-SC151

Committer:
modtronix-com
Date:
Fri Aug 19 15:46:42 2016 +1000
Revision:
17:639ed60ce759
Parent:
1:71204b8406f2
Added tag v1.1 for changeset 076cbe3e55be

Who changed what in which revision?

UserRevisionLine numberNew contents of line
modtronix 1:71204b8406f2 1 /* mbed Microcontroller Library
modtronix 1:71204b8406f2 2 * Copyright (c) 2006-2013 ARM Limited
modtronix 1:71204b8406f2 3 *
modtronix 1:71204b8406f2 4 * Licensed under the Apache License, Version 2.0 (the "License");
modtronix 1:71204b8406f2 5 * you may not use this file except in compliance with the License.
modtronix 1:71204b8406f2 6 * You may obtain a copy of the License at
modtronix 1:71204b8406f2 7 *
modtronix 1:71204b8406f2 8 * http://www.apache.org/licenses/LICENSE-2.0
modtronix 1:71204b8406f2 9 *
modtronix 1:71204b8406f2 10 * Unless required by applicable law or agreed to in writing, software
modtronix 1:71204b8406f2 11 * distributed under the License is distributed on an "AS IS" BASIS,
modtronix 1:71204b8406f2 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
modtronix 1:71204b8406f2 13 * See the License for the specific language governing permissions and
modtronix 1:71204b8406f2 14 * limitations under the License.
modtronix 1:71204b8406f2 15 */
modtronix 1:71204b8406f2 16 #ifndef MBED_FILEBASE_H
modtronix 1:71204b8406f2 17 #define MBED_FILEBASE_H
modtronix 1:71204b8406f2 18
modtronix 1:71204b8406f2 19 typedef int FILEHANDLE;
modtronix 1:71204b8406f2 20
modtronix 1:71204b8406f2 21 #include <stdio.h>
modtronix 1:71204b8406f2 22
modtronix 1:71204b8406f2 23 #if defined(__ARMCC_VERSION) || defined(__ICCARM__)
modtronix 1:71204b8406f2 24 # define O_RDONLY 0
modtronix 1:71204b8406f2 25 # define O_WRONLY 1
modtronix 1:71204b8406f2 26 # define O_RDWR 2
modtronix 1:71204b8406f2 27 # define O_CREAT 0x0200
modtronix 1:71204b8406f2 28 # define O_TRUNC 0x0400
modtronix 1:71204b8406f2 29 # define O_APPEND 0x0008
modtronix 1:71204b8406f2 30
modtronix 1:71204b8406f2 31 # define NAME_MAX 255
modtronix 1:71204b8406f2 32
modtronix 1:71204b8406f2 33 typedef int mode_t;
modtronix 1:71204b8406f2 34 typedef int ssize_t;
modtronix 1:71204b8406f2 35 typedef long off_t;
modtronix 1:71204b8406f2 36
modtronix 1:71204b8406f2 37 #else
modtronix 1:71204b8406f2 38 # include <sys/fcntl.h>
modtronix 1:71204b8406f2 39 # include <sys/types.h>
modtronix 1:71204b8406f2 40 # include <sys/syslimits.h>
modtronix 1:71204b8406f2 41 #endif
modtronix 1:71204b8406f2 42
modtronix 1:71204b8406f2 43 #include "platform.h"
modtronix 1:71204b8406f2 44
modtronix 1:71204b8406f2 45 namespace mbed {
modtronix 1:71204b8406f2 46
modtronix 1:71204b8406f2 47 typedef enum {
modtronix 1:71204b8406f2 48 FilePathType,
modtronix 1:71204b8406f2 49 FileSystemPathType
modtronix 1:71204b8406f2 50 } PathType;
modtronix 1:71204b8406f2 51
modtronix 1:71204b8406f2 52 class FileBase {
modtronix 1:71204b8406f2 53 public:
modtronix 1:71204b8406f2 54 FileBase(const char *name, PathType t);
modtronix 1:71204b8406f2 55
modtronix 1:71204b8406f2 56 virtual ~FileBase();
modtronix 1:71204b8406f2 57
modtronix 1:71204b8406f2 58 const char* getName(void);
modtronix 1:71204b8406f2 59 PathType getPathType(void);
modtronix 1:71204b8406f2 60
modtronix 1:71204b8406f2 61 static FileBase *lookup(const char *name, unsigned int len);
modtronix 1:71204b8406f2 62
modtronix 1:71204b8406f2 63 static FileBase *get(int n);
modtronix 1:71204b8406f2 64
modtronix 1:71204b8406f2 65 protected:
modtronix 1:71204b8406f2 66 static FileBase *_head;
modtronix 1:71204b8406f2 67
modtronix 1:71204b8406f2 68 FileBase *_next;
modtronix 1:71204b8406f2 69 const char *_name;
modtronix 1:71204b8406f2 70 PathType _path_type;
modtronix 1:71204b8406f2 71
modtronix 1:71204b8406f2 72 /* disallow copy constructor and assignment operators */
modtronix 1:71204b8406f2 73 private:
modtronix 1:71204b8406f2 74 FileBase(const FileBase&);
modtronix 1:71204b8406f2 75 FileBase & operator = (const FileBase&);
modtronix 1:71204b8406f2 76 };
modtronix 1:71204b8406f2 77
modtronix 1:71204b8406f2 78 } // namespace mbed
modtronix 1:71204b8406f2 79
modtronix 1:71204b8406f2 80 #endif