Remove global radio_progress
Change to function-specific counters
This commit is contained in:
parent
2a7c32924c
commit
cccbee30a8
2
dm1801.c
2
dm1801.c
@ -348,6 +348,7 @@ static void dm1801_print_version(radio_device_t *radio, FILE *out)
|
||||
static void download(radio_device_t *radio)
|
||||
{
|
||||
int bno;
|
||||
int radio_progress = 0;
|
||||
|
||||
// Read range 0x80...0x1ee5f.
|
||||
#define NBLK 989
|
||||
@ -390,6 +391,7 @@ static void dm1801_download(radio_device_t *radio)
|
||||
static void dm1801_upload(radio_device_t *radio, int cont_flag)
|
||||
{
|
||||
int bno;
|
||||
int radio_progress = 0;
|
||||
|
||||
// Write range 0x80...0x1ee5f.
|
||||
for (bno = 1; bno < NBLK; bno++) {
|
||||
|
2
gd77.c
2
gd77.c
@ -348,6 +348,7 @@ static void gd77_print_version(radio_device_t *radio, FILE *out)
|
||||
static void download(radio_device_t *radio)
|
||||
{
|
||||
int bno;
|
||||
int radio_progress = 0;
|
||||
|
||||
// Read range 0x80...0x1e29f.
|
||||
for (bno=1; bno<966; bno++) {
|
||||
@ -388,6 +389,7 @@ static void gd77_download(radio_device_t *radio)
|
||||
static void gd77_upload(radio_device_t *radio, int cont_flag)
|
||||
{
|
||||
int bno;
|
||||
int radio_progress = 0;
|
||||
|
||||
// Write range 0x80...0x1e29f.
|
||||
for (bno=1; bno<966; bno++) {
|
||||
|
2
md380.c
2
md380.c
@ -365,6 +365,7 @@ static void md380_print_version(radio_device_t *radio, FILE *out)
|
||||
static void md380_download(radio_device_t *radio)
|
||||
{
|
||||
int bno;
|
||||
int radio_progress = 0;
|
||||
|
||||
for (bno=0; bno<MEMSZ/1024; bno++) {
|
||||
dfu_read_block(bno, &radio_mem[bno*1024], 1024);
|
||||
@ -383,6 +384,7 @@ static void md380_download(radio_device_t *radio)
|
||||
static void md380_upload(radio_device_t *radio, int cont_flag)
|
||||
{
|
||||
int bno;
|
||||
int radio_progress = 0;
|
||||
|
||||
dfu_erase(0, MEMSZ);
|
||||
|
||||
|
3
radio.c
3
radio.c
@ -72,7 +72,6 @@ void set_active_device(radio_device_t* d) {
|
||||
}
|
||||
|
||||
unsigned char radio_mem [1024*1024*2]; // Radio memory contents, up to 2 Mbytes
|
||||
int radio_progress; // Read/write progress counter
|
||||
|
||||
//
|
||||
// Print a generic information about the device.
|
||||
@ -87,7 +86,6 @@ void radio_print_version(radio_device_t* dev, FILE *out)
|
||||
//
|
||||
void radio_download(radio_device_t* dev)
|
||||
{
|
||||
radio_progress = 0;
|
||||
if (! trace_flag) {
|
||||
fprintf(stderr, "Read device: ");
|
||||
fflush(stderr);
|
||||
@ -109,7 +107,6 @@ void radio_upload(radio_device_t* dev, int cont_flag)
|
||||
fprintf(stderr, "Incompatible image - cannot upload.\n");
|
||||
exit(-1);
|
||||
}
|
||||
radio_progress = 0;
|
||||
if (! trace_flag) {
|
||||
fprintf(stderr, "Write device: ");
|
||||
fflush(stderr);
|
||||
|
5
radio.h
5
radio.h
@ -81,8 +81,3 @@ extern unsigned char radio_mem[];
|
||||
// File descriptor of serial port with programming cable attached.
|
||||
//
|
||||
extern int radio_port;
|
||||
|
||||
//
|
||||
// Read/write progress counter.
|
||||
//
|
||||
extern int radio_progress;
|
||||
|
2
rd5r.c
2
rd5r.c
@ -345,6 +345,7 @@ static void rd5r_print_version(radio_device_t *radio, FILE *out)
|
||||
static void download(radio_device_t *radio)
|
||||
{
|
||||
int bno;
|
||||
int radio_progress = 0;
|
||||
|
||||
// Read range 0x80...0x1e29f.
|
||||
for (bno=1; bno<966; bno++) {
|
||||
@ -385,6 +386,7 @@ static void rd5r_download(radio_device_t *radio)
|
||||
static void rd5r_upload(radio_device_t *radio, int cont_flag)
|
||||
{
|
||||
int bno;
|
||||
int radio_progress = 0;
|
||||
|
||||
// Write range 0x80...0x1e29f.
|
||||
for (bno=1; bno<966; bno++) {
|
||||
|
4
uv380.c
4
uv380.c
@ -400,6 +400,7 @@ static void uv380_print_version(radio_device_t *radio, FILE *out)
|
||||
static void uv380_download(radio_device_t *radio)
|
||||
{
|
||||
int bno;
|
||||
int radio_progress = 0;
|
||||
|
||||
for (bno=0; bno<MEMSZ/1024; bno++) {
|
||||
dfu_read_block(bno, &radio_mem[bno*1024], 1024);
|
||||
@ -418,6 +419,7 @@ static void uv380_download(radio_device_t *radio)
|
||||
static void uv380_upload(radio_device_t *radio, int cont_flag)
|
||||
{
|
||||
int bno;
|
||||
int radio_progress = 0;
|
||||
|
||||
dfu_erase(0, MEMSZ);
|
||||
|
||||
@ -2490,7 +2492,7 @@ static void uv380_write_csv(radio_device_t *radio, FILE *csv)
|
||||
// Erase whole region.
|
||||
// Align finish to 64kbytes.
|
||||
//
|
||||
radio_progress = 0;
|
||||
int radio_progress = 0;
|
||||
if (! trace_flag) {
|
||||
fprintf(stderr, "Erase: ");
|
||||
fflush(stderr);
|
||||
|
Loading…
Reference in New Issue
Block a user