AP_ROMFS.h 729 B

1234567891011121314151617181920212223242526
  1. /*
  2. implement a file store for embedded firmware images
  3. */
  4. #pragma once
  5. #include <AP_HAL/AP_HAL.h>
  6. class AP_ROMFS {
  7. public:
  8. // find a file and de-compress, assumning gzip format. The
  9. // decompressed data will be allocated with malloc(). You must
  10. // call free on the return value after use. The next byte after
  11. // the file data is guaranteed to be null.
  12. static uint8_t *find_decompress(const char *name, uint32_t &size);
  13. private:
  14. // find an embedded file
  15. static const uint8_t *find_file(const char *name, uint32_t &size);
  16. struct embedded_file {
  17. const char *filename;
  18. uint32_t size;
  19. const uint8_t *contents;
  20. };
  21. static const struct embedded_file files[];
  22. };