|
"""
|
|
|
|
Description: Chirp Data Structure of the Memory Map for TYT TH-9000/VHF
|
|
Version: 0.1
|
|
Date: 8/25/2013
|
|
Status: Imcomplete
|
|
- This is the initial, incomplete version of the channel data structure.
|
|
- The memory map looks a lot like the Anytone 5888 model, however, these does appear to be significant differences.
|
|
ToDo:
|
|
- Decode channel DCS settings
|
|
- Decode General Options and Settings
|
|
- Decode Skip and Channel Set
|
|
|
|
|
|
Memory Map:
|
|
|
|
Field Start End Size
|
|
hex) (hex) (dec)
|
|
Channel Set Flag 0100 011F 32
|
|
Channel Skip Flag 0120 013F 32
|
|
Blank/Unknown 0140 01EF 176
|
|
Global Options 01F0 191F 5036
|
|
Channel 000 2000 201F 32
|
|
Channel 001 2000 201F 32
|
|
...
|
|
Channel 100 2DC0 2DDF 32
|
|
...
|
|
Channel 199 38E0 38FF 32
|
|
Blank/Unknown 3900 3FFF 1792
|
|
Total 16128 (2^8 = 16384)
|
|
|
|
|
|
Protocol for Upload Sequence, Only Writes shown:
|
|
|
|
1) Start
|
|
"Program" 50 52 4F 47 52 41 4D
|
|
0x02 02
|
|
"R\0x01\0x40\x10" 52 01 40 10 (?means "Read" address 1040, 16 bytes, but doesn't match write data field)
|
|
|
|
2) Write Records, Loop from address 0100 to 3900, step 0x10
|
|
"W"<address><length><data><checksum>"\0x06" 57 .. .. 10 ..(*16) .. 06 (write record of 16 bytes)
|
|
header[4 bytes]:
|
|
command[1] = Write ("W")
|
|
address[2] = 0100 to 3900
|
|
length[1] = 0x10 (16 bytes length)
|
|
data[16 bytes]:
|
|
data[16] = 16 byte payload
|
|
end[2 bytes]:
|
|
checksum[1] = 1 byte, uses digit check checksum ( sum of header and data bytes, modulo 256)
|
|
end of record[1] = 0x06 (ascii ACK char)
|
|
|
|
3) END
|
|
"END" 45 4E 44
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
"""
|
|
draft memory map , per channel record
|
|
- does not include DCS or various tone, cross settings
|
|
"""
|
|
|
|
mem_format = """
|
|
struct memory {
|
|
bbcd freq[4];
|
|
bbcd offset[4];
|
|
u8 unknownA:4,
|
|
tune_step:4;
|
|
u8 unknownB:4,
|
|
channel_width:2,
|
|
reverse:1,
|
|
txoff:1;
|
|
u8 talkaround:1,
|
|
compander:1,
|
|
unknownC:2,
|
|
power:2,
|
|
duplex:2;
|
|
u8 unknownD:4,
|
|
rxtmode:2,
|
|
txtmode:2;
|
|
u8 unknown5:2,
|
|
txtone:6;
|
|
u8 unknown6:2,
|
|
rxtone:6;
|
|
u8 txcode;
|
|
u8 rxcode;
|
|
u8 unknownE[3];
|
|
char name[7];
|
|
u8 unknownF:6,
|
|
busychannellockout:2;
|
|
u8 unknownG[4];
|
|
u8 unknownH:7,
|
|
scrambler:1;
|
|
};
|
|
#seekto 0x2000;
|
|
struct memory memory[200];
|
|
"""
|
|
|
|
|
|
"""
|
|
description of channel record
|
|
bytes:bit type description
|
|
---------------------------------------------------------------------------
|
|
4 bbcd freq[4] receive frequency in packed binary coded decimal
|
|
4 bbcd offset[4] transmit offset in packed binary coded decimal (note: plus/minus direction set by 'duplex' field)
|
|
1 u8
|
|
:4 unknownA:4
|
|
:4 tune_step:4 tuning step, menu index value from 0-9
|
|
1 u8
|
|
:4 unknownB:4 not yet decoded, used for DCS coding?
|
|
:2 channel_width:2 channel spacing, menu index value from 0-3
|
|
:1 reverse:1 reverse flag, 0=off, 1=on (reverses tx and rx freqs)
|
|
:1 txoff:1 transmitt off flag, 0=transmit , 1=do not transmit
|
|
1 u8
|
|
:1 talkaround:1 talkaround flag, 0=off, 1=on (bypasses repeater)
|
|
:1 compander:1 compander flag, 0=off, 1=on (turns on/off voice compander option)
|
|
:2 unknownC:2
|
|
:2 power:2 tx power setting, value range 0-2, 0=hi,1=med,2=lo
|
|
:2 duplex:2 duplex settings, 0=simplex,1= minus(-) offset, 2= plus (+) offset (see offset field)
|
|
1 u8
|
|
:4 unknownD:4
|
|
:2 rxtmode:2 rx tone mode, value range 0-2, 0=none, 1=CTCSS, 2=DCS (ctcss tone in field rxtone)
|
|
:2 txtmode:2 tx tone mode, value range 0-2, 0=none, 1=CTCSS, 3=DCS (ctcss tone in field txtone)
|
|
1 u8
|
|
:2 unknownE:2
|
|
:6 txtone:6 tx ctcss tone, menu index
|
|
1 u8
|
|
:2 unknownF:2
|
|
:6 rxtone:6 rx ctcss tone, menu index
|
|
1 u8 txcode ?, not used for ctcss
|
|
1 u8 rxcode ?, not used for ctcss
|
|
3 u8 unknownG[3]
|
|
7 char name[7] 7 byte char string for channel name
|
|
1 u8
|
|
:6 unknownH:6,
|
|
:2 busychannellockout:2 busy channel lockout option , 0=off, 1=repeater, 2=busy (lock out tx if channel busy)
|
|
4 u8 unknownI[4];
|
|
1 u8
|
|
:7 unknownJ:7
|
|
:1 scrambler:1 scrambler flag, 0=off, 1=on (turns on tyt scrambler option)
|
|
"""
|