1 /* ----> DO NOT REMOVE THE FOLLOWING NOTICE <---- 2 * 3 * Copyright (c) 2014-2015 Datalight, Inc. 4 * All Rights Reserved Worldwide. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; use version 2 of the License. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty 12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License along 16 * with this program; if not, write to the Free Software Foundation, Inc., 17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 */ 19 20 /* Businesses and individuals that for commercial or other reasons cannot 21 * comply with the terms of the GPLv2 license may obtain a commercial license 22 * before incorporating Reliance Edge into proprietary software for 23 * distribution in any form. Visit http://www.datalight.com/reliance-edge for 24 * more information. 25 */ 26 27 /** @file 28 * @brief Interface for the Reliance Edge FSE API. 29 * 30 * The FSE (File Systems Essentials) API is a minimalist file system API 31 * intended for simple use cases with a fixed number of statically-defined 32 * files. It does not support creating or deleting files dynamically. Files 33 * are referenced by a fixed file number, rather than by name; there are no 34 * file names and no directories. There are also no file handles: files are 35 * not opened or closed, and file offsets are given explicitly. 36 * 37 * If the FSE API is too limited to meet the needs of your application, 38 * consider using the more feature-rich POSIX-like file system API instead. 39 */ 40 #ifndef REDFSE_H 41 #define REDFSE_H 42 43 /* This header is intended for application use; some applications are written 44 * in C++. 45 */ 46 #ifdef __cplusplus 47 extern "C" { 48 #endif 49 50 #include <redconf.h> 51 52 #if REDCONF_API_FSE == 1 53 54 #include <redtypes.h> 55 #include "redapimacs.h" 56 #include "rederrno.h" 57 58 59 /** @brief First valid file number. 60 * 61 * This macro can be used to statically define file numbers for given files, 62 * as in the below example: 63 * 64 * ~~~{.c} 65 #define LOG_FILE (RED_FILENUM_FIRST_VALID) 66 #define DATABASE_FILE (RED_FILENUM_FIRST_VALID + 1U) 67 #define ICON1_FILE (RED_FILENUM_FIRST_VALID + 2U) 68 #define ICON2_FILE (RED_FILENUM_FIRST_VALID + 3U) 69 * ~~~ 70 */ 71 #define RED_FILENUM_FIRST_VALID ( 2U ) 72 73 74 REDSTATUS RedFseInit( void ); 75 REDSTATUS RedFseUninit( void ); 76 REDSTATUS RedFseMount( uint8_t bVolNum ); 77 REDSTATUS RedFseUnmount( uint8_t bVolNum ); 78 #if ( REDCONF_READ_ONLY == 0 ) && ( REDCONF_API_FSE_FORMAT == 1 ) 79 REDSTATUS RedFseFormat( uint8_t bVolNum ); 80 #endif 81 int32_t RedFseRead( uint8_t bVolNum, 82 uint32_t ulFileNum, 83 uint64_t ullFileOffset, 84 uint32_t ulLength, 85 void * pBuffer ); 86 #if REDCONF_READ_ONLY == 0 87 int32_t RedFseWrite( uint8_t bVolNum, 88 uint32_t ulFileNum, 89 uint64_t ullFileOffset, 90 uint32_t ulLength, 91 const void * pBuffer ); 92 #endif 93 #if ( REDCONF_READ_ONLY == 0 ) && ( REDCONF_API_FSE_TRUNCATE == 1 ) 94 REDSTATUS RedFseTruncate( uint8_t bVolNum, 95 uint32_t ulFileNum, 96 uint64_t ullNewFileSize ); 97 #endif 98 int64_t RedFseSizeGet( uint8_t bVolNum, 99 uint32_t ulFileNum ); 100 #if ( REDCONF_READ_ONLY == 0 ) && ( REDCONF_API_FSE_TRANSMASKSET == 1 ) 101 REDSTATUS RedFseTransMaskSet( uint8_t bVolNum, 102 uint32_t ulEventMask ); 103 #endif 104 #if REDCONF_API_FSE_TRANSMASKGET == 1 105 REDSTATUS RedFseTransMaskGet( uint8_t bVolNum, 106 uint32_t * pulEventMask ); 107 #endif 108 #if REDCONF_READ_ONLY == 0 109 REDSTATUS RedFseTransact( uint8_t bVolNum ); 110 #endif 111 112 #endif /* REDCONF_API_FSE == 1 */ 113 114 115 #ifdef __cplusplus 116 } 117 #endif 118 119 #endif /* ifndef REDFSE_H */ 120