summaryrefslogtreecommitdiff
path: root/device-functions.c
diff options
context:
space:
mode:
authorroot <root@fedora-arm.domain.avtechpulse.com>1999-12-31 19:35:32 -0500
committerroot <root@fedora-arm.domain.avtechpulse.com>1999-12-31 19:35:32 -0500
commit9f06b3419173ce1c0f0967676c9eea2915c28418 (patch)
treec59103940e6876381e47124a9a0dc798316f2213 /device-functions.c
parentc9b47b6f58017ce6a0ae48a454545edb4715ca7a (diff)
optimized flash writing when changing serial settings
Diffstat (limited to 'device-functions.c')
-rw-r--r--device-functions.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/device-functions.c b/device-functions.c
index 26d2a5f..0e5338a 100644
--- a/device-functions.c
+++ b/device-functions.c
@@ -4622,7 +4622,7 @@ void Main_update_shift_registers()
}
-int IO_Setup_RS232(int baud, char parity, char stopbits, char databits, char hardhand, char echo)
+int IO_Setup_RS232(int baud, char parity, char stopbits, char databits, char hardhand, char echo, gboolean update_flash)
{
// debugging
printf ("baud: %d, parity %d, stop bits %d, data bits %d, handshaking %d, echo %d\n\r",
@@ -4643,24 +4643,13 @@ int IO_Setup_RS232(int baud, char parity, char stopbits, char databits, char har
globals.Flash.hardhand = hardhand;
globals.Flash.echo = echo;
- int eprom_loc = (char *) &(globals.Flash.baud) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.baud));
-
- eprom_loc = (char *) &(globals.Flash.parity) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.parity));
-
- eprom_loc = (char *) &(globals.Flash.stopbits) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.stopbits));
-
- eprom_loc = (char *) &(globals.Flash.databits) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.databits));
-
- eprom_loc = (char *) &(globals.Flash.hardhand) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.hardhand));
-
- eprom_loc = (char *) &(globals.Flash.echo) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.echo));
+ if (update_flash) {
+ int size = sizeof(globals.Flash.baud) + sizeof(globals.Flash.parity) + sizeof(globals.Flash.stopbits) +
+ sizeof(globals.Flash.databits) + sizeof(globals.Flash.hardhand) + sizeof(globals.Flash.echo);
+ int eprom_loc = (char *) &(globals.Flash.baud) - (char *) &(globals.Flash.flash_start);
+ writeUserBlock(&globals.Flash, eprom_loc, size);
+ }
return OK;
} else {
return HardwareError;