altos: Write xdata versions of memory functions 1.0.9.1
authorKeith Packard <keithp@keithp.com>
Fri, 7 Oct 2011 15:53:09 +0000 (09:53 -0600)
committerKeith Packard <keithp@keithp.com>
Fri, 7 Oct 2011 15:54:32 +0000 (09:54 -0600)
These are significantly smaller than the general pointer versions from
libc on the cc1111.

Signed-off-by: Keith Packard <keithp@keithp.com>
Conflicts:

src/Makefile.proto
src/cc1111/ao_adc.c
src/cc1111/ao_packet_master.c
src/core/ao.h

Fix up the new makefiles

25 files changed:
src/cc1111/ao_adc.c
src/cc1111/ao_arch.h
src/cc1111/ao_intflash.c
src/cc1111/ao_packet.c
src/cc1111/ao_packet_master.c
src/cc1111/ao_packet_slave.c
src/core/ao.h
src/core/ao_cmd.c
src/core/ao_config.c
src/core/ao_ee_fake.c
src/core/ao_gps_report.c
src/core/ao_host.h
src/core/ao_monitor.c
src/core/ao_telemetry.c
src/drivers/ao_25lc1024.c
src/drivers/ao_at45db161d.c
src/drivers/ao_gps_skytraq.c
src/product/Makefile.telebt
src/product/Makefile.teledongle
src/product/Makefile.telelaunch
src/product/Makefile.telemetrum
src/product/Makefile.telemini
src/product/Makefile.telenano
src/test/ao_flight_test.c
src/tidongle/Makefile

index 6aa6e0185675ae2bf03ad2e82182bb871b1cda0e..1688eceb8f6c84e43fad6fa71e4e5784ac2c9def 100644 (file)
@@ -46,7 +46,7 @@ ao_adc_get(__xdata struct ao_adc *packet)
 #else
        uint8_t i = ao_adc_ring_prev(ao_adc_head);
 #endif
 #else
        uint8_t i = ao_adc_ring_prev(ao_adc_head);
 #endif
-       memcpy(packet, &ao_adc_ring[i], sizeof (struct ao_adc));
+       ao_xmemcpy(packet, &ao_adc_ring[i], sizeof (struct ao_adc));
 }
 
 void
 }
 
 void
