APM:Libraries
AP_ROMFS.cpp
Go to the documentation of this file.
1 /*
2  This program is free software: you can redistribute it and/or modify
3  it under the terms of the GNU General Public License as published by
4  the Free Software Foundation, either version 3 of the License, or
5  (at your option) any later version.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  GNU General Public License for more details.
11 
12  You should have received a copy of the GNU General Public License
13  along with this program. If not, see <http://www.gnu.org/licenses/>.
14 */
15 /*
16  implement a file store for embedded firmware images
17  */
18 
19 #include "AP_ROMFS.h"
20 
21 #ifdef HAL_HAVE_AP_ROMFS_EMBEDDED_H
22 #include <ap_romfs_embedded.h>
23 #else
25 #endif
26 
27 /*
28  find an embedded file
29 */
30 const uint8_t *AP_ROMFS::find_file(const char *name, uint32_t &size)
31 {
32  for (uint16_t i=0; i<ARRAY_SIZE_SIMPLE(files); i++) {
33  if (strcmp(name, files[i].filename) == 0) {
34  size = files[i].size;
35  return files[i].contents;
36  }
37  }
38  return nullptr;
39 }
const char * name
Definition: BusTest.cpp:11
const uint8_t * contents
Definition: AP_ROMFS.h:16
static const uint8_t * find_file(const char *name, uint32_t &size)
Definition: AP_ROMFS.cpp:30
static const struct embedded_file files[]
Definition: AP_ROMFS.h:18
#define ARRAY_SIZE_SIMPLE(_arr)
Definition: AP_Common.h:83