PokittoLib is the library needed for programming the Pokitto DIY game console (www.pokitto.com)
Fork of PokittoLib by
PokittoDisk.h
00001 /**************************************************************************/ 00002 /*! 00003 @file PokittoDisk.h 00004 @author Jonne Valola 00005 00006 @section LICENSE 00007 00008 Software License Agreement (BSD License) 00009 00010 Copyright (c) 2016, Jonne Valola 00011 All rights reserved. 00012 00013 Redistribution and use in source and binary forms, with or without 00014 modification, are permitted provided that the following conditions are met: 00015 1. Redistributions of source code must retain the above copyright 00016 notice, this list of conditions and the following disclaimer. 00017 2. Redistributions in binary form must reproduce the above copyright 00018 notice, this list of conditions and the following disclaimer in the 00019 documentation and/or other materials provided with the distribution. 00020 3. Neither the name of the copyright holders nor the 00021 names of its contributors may be used to endorse or promote products 00022 derived from this software without specific prior written permission. 00023 00024 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 00025 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00026 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00027 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 00028 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00029 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00030 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00031 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00032 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00033 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00034 */ 00035 /**************************************************************************/ 00036 00037 00038 #ifndef POKITTO_DISK_H 00039 #define POKITTO_DISK_H 00040 00041 #ifndef POK_SIM 00042 // real hardware disk driver 00043 #include "diskio.h" 00044 #include "pff.h" 00045 #include "connect.h" 00046 #include "mbed.h" 00047 extern BYTE res; 00048 extern FATFS fs; /* File system object */ 00049 extern FATDIR dir; /* Directory object */ 00050 extern FILINFO fno; /* File information */ 00051 extern SPI device; 00052 extern DigitalOut mmccs; 00053 00054 /**************************************************************************/ 00055 /** SD CONTROL MACROS **/ 00056 /**************************************************************************/ 00057 00058 // CS ... #define CONNECT_CS P0_7 //p13 00059 #define CLR_SD_CS LPC_GPIO_PORT->CLR[0] = (1 << 7) 00060 #define SET_SD_CS LPC_GPIO_PORT->SET[0] = (1 << 7) 00061 #define GET_SD_CS LPC_GPIO_PORT->PIN[0] & (1 << 7) 00062 00063 #else 00064 // simulated disk driver 00065 #endif 00066 00067 #include <stdint.h> 00068 00069 00070 00071 extern int pokInitSD(); 00072 00073 // File IO modes 00074 #define FILE_MODE_APPEND 0x1 00075 #define FILE_MODE_OVERWRITE 0 00076 #define FILE_MODE_READONLY 0x2 00077 #define FILE_MODE_READWRITE 0 00078 #define FILE_MODE_BINARY 0x4 00079 #define FILE_MODE_ASCII 0 00080 #define FILE_MODE_FAILED 0x8 00081 #define FILE_MODE_UNINITIALIZED 0x10 00082 00083 extern uint8_t fileOpen(char*, char); 00084 extern void fileClose(); 00085 extern int fileGetChar(); 00086 extern void filePutChar(char); 00087 extern void fileWriteBytes(uint8_t *, uint16_t); 00088 extern uint16_t fileReadBytes(uint8_t *, uint16_t); 00089 extern void fileSeekAbsolute(long); 00090 extern void fileSeekRelative(long); 00091 extern void fileRewind(); 00092 extern void fileEnd(); 00093 extern long int fileGetPosition(); 00094 #define fileSetPosition(n) (fileSeekAbsolute(n)) 00095 extern uint8_t filePeek(long); 00096 extern void filePoke(long, uint8_t); 00097 extern char* getCurrentFileName (); 00098 extern char* getNextFile (char*); 00099 extern char* getNextFile (); 00100 extern char* getFirstFile(char*); 00101 extern char* getFirstFile(); 00102 extern char* getFirstDirEntry(); 00103 extern char* getNextDirEntry(); 00104 extern int isThisFileOpen(char*); 00105 extern int fileOK(); 00106 extern int dirOpen(); 00107 extern int dirUp(); 00108 00109 #endif // POKITTO_DISK_H 00110 00111
Generated on Tue Jul 12 2022 18:08:12 by 1.7.2