index 8a41791fea326d58c3421d1688c325ef5a9d6d7a..02e36189a46db634695f24432db10d12c4d04544 100644 (file)
@@ -204,4 +204,21 @@ struct ao_adc {
 
 #define AO_ADC_RING    32
 
 
 #define AO_ADC_RING    32
 
+/* ao_string.c */
+
+void
+_ao_xmemcpy(__xdata uint8_t *dst, __xdata uint8_t *src, uint8_t count);
+
+#define ao_xmemcpy(d,s,c) _ao_xmemcpy((__xdata uint8_t *) (d), (__xdata uint8_t *) (s), (c))
+
+void
+_ao_xmemset(__xdata uint8_t *dst, uint8_t value, uint8_t count);
+
+#define ao_xmemset(d,v,c) _ao_xmemset((__xdata uint8_t *) (d), (v), (c))
+
+int8_t
+_ao_xmemcmp(__xdata uint8_t *a, __xdata uint8_t *b, uint8_t count);
+
+#define ao_xmemcmp(d,s,c) _ao_xmemcmp((__xdata uint8_t *) (d), (__xdata uint8_t *) (s), (c))
+
 #endif /* _AO_ARCH_H_ */
 #endif /* _AO_ARCH_H_ */
index d76d954e16a071f2cf7f924fd8ac676964f0673e..632e2a850caa17e8b148717b4200caf08c6aaa54 100644 (file)
@@ -180,7 +180,7 @@ ao_storage_device_read(uint32_t pos, __xdata void *d, uint16_t len) __reentrant
 {
        if (pos >= ao_storage_total || pos + len > ao_storage_total)
                return 0;
 {
        if (pos >= ao_storage_total || pos + len > ao_storage_total)
                return 0;
-       memcpy(d, ao_intflash+pos, len);
+       ao_xmemcpy(d, ao_intflash+pos, len);
        return 1;
 }
 
        return 1;
 }
 
index f627e02b4022ee8004fd5400a4eb20d0d0ed60d8..37ba92e04c4233a5036ee98fe861249283b06449 100644 (file)
@@ -35,7 +35,7 @@ ao_packet_send(void)
        ao_led_on(AO_LED_RED);
        /* If any tx data is pending then copy it into the tx packet */
        if (ao_packet_tx_used && ao_tx_packet.len == 0) {
        ao_led_on(AO_LED_RED);
        /* If any tx data is pending then copy it into the tx packet */
        if (ao_packet_tx_used && ao_tx_packet.len == 0) {
-               memcpy(&ao_tx_packet.d, tx_data, ao_packet_tx_used);
+               ao_xmemcpy(&ao_tx_packet.d, tx_data, ao_packet_tx_used);
                ao_tx_packet.len = ao_packet_tx_used;
                ao_tx_packet.seq++;
                ao_packet_tx_used = 0;
                ao_tx_packet.len = ao_packet_tx_used;
                ao_tx_packet.seq++;
                ao_packet_tx_used = 0;
@@ -80,7 +80,7 @@ ao_packet_recv(void)
                        /* Copy data to the receive data buffer and set up the
                         * offsets
                         */
                        /* Copy data to the receive data buffer and set up the
                         * offsets
                         */
-                       memcpy(rx_data, ao_rx_packet.packet.d, ao_rx_packet.packet.len);
+                       ao_xmemcpy(rx_data, ao_rx_packet.packet.d, ao_rx_packet.packet.len);
                        ao_packet_rx_used = 0;
                        ao_packet_rx_len = ao_rx_packet.packet.len;
 
                        ao_packet_rx_used = 0;
                        ao_packet_rx_len = ao_rx_packet.packet.len;
 
index 0d0be30ea2faa5f02e2e320a99cf7224f9ff9068..ab19f979a3b0e4340783df487da34caad52c3cbc 100644 (file)
@@ -81,7 +81,7 @@ ao_packet_master(void)
        ao_packet_master_delay = AO_PACKET_MASTER_DELAY_SHORT;
        while (ao_packet_enable) {
                uint8_t r;
        ao_packet_master_delay = AO_PACKET_MASTER_DELAY_SHORT;
        while (ao_packet_enable) {
                uint8_t r;
-               memcpy(ao_tx_packet.callsign, ao_config.callsign, AO_MAX_CALLSIGN);
+               ao_xmemcpy(ao_tx_packet.callsign, ao_config.callsign, AO_MAX_CALLSIGN);
                ao_packet_send();
                if (ao_tx_packet.len)
                        ao_packet_master_busy();
                ao_packet_send();
                if (ao_tx_packet.len)
                        ao_packet_master_busy();
index d7cafa680d5a7a470de654ae3eae73ed8743afd6..fd5d443efa52a71fc92f5ec13a5529ced53aba6d 100644 (file)
@@ -24,7 +24,7 @@ ao_packet_slave(void)
        ao_tx_packet.len = AO_PACKET_SYN;
        while (ao_packet_enable) {
                if (ao_packet_recv()) {
        ao_tx_packet.len = AO_PACKET_SYN;
        while (ao_packet_enable) {
                if (ao_packet_recv()) {
-                       memcpy(&ao_tx_packet.callsign, &ao_rx_packet.packet.callsign, AO_MAX_CALLSIGN);
+                       ao_xmemcpy(&ao_tx_packet.callsign, &ao_rx_packet.packet.callsign, AO_MAX_CALLSIGN);
 #if HAS_FLIGHT
                        ao_flight_force_idle = TRUE;
 #endif
 #if HAS_FLIGHT
                        ao_flight_force_idle = TRUE;
 #endif
index 04610fea4324de241af45de38527eea21c5e8e87..c04747295e32f826cb90ee499698d385164154a2 100644 (file)
@@ -1817,4 +1817,10 @@ ao_log_single(void);
 
 #define AO_TELEPYRO_NUM_ADC    9
 
 
 #define AO_TELEPYRO_NUM_ADC    9
 
+#ifndef ao_xmemcpy
+#define ao_xmemcpy(d,s,c) memcpy(d,s,c)
+#define ao_xmemset(d,v,c) memset(d,v,c)
+#define ao_xmemcmp(d,s,c) memcmp(d,s,c)
+#endif
+
 #endif /* _AO_H_ */
 #endif /* _AO_H_ */
index 2b64b8ca210efe871b6eaadd4f14b37d6f281707..0c902f6be935368842f4e152bd062c295a90c182 100644 (file)
@@ -265,8 +265,8 @@ help(void)
                cs = ao_cmds[cmds];
                for (cmd = 0; cs[cmd].func; cmd++)
                        printf("%-45s %s\n",
                cs = ao_cmds[cmds];
                for (cmd = 0; cs[cmd].func; cmd++)
                        printf("%-45s %s\n",
-                               cs[cmd].help,
-                               cs[cmd].help+1+strlen(cs[cmd].help));
+                              cs[cmd].help,
+                              cs[cmd].help+1+strlen(cs[cmd].help));
        }
 }
 
        }
 }
 
index a653bed2cead5d2dd32da3e19541cbd1e94bc950..08cc79b16dfca14086c763264117b1e661db8a5e 100644 (file)
@@ -78,8 +78,8 @@ _ao_config_get(void)
                /* Version 0 stuff */
                ao_config.main_deploy = AO_CONFIG_DEFAULT_MAIN_DEPLOY;
                ao_config.radio_channel = AO_CONFIG_DEFAULT_RADIO_CHANNEL;
                /* Version 0 stuff */
                ao_config.main_deploy = AO_CONFIG_DEFAULT_MAIN_DEPLOY;
                ao_config.radio_channel = AO_CONFIG_DEFAULT_RADIO_CHANNEL;
-               memset(&ao_config.callsign, '\0', sizeof (ao_config.callsign));
-               memcpy(&ao_config.callsign, AO_CONFIG_DEFAULT_CALLSIGN,
+               ao_xmemset(&ao_config.callsign, '\0', sizeof (ao_config.callsign));
+               ao_xmemcpy(&ao_config.callsign, AO_CONFIG_DEFAULT_CALLSIGN,
                       sizeof(AO_CONFIG_DEFAULT_CALLSIGN) - 1);
                ao_config_dirty = 1;
        }
                       sizeof(AO_CONFIG_DEFAULT_CALLSIGN) - 1);
                ao_config_dirty = 1;
        }
@@ -148,7 +148,7 @@ ao_config_callsign_set(void) __reentrant
        uint8_t c;
        static __xdata char callsign[AO_MAX_CALLSIGN + 1];
 
        uint8_t c;
        static __xdata char callsign[AO_MAX_CALLSIGN + 1];
 
-       memset(callsign, '\0', sizeof callsign);
+       ao_xmemset(callsign, '\0', sizeof callsign);
        ao_cmd_white();
        c = 0;
        while (ao_cmd_lex_c != '\n') {
        ao_cmd_white();
        c = 0;
        while (ao_cmd_lex_c != '\n') {
@@ -161,7 +161,7 @@ ao_config_callsign_set(void) __reentrant
        if (ao_cmd_status != ao_cmd_success)
                return;
        _ao_config_edit_start();
        if (ao_cmd_status != ao_cmd_success)
                return;
        _ao_config_edit_start();
-       memcpy(&ao_config.callsign, &callsign,
+       ao_xmemcpy(&ao_config.callsign, &callsign,
               AO_MAX_CALLSIGN + 1);
        _ao_config_edit_finish();
 }
               AO_MAX_CALLSIGN + 1);
        _ao_config_edit_finish();
 }
@@ -535,7 +535,8 @@ ao_config_help(void) __reentrant
        for (cmd = 0; ao_config_vars[cmd].str != NULL; cmd++)
                printf("%-20s %s\n",
                       ao_config_vars[cmd].str,
        for (cmd = 0; ao_config_vars[cmd].str != NULL; cmd++)
                printf("%-20s %s\n",
                       ao_config_vars[cmd].str,
-                      ao_config_vars[cmd].str+1+strlen(ao_config_vars[cmd].str));
+                      ao_config_vars[cmd].str+1+
+                      strlen(ao_config_vars[cmd].str));
 }
 
 static void
 }
 
 static void
index b0c1d61e7b66123c46a5e73757845efbf128194a..7fcfcab051340df4edb4b9556919da2a2558ce35 100644 (file)
@@ -32,6 +32,6 @@ ao_ee_write_config(uint8_t *buf, uint16_t len) __reentrant
 uint8_t
 ao_ee_read_config(uint8_t *buf, uint16_t len) __reentrant
 {
 uint8_t
 ao_ee_read_config(uint8_t *buf, uint16_t len) __reentrant
 {
-       memset(buf, '\0', len);
+       ao_xmemset(buf, '\0', len);
        return 1;
 }
        return 1;
 }
index e57f87443c2bb8debb6f3ca0d346910283767ee7..c52ef6219ed2afa1e0b3e0cdbd6d9e9256f14438 100644 (file)
@@ -27,7 +27,7 @@ ao_gps_report(void)
        for (;;) {
                ao_sleep(&ao_gps_data);
                ao_mutex_get(&ao_gps_mutex);
        for (;;) {
                ao_sleep(&ao_gps_data);
                ao_mutex_get(&ao_gps_mutex);
-               memcpy(&gps_data, &ao_gps_data, sizeof (ao_gps_data));
+               ao_xmemcpy(&gps_data, &ao_gps_data, sizeof (ao_gps_data));
                ao_mutex_put(&ao_gps_mutex);
 
                if (!(gps_data.flags & AO_GPS_VALID))
                ao_mutex_put(&ao_gps_mutex);
 
                if (!(gps_data.flags & AO_GPS_VALID))
@@ -72,7 +72,7 @@ ao_gps_tracking_report(void)
                ao_sleep(&ao_gps_tracking_data);
                ao_mutex_get(&ao_gps_mutex);
                gps_log.tick = ao_gps_tick;
                ao_sleep(&ao_gps_tracking_data);
                ao_mutex_get(&ao_gps_mutex);
                gps_log.tick = ao_gps_tick;
-               memcpy(&gps_tracking_data, &ao_gps_tracking_data, sizeof (ao_gps_tracking_data));
+               ao_xmemcpy(&gps_tracking_data, &ao_gps_tracking_data, sizeof (ao_gps_tracking_data));
                ao_mutex_put(&ao_gps_mutex);
 
                if (!(n = gps_tracking_data.channels))
                ao_mutex_put(&ao_gps_mutex);
 
                if (!(n = gps_tracking_data.channels))
index 65c25fe53d619c89492c10abddf4658b9d276487..f2b2f0c974003ba0e68d5cc9e1ecdfeeb22a1479 100644 (file)
@@ -125,3 +125,7 @@ struct ao_config {
 #define ao_config_get()
 
 struct ao_config ao_config = { 250, 16000 };
 #define ao_config_get()
 
 struct ao_config ao_config = { 250, 16000 };
+
+#define ao_xmemcpy(d,s,c) memcpy(d,s,c)
+#define ao_xmemset(d,v,c) memset(d,v,c)
+#define ao_xmemcmp(d,s,c) memcmp(d,s,c)
index 56d7604d7793c3d743f23904b491d5b7125d2109..1a8bb52a29fdb1467ad8799c0008f18c52867adf 100644 (file)
@@ -94,7 +94,7 @@ ao_monitor_put(void)
 
                        /* Typical RSSI offset for 38.4kBaud at 433 MHz is 74 */
                        rssi = (int16_t) (recv_orig.rssi >> 1) - 74;
 
                        /* Typical RSSI offset for 38.4kBaud at 433 MHz is 74 */
                        rssi = (int16_t) (recv_orig.rssi >> 1) - 74;
-                       memcpy(callsign, recv_orig.telemetry_orig.callsign, AO_MAX_CALLSIGN);
+                       ao_xmemcpy(callsign, recv_orig.telemetry_orig.callsign, AO_MAX_CALLSIGN);
                        if (state > ao_flight_invalid)
                                state = ao_flight_invalid;
                        if (recv_orig.status & PKT_APPEND_STATUS_1_CRC_OK) {
                        if (state > ao_flight_invalid)
                                state = ao_flight_invalid;
                        if (recv_orig.status & PKT_APPEND_STATUS_1_CRC_OK) {
@@ -171,7 +171,7 @@ ao_monitor_put(void)
 
                        /* Typical RSSI offset for 38.4kBaud at 433 MHz is 74 */
                        rssi = (int16_t) (recv_tiny.rssi >> 1) - 74;
 
                        /* Typical RSSI offset for 38.4kBaud at 433 MHz is 74 */
                        rssi = (int16_t) (recv_tiny.rssi >> 1) - 74;
-                       memcpy(callsign, recv_tiny.telemetry_tiny.callsign, AO_MAX_CALLSIGN);
+                       ao_xmemcpy(callsign, recv_tiny.telemetry_tiny.callsign, AO_MAX_CALLSIGN);
                        if (state > ao_flight_invalid)
                                state = ao_flight_invalid;
                        if (recv_tiny.status & PKT_APPEND_STATUS_1_CRC_OK) {
                        if (state > ao_flight_invalid)
                                state = ao_flight_invalid;
                        if (recv_tiny.status & PKT_APPEND_STATUS_1_CRC_OK) {
index 26e4e2a0e39530bc43997a4841f5790d8107b88e..95e53917152c176c6dabc9067ab8ef659a7aa1e3 100644 (file)
@@ -131,10 +131,10 @@ ao_send_configuration(void)
                telemetry.configuration.apogee_delay = ao_config.apogee_delay;
                telemetry.configuration.main_deploy = ao_config.main_deploy;
                telemetry.configuration.flight_log_max = ao_config.flight_log_max >> 10;
                telemetry.configuration.apogee_delay = ao_config.apogee_delay;
                telemetry.configuration.main_deploy = ao_config.main_deploy;
                telemetry.configuration.flight_log_max = ao_config.flight_log_max >> 10;
-               memcpy (telemetry.configuration.callsign,
+               ao_xmemcpy (telemetry.configuration.callsign,
                        ao_config.callsign,
                        AO_MAX_CALLSIGN);
                        ao_config.callsign,
                        AO_MAX_CALLSIGN);
-               memcpy (telemetry.configuration.version,
+               ao_xmemcpy (telemetry.configuration.version,
                        ao_version,
                        AO_MAX_VERSION);
                ao_radio_send(&telemetry, sizeof (telemetry));
                        ao_version,
                        AO_MAX_VERSION);
                ao_radio_send(&telemetry, sizeof (telemetry));
@@ -150,7 +150,7 @@ ao_send_location(void)
        {
                telemetry.generic.type = AO_TELEMETRY_LOCATION;
                ao_mutex_get(&ao_gps_mutex);
        {
                telemetry.generic.type = AO_TELEMETRY_LOCATION;
                ao_mutex_get(&ao_gps_mutex);
-               memcpy(&telemetry.location.flags,
+               ao_xmemcpy(&telemetry.location.flags,
                       &ao_gps_data.flags,
                       26);
                ao_mutex_put(&ao_gps_mutex);
                       &ao_gps_data.flags,
                       26);
                ao_mutex_put(&ao_gps_mutex);
@@ -167,7 +167,7 @@ ao_send_satellite(void)
                telemetry.generic.type = AO_TELEMETRY_SATELLITE;
                ao_mutex_get(&ao_gps_mutex);
                telemetry.satellite.channels = ao_gps_tracking_data.channels;
                telemetry.generic.type = AO_TELEMETRY_SATELLITE;
                ao_mutex_get(&ao_gps_mutex);
                telemetry.satellite.channels = ao_gps_tracking_data.channels;
-               memcpy(&telemetry.satellite.sats,
+               ao_xmemcpy(&telemetry.satellite.sats,
                       &ao_gps_tracking_data.sats,
                       AO_MAX_GPS_TRACKING * sizeof (struct ao_telemetry_satellite_info));
                ao_mutex_put(&ao_gps_mutex);
                       &ao_gps_tracking_data.sats,
                       AO_MAX_GPS_TRACKING * sizeof (struct ao_telemetry_satellite_info));
                ao_mutex_put(&ao_gps_mutex);
@@ -187,7 +187,7 @@ ao_send_companion(void)
                telemetry.companion.update_period = ao_companion_setup.update_period;
                telemetry.companion.channels = ao_companion_setup.channels;
                ao_mutex_get(&ao_companion_mutex);
                telemetry.companion.update_period = ao_companion_setup.update_period;
                telemetry.companion.channels = ao_companion_setup.channels;
                ao_mutex_get(&ao_companion_mutex);
-               memcpy(&telemetry.companion.companion_data,
+               ao_xmemcpy(&telemetry.companion.companion_data,
                       ao_companion_data,
                       ao_companion_setup.channels * 2);
                ao_mutex_put(&ao_companion_mutex);
                       ao_companion_data,
                       ao_companion_setup.channels * 2);
                ao_mutex_put(&ao_companion_mutex);
index 738f8ce6094efb4543ca976c35146091afcd9292..2d047a44bf7b254471fe194e9cbfb66ff70fb228 100644 (file)
@@ -167,7 +167,7 @@ ao_storage_device_write(uint32_t pos, __xdata void *buf, uint16_t len) __reentra
                        ao_ee_flush_internal();
                        ao_ee_block = block;
                }
                        ao_ee_flush_internal();
                        ao_ee_block = block;
                }
-               memcpy(ao_ee_data + (uint16_t) (pos & 0xff), buf, len);
+               ao_xmemcpy(ao_ee_data + (uint16_t) (pos & 0xff), buf, len);
                ao_ee_block_dirty = 1;
        } ao_mutex_put(&ao_ee_mutex);
        return 1;
                ao_ee_block_dirty = 1;
        } ao_mutex_put(&ao_ee_mutex);
        return 1;
@@ -181,7 +181,7 @@ ao_storage_device_read(uint32_t pos, __xdata void *buf, uint16_t len) __reentran
        /* Transfer the data */
        ao_mutex_get(&ao_ee_mutex); {
                ao_ee_fill(block);
        /* Transfer the data */
        ao_mutex_get(&ao_ee_mutex); {
                ao_ee_fill(block);
-               memcpy(buf, ao_ee_data + (uint16_t) (pos & 0xff), len);
+               ao_xmemcpy(buf, ao_ee_data + (uint16_t) (pos & 0xff), len);
        } ao_mutex_put(&ao_ee_mutex);
        return 1;
 }
        } ao_mutex_put(&ao_ee_mutex);
        return 1;
 }
@@ -200,7 +200,7 @@ ao_storage_erase(uint32_t pos) __reentrant
        ao_mutex_get(&ao_ee_mutex); {
                ao_ee_flush_internal();
                ao_ee_block = (uint16_t) (pos >> EE_BLOCK_SHIFT);
        ao_mutex_get(&ao_ee_mutex); {
                ao_ee_flush_internal();
                ao_ee_block = (uint16_t) (pos >> EE_BLOCK_SHIFT);
-               memset(ao_ee_data, 0xff, EE_BLOCK_SIZE);
+               ao_xmemset(ao_ee_data, 0xff, EE_BLOCK_SIZE);
                ao_ee_block_dirty = 1;
        } ao_mutex_put(&ao_ee_mutex);
        return 1;
                ao_ee_block_dirty = 1;
        } ao_mutex_put(&ao_ee_mutex);
        return 1;
index aee9877ac2b52887e293563c05f25f67c9774215..6cd689e5440b253df6288918a4492cee34117922 100644 (file)
@@ -245,7 +245,7 @@ ao_storage_device_write(uint32_t pos, __xdata void *buf, uint16_t len) __reentra
                        ao_flash_flush_internal();
                        ao_flash_block = block;
                }
                        ao_flash_flush_internal();
                        ao_flash_block = block;
                }
-               memcpy(ao_flash_data + (uint16_t) (pos & ao_flash_block_mask),
+               ao_xmemcpy(ao_flash_data + (uint16_t) (pos & ao_flash_block_mask),
                       buf,
                       len);
                ao_flash_block_dirty = 1;
                       buf,
                       len);
                ao_flash_block_dirty = 1;
@@ -261,7 +261,7 @@ ao_storage_device_read(uint32_t pos, __xdata void *buf, uint16_t len) __reentran
        /* Transfer the data */
        ao_mutex_get(&ao_flash_mutex); {
                ao_flash_fill(block);
        /* Transfer the data */
        ao_mutex_get(&ao_flash_mutex); {
                ao_flash_fill(block);
-               memcpy(buf,
+               ao_xmemcpy(buf,
                       ao_flash_data + (uint16_t) (pos & ao_flash_block_mask),
                       len);
        } ao_mutex_put(&ao_flash_mutex);
                       ao_flash_data + (uint16_t) (pos & ao_flash_block_mask),
                       len);
        } ao_mutex_put(&ao_flash_mutex);
@@ -282,7 +282,7 @@ ao_storage_erase(uint32_t pos) __reentrant
        ao_mutex_get(&ao_flash_mutex); {
                ao_flash_flush_internal();
                ao_flash_block = (uint16_t) (pos >> ao_flash_block_shift);
        ao_mutex_get(&ao_flash_mutex); {
                ao_flash_flush_internal();
                ao_flash_block = (uint16_t) (pos >> ao_flash_block_shift);
-               memset(ao_flash_data, 0xff, ao_flash_block_size);
+               ao_xmemset(ao_flash_data, 0xff, ao_flash_block_size);
                ao_flash_block_dirty = 1;
        } ao_mutex_put(&ao_flash_mutex);
        return 1;
                ao_flash_block_dirty = 1;
        } ao_mutex_put(&ao_flash_mutex);
        return 1;
index 7ac269469d31c2bc90c42c6d92c0c9b5adb4b95e..6e65d65130e3031903c0c7101e495de2d2b580db 100644 (file)
@@ -265,7 +265,7 @@ ao_nmea_gga()
        if (!ao_gps_error) {
                ao_mutex_get(&ao_gps_mutex);
                ao_gps_tick = ao_gps_next_tick;
        if (!ao_gps_error) {
                ao_mutex_get(&ao_gps_mutex);
                ao_gps_tick = ao_gps_next_tick;
-               memcpy(&ao_gps_data, &ao_gps_next, sizeof (ao_gps_data));
+               ao_xmemcpy(&ao_gps_data, &ao_gps_next, sizeof (ao_gps_data));
                ao_mutex_put(&ao_gps_mutex);
                ao_wakeup(&ao_gps_data);
        }
                ao_mutex_put(&ao_gps_mutex);
                ao_wakeup(&ao_gps_data);
        }
@@ -327,7 +327,7 @@ ao_nmea_gsv(void)
                ao_gps_tracking_next.channels = 0;
        else if (done) {
                ao_mutex_get(&ao_gps_mutex);
                ao_gps_tracking_next.channels = 0;
        else if (done) {
                ao_mutex_get(&ao_gps_mutex);
-               memcpy(&ao_gps_tracking_data, &ao_gps_tracking_next,
+               ao_xmemcpy(&ao_gps_tracking_data, &ao_gps_tracking_next,
                       sizeof(ao_gps_tracking_data));
                ao_mutex_put(&ao_gps_mutex);
                ao_wakeup(&ao_gps_tracking_data);
                       sizeof(ao_gps_tracking_data));
                ao_mutex_put(&ao_gps_mutex);
                ao_wakeup(&ao_gps_tracking_data);
index 46c87db0865782f393497c0baa35296d3badc552..8f7c74296e8042646457bbdfd7d1ea556ad2b339 100644 (file)
@@ -41,6 +41,7 @@ CC1111_SRC = \
        ao_radio_cmac.c \
        ao_romconfig.c \
        ao_serial.c \
        ao_radio_cmac.c \
        ao_romconfig.c \
        ao_serial.c \
+       ao_string.c \
        ao_timer.c \
        ao_usb.c \
        _bp.c
        ao_timer.c \
        ao_usb.c \
        _bp.c
index 56182b8494f7a357801e68ac3bd5400e6a8f1cf4..c1b422c06633e6275329188d633912921bb926df 100644 (file)
@@ -43,6 +43,7 @@ CC1111_SRC = \
        ao_radio.c \
        ao_radio_cmac.c \
        ao_romconfig.c \
        ao_radio.c \
        ao_radio_cmac.c \
        ao_romconfig.c \
+       ao_string.c \
        ao_timer.c \
        ao_usb.c \
        _bp.c
        ao_timer.c \
        ao_usb.c \
        _bp.c
index 5da42e4622c8db57218ffa5ed1fd4bee270c1d48..b40f61a24c00718dd69fdd8dd89fde9252879a20 100644 (file)
@@ -45,6 +45,7 @@ CC1111_SRC = \
        ao_romconfig.c \
        ao_serial.c \
        ao_spi.c \
        ao_romconfig.c \
        ao_serial.c \
        ao_spi.c \
+       ao_string.c \
        ao_timer.c \
        ao_usb.c \
        _bp.c
        ao_timer.c \
        ao_usb.c \
        _bp.c
index 2759ac52c8ac3c6fa78879cda8bc25b5cfdaf5e3..4f4195a9e23acf9a96b3954da2e0a9a91096047a 100644 (file)
@@ -54,6 +54,7 @@ CC1111_SRC = \
        ao_radio.c \
        ao_romconfig.c \
        ao_serial.c \
        ao_radio.c \
        ao_romconfig.c \
        ao_serial.c \
+       ao_string.c \
        ao_spi.c \
        ao_timer.c \
        ao_usb.c \
        ao_spi.c \
        ao_timer.c \
        ao_usb.c \
index 7f2518978651246e6b5fa6421d2ea63d0b62d750..9f90b01f84a2226cb0296b17d2c199dc7dd9be94 100644 (file)
@@ -45,6 +45,7 @@ CC1111_SRC = \
        ao_packet_slave.c \
        ao_radio.c \
        ao_romconfig.c \
        ao_packet_slave.c \
        ao_radio.c \
        ao_romconfig.c \
+       ao_string.c \
        ao_timer.c \
        _bp.c
 
        ao_timer.c \
        _bp.c
 
index c47e95ff4fee68306358b9b01062fd888f60791b..eff3ea970c6ca0909057f5906b9b7e1fcdd28385 100644 (file)
@@ -44,6 +44,7 @@ CC1111_SRC = \
        ao_packet_slave.c \
        ao_radio.c \
        ao_romconfig.c \
        ao_packet_slave.c \
        ao_radio.c \
        ao_romconfig.c \
+       ao_string.c \
        ao_timer.c \
        _bp.c
 
        ao_timer.c \
        _bp.c
 
index 56733c891a9dd3dc8020452d7c2dccda625aa821..921d44e7264566eb1bc22d2d3128c228be23973e 100644 (file)
@@ -173,6 +173,10 @@ struct ao_cmds {
        const char      *help;
 };
 
        const char      *help;
 };
 
+#define ao_xmemcpy(d,s,c) memcpy(d,s,c)
+#define ao_xmemset(d,v,c) memset(d,v,c)
+#define ao_xmemcmp(d,s,c) memcmp(d,s,c)
+
 #include "ao_convert.c"
 
 struct ao_config {
 #include "ao_convert.c"
 
 struct ao_config {
@@ -542,7 +546,7 @@ ao_sleep(void *wchan)
                                        ao_flight_started = 1;
                                }
                        } else if (nword == 2 && strcmp(words[0], "TELEM") == 0) {
                                        ao_flight_started = 1;
                                }
                        } else if (nword == 2 && strcmp(words[0], "TELEM") == 0) {
-                               char    *hex = words[1];
+                               __xdata char    *hex = words[1];
                                char    elt[3];
                                int     i, len;
                                uint8_t sum;
                                char    elt[3];
                                int     i, len;
                                uint8_t sum;
@@ -574,7 +578,7 @@ ao_sleep(void *wchan)
                                        continue;
                                }
                                if (len == 36) {
                                        continue;
                                }
                                if (len == 36) {
-                                       memcpy(&telem, bytes + 1, 32);
+                                       ao_xmemcpy(&telem, bytes + 1, 32);
                                        tick = telem.generic.tick;
                                        switch (telem.generic.type) {
                                        case AO_TELEMETRY_SENSOR_TELEMETRUM:
                                        tick = telem.generic.tick;
                                        switch (telem.generic.type) {
                                        case AO_TELEMETRY_SENSOR_TELEMETRUM:
index 057e420b569989897a8c12720c0d402566e8f0e8..58b9d7350117fd7ac9b3b69f4cb850b9397dfaae 100644 (file)
@@ -38,6 +38,7 @@ CC1111_SRC = \
        ao_radio.c \
        ao_radio_cmac.c \
        ao_romconfig.c \
        ao_radio.c \
        ao_radio_cmac.c \
        ao_romconfig.c \
+       ao_string.c \
        ao_timer.c \
        ao_usb.c \
        _bp.c
        ao_timer.c \
        ao_usb.c \
        _bp.c