-
Notifications
You must be signed in to change notification settings - Fork 0
/
rom.h
167 lines (134 loc) · 4.5 KB
/
rom.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#ifndef __ROM_H__
#define __ROM_H__
#include "os_structs.h"
#define DEF_CARD_NAME "RomeoCard"
#define DEF_CARD_MANU "Romeo Computing"
#define DEF_STORE_NAME "Romeo Store"
#define MAX_LAYOUT_LEN 16
#define MAX_FILENAME_LEN 64
/******************************************************************************
******************************************************************************
*** Custom structures
******************************************************************************
******************************************************************************/
/******************************************
* Structure to identify PRC/database
*/
typedef struct {
char dbName[dmDBNameLength + 8]; // <dbName>.[prc|pdb]
UInt32 type;
UInt32 creator;
UInt16 isOverlay;
} PRCIDType;
typedef PRCIDType* PRCIDPtr;
#define NNAME {0}
/******************************************
* Version-specific ROM defaults
*/
typedef struct {
char name[3]; // country code
UInt16 language;
UInt16 country;
} Locale;
#define romNumLocales 6
extern Locale Locales[romNumLocales];
typedef struct {
UInt16 palmOSVer;
UInt32 ROM_base;
UInt32 small_ROMSize; // Size of hard-memory devoted to small ROM.
UInt32 small_cardSize; // Size of structures and heaps in small ROM.
PRCIDPtr small_PRCList;
char small_layout[MAX_LAYOUT_LEN]; // layout of PRCs in the small ROM image
char small_addLayout[MAX_LAYOUT_LEN];// layout of PRCs added to existing ROM
UInt32 big_ROMSize; // Size of hard-memory devoted to large ROM.
UInt32 big_cardSize; // Size of structures and heaps in large ROM.
PRCIDPtr big_PRCList;
char big_layout[MAX_LAYOUT_LEN]; // layout of PRCs in the large ROM image
char big_addLayout[MAX_LAYOUT_LEN]; // layout of PRCs added to existing ROM
char card_name[memMaxNameLen];
char card_manuf[memMaxNameLen];
UInt32 card_initStack;
UInt16 card_hdrVersion;
UInt16 card_flags;
UInt16 card_version;
UInt32 card_readWriteParmsOffset;
UInt32 card_readWriteParmsSize;
UInt32 card_readOnlyParmsOffset;
UInt32 card_bigROMOffset;
UInt32 card_readWriteWorkingOffset;
UInt32 card_readWriteWorkingSize;
char store_name[memMaxNameLen];
UInt16 store_version;
UInt16 store_flags;
UInt16 nvparams_localeLanguage;
UInt16 nvparams_localeCountry;
UInt16 heap_flags;
// Just load these up and drop them in at the specified offsets
char readOnlyParmsDataFile[MAX_FILENAME_LEN];
char readWriteParmsDataFile[MAX_FILENAME_LEN];
char readWriteWorkingDataFile[MAX_FILENAME_LEN];
} ROMVersion;
extern UInt32 numROMVers;
extern ROMVersion ROMVers[];
// A Database list gives a list of database offsets
typedef struct {
LocalID nextRecordListID; // local chunkID of next list
UInt16 numDatabases; // Number of databases
UInt32 databaseOffset[1]; // offset to database
} DatabaseListType;
typedef DatabaseListType* DatabaseListPtr;
typedef struct {
UInt32 type;
UInt32 ctor;
} TypeCtorType;
typedef TypeCtorType* TypeCtorPtr;
// This is just a guess -- we have an idea that a block list is 64-bits
// but no idea what those 64-bits are used for...
typedef UInt8 BlockListType[8];
typedef BlockListType* BlockListPtr;
/******************************************
* Meta-data for a PRC/database
*/
typedef struct {
UInt32 nBytes;
DatabaseHdrPtr pDB;
} PRCType;
typedef PRCType* PRCPtr;
/******************************************
* Meta-data for a Palm ROM
*/
#define RT_SMALL 0x01
#define RT_LARGE 0x02
#define RT_NON_EZ 0x04
#define RT_HEADERS_ONLY 0x10
#define RT_TYPE_MASK 0x0F
typedef struct {
UInt8* pROM; // Points to the ROM bytes.
UInt32 ROMSize; // How large is the ROM?
UInt32 CardSize; // How much of the ROM are we
// using?
UInt32 ROM_base; // Address of the ROM (small
// ROM)
UInt32 Card_base; // Address of the card (either
// ROM)
UInt32 File_base;
CardHeaderPtr pCard;
StorageHeaderPtr pStore;
HeapListPtr pHeapList;
DatabaseListPtr pDatabaseList;
DatabaseHdrPtr* pSortedDBList; // Array of DatabaseHdrPtrs
void* pContext;
/*
* Version-specific defaults
*/
ROMVersion* pVersion;
UInt16 flags;
} ROMType;
typedef ROMType* ROMPtr;
extern ROMVersion* LocateROMVerByOSVer (UInt16 osver);
extern ROMVersion* GuessVersion (ROMPtr pROM);
extern ROMVersion* CollectVersion (ROMPtr pROM);
extern ROMVersion* MergeVersions (ROMVersion* smallVers,
ROMVersion* bigVers);
extern Locale* LocateLocaleByName (char* name);
#endif /* __ROM_H__ */