summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmaury Pouly <pamaury@rockbox.org>2011-04-17 01:43:30 +0000
committerAmaury Pouly <pamaury@rockbox.org>2011-04-17 01:43:30 +0000
commit709856621a1c95b9017ea5f1d1a44781b729ac93 (patch)
tree291a3233dc3ea9fcb148bdf2af8e8039d4838866
parent7733ab942fbfe2dbc733936ba91d1ba6e53d2e37 (diff)
downloadrockbox-709856621a1c95b9017ea5f1d1a44781b729ac93.tar.gz
rockbox-709856621a1c95b9017ea5f1d1a44781b729ac93.zip
sbinfo: use a define instead of hardcoded values
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29731 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--utils/sbinfo/sb.h7
-rw-r--r--utils/sbinfo/sbinfo.c7
2 files changed, 9 insertions, 5 deletions
diff --git a/utils/sbinfo/sb.h b/utils/sbinfo/sb.h
index 1d62aa4daa..29b7d7d894 100644
--- a/utils/sbinfo/sb.h
+++ b/utils/sbinfo/sb.h
@@ -72,8 +72,11 @@ struct sb_key_dictionary_entry_t
72 uint8_t key[16]; /* Actual AES Key (encrypted by the global key) */ 72 uint8_t key[16]; /* Actual AES Key (encrypted by the global key) */
73} __attribute__((packed)); 73} __attribute__((packed));
74 74
75#define ROM_SECTION_BOOTABLE (1 << 0) 75#define IMAGE_MAJOR_VERSION 1
76#define ROM_SECTION_CLEARTEXT (1 << 1) 76#define IMAGE_MINOR_VERSION 1
77
78#define SECTION_BOOTABLE (1 << 0)
79#define SECTION_CLEARTEXT (1 << 1)
77 80
78#define SB_INST_NOP 0x0 81#define SB_INST_NOP 0x0
79#define SB_INST_TAG 0x1 82#define SB_INST_TAG 0x1
diff --git a/utils/sbinfo/sbinfo.c b/utils/sbinfo/sbinfo.c
index a79cf75e0f..f09bb79fe9 100644
--- a/utils/sbinfo/sbinfo.c
+++ b/utils/sbinfo/sbinfo.c
@@ -325,7 +325,8 @@ static void extract(unsigned long filesize)
325 bugp("File size mismatch"); 325 bugp("File size mismatch");
326 if(sb_header->header_size * BLOCK_SIZE != sizeof(struct sb_header_t)) 326 if(sb_header->header_size * BLOCK_SIZE != sizeof(struct sb_header_t))
327 bugp("Bad header size"); 327 bugp("Bad header size");
328 if(sb_header->major_ver != 1 || sb_header->minor_ver != 1) 328 if(sb_header->major_ver != IMAGE_MAJOR_VERSION ||
329 sb_header->minor_ver != IMAGE_MINOR_VERSION)
329 bugp("Bad file format version"); 330 bugp("Bad file format version");
330 if(sb_header->sec_hdr_size * BLOCK_SIZE != sizeof(struct sb_section_header_t)) 331 if(sb_header->sec_hdr_size * BLOCK_SIZE != sizeof(struct sb_section_header_t))
331 bugp("Bad section header size"); 332 bugp("Bad section header size");
@@ -489,8 +490,8 @@ static void extract(unsigned long filesize)
489 name[4] = 0; 490 name[4] = 0;
490 int pos = sec_hdr->offset * BLOCK_SIZE; 491 int pos = sec_hdr->offset * BLOCK_SIZE;
491 int size = sec_hdr->size * BLOCK_SIZE; 492 int size = sec_hdr->size * BLOCK_SIZE;
492 int data_sec = !(sec_hdr->flags & ROM_SECTION_BOOTABLE); 493 int data_sec = !(sec_hdr->flags & SECTION_BOOTABLE);
493 int encrypted = !(sec_hdr->flags & ROM_SECTION_CLEARTEXT); 494 int encrypted = !(sec_hdr->flags & SECTION_CLEARTEXT);
494 495
495 color(GREEN); 496 color(GREEN);
496 printf(" Chunk "); 497 printf(" Chunk ");