This is the firmware for the LaOS - Laser Open Source project. You can use it to drive a laser cutter. For hardware and more information, look at our wiki: http://wiki.laoslaser.org

Dependencies:   EthernetNetIf mbed

Committer:
fablabtruck
Date:
Fri Jun 08 09:26:40 2012 +0000
Revision:
0:3852426a5068
svn revision 379

Who changed what in which revision?

UserRevisionLine numberNew contents of line
fablabtruck 0:3852426a5068 1 /*
fablabtruck 0:3852426a5068 2 *
fablabtruck 0:3852426a5068 3 * LaosFilesystem.h
fablabtruck 0:3852426a5068 4 * Simple Long Filename system on top of SDFilesystem.h
fablabtruck 0:3852426a5068 5 *
fablabtruck 0:3852426a5068 6 * Copyright (c) 2011 Jaap Vermaas
fablabtruck 0:3852426a5068 7 *
fablabtruck 0:3852426a5068 8 * This file is part of the LaOS project (see: http://wiki.laoslaser.org
fablabtruck 0:3852426a5068 9 *
fablabtruck 0:3852426a5068 10 * LaOS is free software: you can redistribute it and/or modify
fablabtruck 0:3852426a5068 11 * it under the terms of the GNU General Public License as published by
fablabtruck 0:3852426a5068 12 * the Free Software Foundation, either version 3 of the License, or
fablabtruck 0:3852426a5068 13 * (at your option) any later version.
fablabtruck 0:3852426a5068 14 *
fablabtruck 0:3852426a5068 15 * LaOS is distributed in the hope that it will be useful,
fablabtruck 0:3852426a5068 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
fablabtruck 0:3852426a5068 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fablabtruck 0:3852426a5068 18 * GNU General Public License for more details.
fablabtruck 0:3852426a5068 19 *
fablabtruck 0:3852426a5068 20 * You should have received a copy of the GNU General Public License
fablabtruck 0:3852426a5068 21 * along with LaOS. If not, see <http://www.gnu.org/licenses/>.
fablabtruck 0:3852426a5068 22 */
fablabtruck 0:3852426a5068 23 #ifndef _LAOSFILESYSTEM_
fablabtruck 0:3852426a5068 24 #define _LAOSFILESYSTEM_
fablabtruck 0:3852426a5068 25
fablabtruck 0:3852426a5068 26 #include "SDFileSystem.h"
fablabtruck 0:3852426a5068 27 #include "FATFileSystem.h"
fablabtruck 0:3852426a5068 28 #include <string>
fablabtruck 0:3852426a5068 29 #include <ctype.h>
fablabtruck 0:3852426a5068 30
fablabtruck 0:3852426a5068 31 #define _LAOSFILE_TRANSTABLE "longname.sys"
fablabtruck 0:3852426a5068 32 #define MAXFILESIZE 21
fablabtruck 0:3852426a5068 33 #define SHORTFILESIZE 13
fablabtruck 0:3852426a5068 34
fablabtruck 0:3852426a5068 35 class LaosFileSystem : public SDFileSystem {
fablabtruck 0:3852426a5068 36 public:
fablabtruck 0:3852426a5068 37 LaosFileSystem(PinName mosi, PinName miso, PinName sclk, PinName cs,
fablabtruck 0:3852426a5068 38 const char* name); // Create the filesystem on SD
fablabtruck 0:3852426a5068 39 virtual ~LaosFileSystem(); // destructor
fablabtruck 0:3852426a5068 40 FILE* openfile(char* fname, char* iom); // open a file
fablabtruck 0:3852426a5068 41 void getlongname(char *result, char *searchname); // return long names
fablabtruck 0:3852426a5068 42 void getshortname(char* shortname, char* name); //get a short name
fablabtruck 0:3852426a5068 43 char pathname[MAXFILESIZE+2];
fablabtruck 0:3852426a5068 44 void cleanlist();
fablabtruck 0:3852426a5068 45 void shorten(char* name, int max);
fablabtruck 0:3852426a5068 46
fablabtruck 0:3852426a5068 47 private:
fablabtruck 0:3852426a5068 48 int islegalname(char* name);
fablabtruck 0:3852426a5068 49 int isshortname(char* name);
fablabtruck 0:3852426a5068 50 void removespaces(char* name);
fablabtruck 0:3852426a5068 51 void makeshortname(char* shortname, char* name);
fablabtruck 0:3852426a5068 52 size_t dirread(char* longname, char* shortname, FILE *fp);
fablabtruck 0:3852426a5068 53 size_t dirwrite(char* longname, char* shortname, FILE* fp);
fablabtruck 0:3852426a5068 54 char tablename[MAXFILESIZE + SHORTFILESIZE + 1];
fablabtruck 0:3852426a5068 55 };
fablabtruck 0:3852426a5068 56
fablabtruck 0:3852426a5068 57 void showfile(); // debug: list contents of long filesytem file
fablabtruck 0:3852426a5068 58 void cleandir(); // delete all files in directory
fablabtruck 0:3852426a5068 59 void printdir(); // list all files in directory (with long names)
fablabtruck 0:3852426a5068 60 //void getfilename(char *name, int filenr); // get name of the #filenr file
fablabtruck 0:3852426a5068 61 //int getfilenum(char *name); // get number of this filename
fablabtruck 0:3852426a5068 62 void getprevjob(char *name); // previous job
fablabtruck 0:3852426a5068 63 void getnextjob(char *name); // next job
fablabtruck 0:3852426a5068 64 void writefile(char *name); // example code to open a file
fablabtruck 0:3852426a5068 65 void removefile(char *name); // example code to remove a file
fablabtruck 0:3852426a5068 66 int readint(FILE *fp); // read integers from open file
fablabtruck 0:3852426a5068 67 void strtolower(char *name); // change characters to lowercase
fablabtruck 0:3852426a5068 68 int isFirmware(char *name); // check if it's firmware
fablabtruck 0:3852426a5068 69 void installFirmware(char *filename); // put firmware in place
fablabtruck 0:3852426a5068 70 void removeFirmware(); // remove old firmware
fablabtruck 0:3852426a5068 71 int SDcheckFirmware(); // check for firmware
fablabtruck 0:3852426a5068 72 int isLaosFile(char *filename); // check extension for LaOS compatibility
fablabtruck 0:3852426a5068 73 #endif