Add support for MD380.

This commit is contained in:
Serge Vakulenko 2018-08-24 20:13:27 -07:00
parent 5d62415cfb
commit 19d169e936
5 changed files with 1361 additions and 11 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
*.o
*.hd
dmrconfig

View File

@ -4,8 +4,8 @@ VERSION = 1.0
CFLAGS = -g -O0 -Wall -Werror -DVERSION='"$(VERSION)"'
LDFLAGS = -g
OBJS = main.o util.o radio.o uv380.o
SRCS = main.c util.c radio.c uv380.c
OBJS = main.o util.o radio.o uv380.o md380.o
SRCS = main.c util.c radio.c uv380.c md380.c
LIBS =
# Mac OS X
@ -29,6 +29,7 @@ dmrconfig.linux: dmrconfig
###
main.o: main.c radio.h util.h
md380.o: md380.c radio.h util.h
radio.o: radio.c radio.h util.h
util.o: util.c util.h
uv380.o: uv380.c radio.h util.h

1339
md380.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -128,6 +128,10 @@ void radio_read_image(char *filename)
case 852533:
device = &radio_uv380;
break;
case 262144:
case 262709:
device = &radio_md380;
break;
default:
fprintf(stderr, "%s: Unrecognized file size %u bytes.\n",
filename, (int) st.st_size);

23
uv380.c
View File

@ -192,8 +192,8 @@ typedef struct {
//
// Byte 31
//
uint8_t dcdm_switch_dis : 1, // DCDM switch (inverted)
_unused11 : 3, // 0b111
uint8_t _unused11 : 3, // 0b111
dcdm_switch_dis : 1, // DCDM switch (inverted)
leader_ms : 1, // Leader/MS: Leader or MS
#define DCDM_LEADER 0
#define DCDM_MS 1
@ -671,6 +671,11 @@ static int have_channels(int mode)
//
static void print_tone(FILE *out, uint16_t data)
{
if (data == 0xffff) {
fprintf(out, "- ");
return;
}
unsigned tag = data >> 14;
unsigned a = (data >> 12) & 3;
unsigned b = (data >> 8) & 15;
@ -766,9 +771,9 @@ static void print_digital_channels(FILE *out, int verbose)
fprintf(out, "# 6) Scan list: - or index\n");
fprintf(out, "#\n");
}
fprintf(out, "Digital Name Receive Transmit Power Scan Sq Admit Cl Sl Group Cntct InCall");
fprintf(out, "Digital Name Receive Transmit Power Scan Sq Admit Color Slot Group Cntct InCall");
#if 1
fprintf(out, " TOT Dly RxRef TxRef AS RO LW VOX EmSys Privacy PN PCC EAA DCC DCDM LM");
fprintf(out, " TOT Dly RxRef TxRef AS RO LW VOX EmSys Privacy PN PCC EAA DCC DCDM");
#endif
fprintf(out, "\n");
for (i=0; i<NCHAN; i++) {
@ -786,7 +791,7 @@ static void print_digital_channels(FILE *out, int verbose)
// Group List
// Contact Name
// In Call Criteria
fprintf(out, "%-2d %1d ", ch->colorcode, ch->repeater_slot);
fprintf(out, "%-5d %-3d ", ch->colorcode, ch->repeater_slot);
if (ch->group_list_index == 0)
fprintf(out, "- ");
else
@ -826,9 +831,9 @@ static void print_digital_channels(FILE *out, int verbose)
fprintf(out, "%c ", "-+"[ch->data_call_conf]);
if (ch->dcdm_switch_dis)
fprintf(out, "- -");
fprintf(out, "-");
else
fprintf(out, "+ %s", ch->leader_ms ? "MS" : "Leader");
fprintf(out, "%s", ch->leader_ms ? "MS" : "Leader");
#endif
fprintf(out, "\n");
}
@ -1101,14 +1106,14 @@ static void uv380_read_image(FILE *img)
exit(-1);
}
switch (st.st_size) {
case 851968:
case MEMSZ:
// IMG file.
if (fread(&radio_mem[0], 1, MEMSZ, img) != MEMSZ) {
fprintf(stderr, "Error reading image data.\n");
exit(-1);
}
break;
case 852533:
case MEMSZ + 0x225 + 0x10:
// RTD file.
// Header 0x225 bytes and footer 0x10 bytes at 0x40225.
fseek(img, 0x225, SEEK_SET);