Webserver+3d print
Embed:
(wiki syntax)
Show/hide line numbers
resource_manager.h
Go to the documentation of this file.
00001 /** 00002 * @file resource_manager.h 00003 * @brief Embedded resource management 00004 * 00005 * @section License 00006 * 00007 * Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved. 00008 * 00009 * This program is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU General Public License 00011 * as published by the Free Software Foundation; either version 2 00012 * of the License, or (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU General Public License 00020 * along with this program; if not, write to the Free Software Foundation, 00021 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00022 * 00023 * @author Oryx Embedded SARL (www.oryx-embedded.com) 00024 * @version 1.7.6 00025 **/ 00026 00027 #ifndef _RESOURCE_MANAGER_H 00028 #define _RESOURCE_MANAGER_H 00029 00030 //Dependencies 00031 #include "compiler_port.h" 00032 #include "error.h" 00033 00034 00035 /** 00036 * @brief Resource type 00037 **/ 00038 00039 typedef enum 00040 { 00041 RES_TYPE_DIR = 1, 00042 RES_TYPE_FILE = 2 00043 } ResType; 00044 00045 00046 //CodeWarrior or Win32 compiler? 00047 #if defined(__CWCC__) || defined(_WIN32) 00048 #pragma pack(push, 1) 00049 #endif 00050 00051 00052 /** 00053 * @brief Resource entry 00054 **/ 00055 00056 typedef __start_packed struct 00057 { 00058 char_t type; 00059 uint32_t dataStart; 00060 uint32_t dataLength; 00061 uint8_t nameLength; 00062 char_t name[]; 00063 } __end_packed ResEntry; 00064 00065 00066 /** 00067 * @brief Root entry 00068 **/ 00069 00070 typedef __start_packed struct 00071 { 00072 char_t type; 00073 uint32_t dataStart; 00074 uint32_t dataLength; 00075 uint8_t nameLength; 00076 } __end_packed ResRootEntry; 00077 00078 00079 /** 00080 * @brief Resource header 00081 **/ 00082 00083 typedef __start_packed struct 00084 { 00085 uint32_t totalSize; 00086 ResRootEntry rootEntry; 00087 } __end_packed ResHeader; 00088 00089 00090 //CodeWarrior or Win32 compiler? 00091 #if defined(__CWCC__) || defined(_WIN32) 00092 #pragma pack(pop) 00093 #endif 00094 00095 00096 typedef struct 00097 { 00098 uint_t type; 00099 uint_t volume; 00100 uint32_t dataStart; 00101 uint32_t dataLength; 00102 uint8_t nameLength; 00103 char_t name[]; 00104 } DirEntry; 00105 00106 00107 //Resource management 00108 error_t resGetData(const char_t *path, uint8_t **data, size_t *length); 00109 00110 error_t resSearchFile(const char_t *path, DirEntry *dirEntry); 00111 00112 //error_t resOpenDirectory(Directory *directory, const DirEntry *entry); 00113 //error_t resReadDirectory(Directory *directory, DirEntry *entry); 00114 00115 #if 0 00116 typedef struct 00117 { 00118 uint_t mode; 00119 uint32_t start; 00120 uint32_t size; 00121 uint32_t offset; 00122 } FsFile; 00123 00124 error_t resOpenFile(FsFile *file, const DirEntry *dirEntry, uint_t mode); 00125 error_t resSeekFile(FsFile *file, uint32_t *position); 00126 uint_t resReadFile(FsFile *file, void *data, size_t length); 00127 #endif 00128 00129 #endif 00130
Generated on Tue Jul 12 2022 17:10:15 by
