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 *.o
*.hd
dmrconfig dmrconfig

View File

@ -4,8 +4,8 @@ VERSION = 1.0
CFLAGS = -g -O0 -Wall -Werror -DVERSION='"$(VERSION)"' CFLAGS = -g -O0 -Wall -Werror -DVERSION='"$(VERSION)"'
LDFLAGS = -g LDFLAGS = -g
OBJS = main.o util.o radio.o uv380.o OBJS = main.o util.o radio.o uv380.o md380.o
SRCS = main.c util.c radio.c uv380.c SRCS = main.c util.c radio.c uv380.c md380.c
LIBS = LIBS =
# Mac OS X # Mac OS X
@ -29,6 +29,7 @@ dmrconfig.linux: dmrconfig
### ###
main.o: main.c radio.h util.h main.o: main.c radio.h util.h
md380.o: md380.c radio.h util.h
radio.o: radio.c radio.h util.h radio.o: radio.c radio.h util.h
util.o: util.c util.h util.o: util.c util.h
uv380.o: uv380.c radio.h 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: case 852533:
device = &radio_uv380; device = &radio_uv380;
break; break;
case 262144:
case 262709:
device = &radio_md380;
break;
default: default:
fprintf(stderr, "%s: Unrecognized file size %u bytes.\n", fprintf(stderr, "%s: Unrecognized file size %u bytes.\n",
filename, (int) st.st_size); filename, (int) st.st_size);

23
uv380.c
View File

@ -192,8 +192,8 @@ typedef struct {
// //
// Byte 31 // Byte 31
// //
uint8_t dcdm_switch_dis : 1, // DCDM switch (inverted) uint8_t _unused11 : 3, // 0b111
_unused11 : 3, // 0b111 dcdm_switch_dis : 1, // DCDM switch (inverted)
leader_ms : 1, // Leader/MS: Leader or MS leader_ms : 1, // Leader/MS: Leader or MS
#define DCDM_LEADER 0 #define DCDM_LEADER 0
#define DCDM_MS 1 #define DCDM_MS 1
@ -671,6 +671,11 @@ static int have_channels(int mode)
// //
static void print_tone(FILE *out, uint16_t data) static void print_tone(FILE *out, uint16_t data)
{ {
if (data == 0xffff) {
fprintf(out, "- ");
return;
}
unsigned tag = data >> 14; unsigned tag = data >> 14;
unsigned a = (data >> 12) & 3; unsigned a = (data >> 12) & 3;
unsigned b = (data >> 8) & 15; 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, "# 6) Scan list: - or index\n");
fprintf(out, "#\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 #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 #endif
fprintf(out, "\n"); fprintf(out, "\n");
for (i=0; i<NCHAN; i++) { for (i=0; i<NCHAN; i++) {
@ -786,7 +791,7 @@ static void print_digital_channels(FILE *out, int verbose)
// Group List // Group List
// Contact Name // Contact Name
// In Call Criteria // 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) if (ch->group_list_index == 0)
fprintf(out, "- "); fprintf(out, "- ");
else else
@ -826,9 +831,9 @@ static void print_digital_channels(FILE *out, int verbose)
fprintf(out, "%c ", "-+"[ch->data_call_conf]); fprintf(out, "%c ", "-+"[ch->data_call_conf]);
if (ch->dcdm_switch_dis) if (ch->dcdm_switch_dis)
fprintf(out, "- -"); fprintf(out, "-");
else else
fprintf(out, "+ %s", ch->leader_ms ? "MS" : "Leader"); fprintf(out, "%s", ch->leader_ms ? "MS" : "Leader");
#endif #endif
fprintf(out, "\n"); fprintf(out, "\n");
} }
@ -1101,14 +1106,14 @@ static void uv380_read_image(FILE *img)
exit(-1); exit(-1);
} }
switch (st.st_size) { switch (st.st_size) {
case 851968: case MEMSZ:
// IMG file. // IMG file.
if (fread(&radio_mem[0], 1, MEMSZ, img) != MEMSZ) { if (fread(&radio_mem[0], 1, MEMSZ, img) != MEMSZ) {
fprintf(stderr, "Error reading image data.\n"); fprintf(stderr, "Error reading image data.\n");
exit(-1); exit(-1);
} }
break; break;
case 852533: case MEMSZ + 0x225 + 0x10:
// RTD file. // RTD file.
// Header 0x225 bytes and footer 0x10 bytes at 0x40225. // Header 0x225 bytes and footer 0x10 bytes at 0x40225.
fseek(img, 0x225, SEEK_SET); fseek(img, 0x225, SEEK_SET);