Revert d868uv address map.

On write, address regions have to be ordered sequentially.
On read, bitmaps should be read first.
This commit is contained in:
Serge Vakulenko 2018-10-30 11:58:24 -07:00
parent f5e6eec17e
commit 8133926245
2 changed files with 599 additions and 593 deletions

File diff suppressed because it is too large Load Diff

View File

@ -47,17 +47,17 @@
//
// Offsets in the image file.
//
#define OFFSET_ZONE_MAP 0x000040 // Bitmap of valid zones
#define OFFSET_SCANL_MAP 0x000080 // Bitmap of valid scanlists
#define OFFSET_CHAN_MAP 0x0000c0 // Bitmap of valid channels
#define OFFSET_CONTACT_MAP 0x000300 // Bitmap of invalid contacts
#define OFFSET_BANK1 0x000800 // Channels
#define OFFSET_ZONELISTS 0x03f080 // Channel lists of zones
#define OFFSET_SCANLISTS 0x05e480 // Scanlists
#define OFFSET_MESSAGES 0x06a700 // Messages
#define OFFSET_SETTINGS 0x071b00 // General settings
#define OFFSET_ZONENAMES 0x0722c0 // Names of zones
#define OFFSET_RADIOID 0x074200 // Table of radio IDs
#define OFFSET_BANK1 0x000040 // Channels
#define OFFSET_ZONELISTS 0x03e8c0 // Channel lists of zones
#define OFFSET_SCANLISTS 0x05dcc0 // Scanlists
#define OFFSET_MESSAGES 0x069f40 // Messages
#define OFFSET_ZONE_MAP 0x070940 // Bitmap of valid zones
#define OFFSET_SCANL_MAP 0x070980 // Bitmap of valid scanlists
#define OFFSET_CHAN_MAP 0x070a40 // Bitmap of valid channels
#define OFFSET_SETTINGS 0x071600 // General settings
#define OFFSET_ZONENAMES 0x071dc0 // Names of zones
#define OFFSET_RADIOID 0x073d00 // Table of radio IDs
#define OFFSET_CONTACT_MAP 0x080140 // Bitmap of invalid contacts
#define OFFSET_CONTACTS 0x080640 // Contacts
#define OFFSET_GLISTS 0x174b00 // RX group lists
@ -91,6 +91,7 @@
typedef struct {
unsigned address;
unsigned length;
unsigned offset;
} fragment_t;
static fragment_t region_map[] = {
@ -506,10 +507,18 @@ static int skip_region(unsigned addr, unsigned file_offset, uint8_t *mem, unsign
static void d868uv_download(radio_device_t *radio)
{
fragment_t *f;
// Read bitmaps first.
for (f=region_map; f->length; f++) {
if (f->offset != 0) {
serial_read_region(f->address, &radio_mem[f->offset], f->length);
}
}
// Read other regions sequentially.
unsigned file_offset = 0;
unsigned bytes_transferred = 0;
unsigned last_printed = 0;
//printf("Address Offset\n");
for (f=region_map; f->length; f++) {
unsigned addr = f->address;
@ -520,7 +529,8 @@ static void d868uv_download(radio_device_t *radio)
unsigned n = (nbytes > 64) ? 64 : nbytes;
if (! skip_region(addr, file_offset, &radio_mem[file_offset], n)) {
serial_read_region(addr, &radio_mem[file_offset], n);
if (f->offset == 0)
serial_read_region(addr, &radio_mem[file_offset], n);
bytes_transferred += n;
}
file_offset += n;