1 #ifndef __ROMFILE_LOADER_H
2 #define __ROMFILE_LOADER_H
4 #include "types.h" // u8
5 #include "util.h" // romfile_s
7 #define ROMFILE_LOADER_FILESZ 56
9 /* ROM file linker/loader interface. Linker uses little endian format */
10 struct romfile_loader_entry_s {
14 * COMMAND_ALLOCATE - allocate a table from @alloc_file
15 * subject to @alloc_align alignment (must be power of 2)
16 * and @alloc_zone (can be HIGH or FSEG) requirements.
18 * Must appear exactly once for each file, and before
19 * this file is referenced by any other command.
22 char alloc_file[ROMFILE_LOADER_FILESZ];
28 * COMMAND_ADD_POINTER - patch the table (originating from
29 * @dest_file) at @pointer_offset, by adding a pointer to the table
30 * originating from @src_file. 1,2,4 or 8 byte unsigned
31 * addition is used depending on @pointer_size.
34 char pointer_dest_file[ROMFILE_LOADER_FILESZ];
35 char pointer_src_file[ROMFILE_LOADER_FILESZ];
41 * COMMAND_ADD_CHECKSUM - calculate checksum of the range specified by
42 * @cksum_start and @cksum_length fields,
43 * and then add the value at @cksum_offset.
44 * Checksum simply sums -X for each byte X in the range
48 char cksum_file[ROMFILE_LOADER_FILESZ];
60 ROMFILE_LOADER_COMMAND_ALLOCATE = 0x1,
61 ROMFILE_LOADER_COMMAND_ADD_POINTER = 0x2,
62 ROMFILE_LOADER_COMMAND_ADD_CHECKSUM = 0x3,
66 ROMFILE_LOADER_ALLOC_ZONE_HIGH = 0x1,
67 ROMFILE_LOADER_ALLOC_ZONE_FSEG = 0x2,
70 int romfile_loader_execute(const char *name);