#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
#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_ */
{
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;
}
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;
/* 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_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_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
#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_ */
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));
}
}
/* 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;
}
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') {
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();
}
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
uint8_t
ao_ee_read_config(uint8_t *buf, uint16_t len) __reentrant
{
- memset(buf, '\0', len);
+ ao_xmemset(buf, '\0', len);
return 1;
}
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_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))
#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)
/* 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) {
/* 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) {
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);
- memcpy (telemetry.configuration.version,
+ ao_xmemcpy (telemetry.configuration.version,
ao_version,
AO_MAX_VERSION);
ao_radio_send(&telemetry, sizeof (telemetry));
{
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);
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);
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_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;
/* 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_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_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;
/* 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_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;
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_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);
ao_radio_cmac.c \
ao_romconfig.c \
ao_serial.c \
+ ao_string.c \
ao_timer.c \
ao_usb.c \
_bp.c
ao_radio.c \
ao_radio_cmac.c \
ao_romconfig.c \
+ ao_string.c \
ao_timer.c \
ao_usb.c \
_bp.c
ao_romconfig.c \
ao_serial.c \
ao_spi.c \
+ ao_string.c \
ao_timer.c \
ao_usb.c \
_bp.c
ao_radio.c \
ao_romconfig.c \
ao_serial.c \
+ ao_string.c \
ao_spi.c \
ao_timer.c \
ao_usb.c \
ao_packet_slave.c \
ao_radio.c \
ao_romconfig.c \
+ ao_string.c \
ao_timer.c \
_bp.c
ao_packet_slave.c \
ao_radio.c \
ao_romconfig.c \
+ ao_string.c \
ao_timer.c \
_bp.c
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 {
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;
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:
ao_radio.c \
ao_radio_cmac.c \
ao_romconfig.c \
+ ao_string.c \
ao_timer.c \
ao_usb.c \
_bp.c