Move gd77 to a separate file.

This commit is contained in:
Serge Vakulenko 2018-10-04 19:51:10 -07:00
parent f5be27d8a7
commit 562c383225
4 changed files with 2400 additions and 62 deletions

View File

@ -6,7 +6,7 @@ UNAME = $(shell uname)
CFLAGS = -g -O -Wall -Werror -DVERSION='"$(VERSION).$(GITCOUNT)"'
LDFLAGS = -g
OBJS = main.o util.o radio.o dfu-libusb.o uv380.o md380.o rd5r.o hid.o
OBJS = main.o util.o radio.o dfu-libusb.o uv380.o md380.o rd5r.o gd77.o hid.o
LIBS = -lusb-1.0
# Linux
@ -39,6 +39,8 @@ dmrconfig.linux: dmrconfig
###
dfu-libusb.o: dfu-libusb.c util.h
dfu-windows.o: dfu-windows.c util.h
gd77.o: gd77.c radio.h util.h
hid.o: hid.c util.h
hid-libusb.o: hid-libusb.c util.h
hid-macos.o: hid-macos.c util.h
hid-windows.o: hid-windows.c util.h

View File

@ -5,7 +5,7 @@ GITCOUNT = $(shell git rev-list HEAD --count)
CFLAGS = -g -O -Wall -Werror -DVERSION='"$(VERSION).$(GITCOUNT)"'
LDFLAGS = -g -s
OBJS = main.o util.o radio.o dfu-windows.o uv380.o md380.o rd5r.o hid.o hid-windows.o
OBJS = main.o util.o radio.o dfu-windows.o uv380.o md380.o rd5r.o gd77.o hid.o hid-windows.o
LIBS = -lhid -lsetupapi
# Compiling Windows binary from Linux
@ -35,6 +35,8 @@ install: dmrconfig
###
dfu-libusb.o: dfu-libusb.c util.h
dfu-windows.o: dfu-windows.c util.h
gd77.o: gd77.c radio.h util.h
hid.o: hid.c util.h
hid-libusb.o: hid-libusb.c util.h
hid-macos.o: hid-macos.c util.h
hid-windows.o: hid-windows.c util.h

2394
gd77.c Normal file

File diff suppressed because it is too large Load Diff

60
rd5r.c
View File

@ -40,7 +40,6 @@
#define NGLISTS 64
#define NSCANL 250
#define NMESSAGES 32
//TODO: bitmaps for channels and zones
#define MEMSZ 0x20000
#define OFFSET_TIMESTMP 0x00088
@ -380,17 +379,6 @@ static void rd5r_download(radio_device_t *radio)
memcpy(&radio_mem[0], "BF-5R", 5);
}
//
// Radioddity GD-77: read memory image.
//
static void gd77_download(radio_device_t *radio)
{
download(radio);
// Add header.
memcpy(&radio_mem[0], "MD-760P", 7);
}
//
// Write memory image to the device.
//
@ -423,16 +411,6 @@ static int rd5r_is_compatible(radio_device_t *radio)
return strncmp("BF-5R", (char*)&radio_mem[0], 5) == 0;
}
static int gd77_is_compatible(radio_device_t *radio)
{
return strncmp("MD-760", (char*)&radio_mem[0], 7) == 0;
}
static int gd77old_is_compatible(radio_device_t *radio)
{
return strncmp("MD-760", (char*)&radio_mem[0], 6) == 0;
}
//
// Set name for a given zone.
//
@ -2361,41 +2339,3 @@ radio_device_t radio_rd5r = {
rd5r_parse_row,
rd5r_update_timestamp,
};
//
// Radioddity GD-77
//
radio_device_t radio_gd77 = {
"Radioddity GD-77",
gd77_download,
rd5r_upload,
gd77_is_compatible,
rd5r_read_image,
rd5r_save_image,
rd5r_print_version,
rd5r_print_config,
rd5r_verify_config,
rd5r_parse_parameter,
rd5r_parse_header,
rd5r_parse_row,
rd5r_update_timestamp,
};
//
// Radioddity GD-77, older versions up to 2.6.6
//
radio_device_t radio_gd77_old = {
"Radioddity GD-77 (old)",
gd77_download,
rd5r_upload,
gd77old_is_compatible,
rd5r_read_image,
rd5r_save_image,
rd5r_print_version,
rd5r_print_config,
rd5r_verify_config,
rd5r_parse_parameter,
rd5r_parse_header,
rd5r_parse_row,
rd5r_update_timestamp,
};