ao_ee_flush_internal();
ao_ee_block = block;
}
- ao_xmemcpy(ao_ee_data + (uint16_t) (pos & 0xff), buf, len);
+ memcpy(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);
- ao_xmemcpy(buf, ao_ee_data + (uint16_t) (pos & 0xff), len);
+ memcpy(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);
- ao_xmemset(ao_ee_data, 0xff, EE_BLOCK_SIZE);
+ memset(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;
}
- ao_xmemcpy(ao_flash_data + (uint16_t) (pos & ao_flash_block_mask),
+ memcpy(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);
- ao_xmemcpy(buf,
+ memcpy(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);
- ao_xmemset(ao_flash_data, 0xff, ao_flash_block_size);
+ memset(ao_flash_data, 0xff, ao_flash_block_size);
ao_flash_block_dirty = 1;
} ao_mutex_put(&ao_flash_mutex);
return 1;
ao_mutex_get(&ao_gps_mutex);
ao_gps_new |= AO_GPS_NEW_DATA;
ao_gps_tick = ao_gps_next_tick;
- ao_xmemcpy(&ao_gps_data, &ao_gps_next, sizeof (ao_gps_data));
+ memcpy(&ao_gps_data, &ao_gps_next, sizeof (ao_gps_data));
ao_mutex_put(&ao_gps_mutex);
ao_wakeup(&ao_gps_new);
}
else if (done) {
ao_mutex_get(&ao_gps_mutex);
ao_gps_new |= AO_GPS_NEW_TRACKING;
- ao_xmemcpy(&ao_gps_tracking_data, &ao_gps_tracking_next, sizeof(ao_gps_tracking_data));
+ memcpy(&ao_gps_tracking_data, &ao_gps_tracking_next, sizeof(ao_gps_tracking_data));
ao_mutex_put(&ao_gps_mutex);
ao_wakeup(&ao_gps_new);
}
#endif
/* If any tx data is pending then copy it into the tx packet */
if (ao_packet_tx_used && ao_tx_packet.len == 0) {
- ao_xmemcpy(&ao_tx_packet.d, tx_data, ao_packet_tx_used);
+ memcpy(&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;
/* Accept packets with matching call signs, or any packet if
* our callsign hasn't been configured
*/
- if (ao_xmemcmp(ao_rx_packet.packet.callsign,
+ if (memcmp(ao_rx_packet.packet.callsign,
ao_config.callsign,
AO_MAX_CALLSIGN) != 0 &&
- ao_xmemcmp(ao_config.callsign, "N0CALL", 7) != 0)
+ memcmp(ao_config.callsign, "N0CALL", 7) != 0)
return 0;
/* SYN packets carry no data */
/* Copy data to the receive data buffer and set up the
* offsets
*/
- ao_xmemcpy(rx_data, ao_rx_packet.packet.d, ao_rx_packet.packet.len);
+ memcpy(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;
- ao_xmemcpy(ao_tx_packet.callsign, ao_config.callsign, AO_MAX_CALLSIGN);
+ memcpy(ao_tx_packet.callsign, ao_config.callsign, AO_MAX_CALLSIGN);
ao_packet_send();
if (ao_tx_packet.len)
ao_packet_master_busy();
ao_packet_restart = 1;
while (ao_packet_enable) {
if (ao_packet_recv(0)) {
- ao_xmemcpy(&ao_tx_packet.callsign, &ao_rx_packet.packet.callsign, AO_MAX_CALLSIGN);
+ memcpy(&ao_tx_packet.callsign, &ao_rx_packet.packet.callsign, AO_MAX_CALLSIGN);
#if HAS_FLIGHT
ao_flight_force_idle = true;
#endif
AO_RADIO_SPI_REPLY_HEADER_LEN + size,
AO_RADIO_SPI_BUS);
ao_radio_master_stop();
- ao_xmemcpy(d, ao_radio_spi_reply.payload, size);
+ memcpy(d, ao_radio_spi_reply.payload, size);
PRINTD ("fetched %d\n", size);
}
ao_radio_send(const void *d, uint8_t size)
{
ao_radio_get(AO_RADIO_SPI_SEND, size);
- ao_xmemcpy(&ao_radio_spi_request.payload, d, size);
+ memcpy(&ao_radio_spi_request.payload, d, size);
ao_radio_master_send();
ao_radio_put();
}
*/
PRINTD ("set key\n");
ao_radio_get(AO_RADIO_SPI_CMAC_KEY, AO_AES_LEN);
- ao_xmemcpy(&ao_radio_spi_request.payload, &ao_config.aes_key, AO_AES_LEN);
+ memcpy(&ao_radio_spi_request.payload, &ao_config.aes_key, AO_AES_LEN);
ao_radio_master_send();
ao_radio_put();
PRINTD ("key set\n");
PRINTD ("sending packet\n");
ao_radio_get(AO_RADIO_SPI_CMAC_SEND, len);
- ao_xmemcpy(&ao_radio_spi_request.payload, packet, len);
+ memcpy(&ao_radio_spi_request.payload, packet, len);
ao_radio_master_send();
ao_radio_put();
PRINTD ("packet sent\n");
break;
case AO_RADIO_SPI_CMAC_KEY:
- ao_xmemcpy(&ao_config.aes_key, ao_radio_spi_request.payload, AO_AES_LEN);
+ memcpy(&ao_config.aes_key, ao_radio_spi_request.payload, AO_AES_LEN);
break;
case AO_RADIO_SPI_TEST_ON:
#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
-
/*
* ao_terraui.c
*/
/* Version 0 stuff */
ao_config.main_deploy = AO_CONFIG_DEFAULT_MAIN_DEPLOY;
- ao_xmemset(&ao_config.callsign, '\0', sizeof (ao_config.callsign));
- ao_xmemcpy(&ao_config.callsign, AO_CONFIG_DEFAULT_CALLSIGN,
+ memset(&ao_config.callsign, '\0', sizeof (ao_config.callsign));
+ memcpy(&ao_config.callsign, AO_CONFIG_DEFAULT_CALLSIGN,
sizeof(AO_CONFIG_DEFAULT_CALLSIGN) - 1);
ao_config._legacy_radio_channel = 0;
}
if (minor < 8)
ao_config.radio_enable = AO_RADIO_ENABLE_CORE;
if (minor < 9)
- ao_xmemset(&ao_config.aes_key, '\0', AO_AES_LEN);
+ memset(&ao_config.aes_key, '\0', AO_AES_LEN);
if (minor < 10)
ao_config.frequency = 434550 + ao_config._legacy_radio_channel * 100;
if (minor < 11)
#if HAS_RADIO_RATE
ao_config.radio_rate = AO_CONFIG_DEFAULT_RADIO_RATE;
#endif
- ao_xmemcpy(&ao_config.callsign, AO_CONFIG_DEFAULT_CALLSIGN,
+ memcpy(&ao_config.callsign, AO_CONFIG_DEFAULT_CALLSIGN,
sizeof(AO_CONFIG_DEFAULT_CALLSIGN) - 1);
}
#endif
uint8_t c;
static char callsign[AO_MAX_CALLSIGN + 1];
- ao_xmemset(callsign, '\0', sizeof callsign);
+ memset(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();
- ao_xmemcpy(&ao_config.callsign, &callsign,
+ memcpy(&ao_config.callsign, &callsign,
AO_MAX_CALLSIGN + 1);
_ao_config_edit_finish();
}
uint8_t
ao_ee_read_config(uint8_t *buf, uint16_t len)
{
- ao_xmemset(buf, '\0', len);
+ memset(buf, '\0', len);
return 1;
}
ao_sleep(&ao_gps_new);
ao_mutex_get(&ao_gps_mutex);
if (new & AO_GPS_NEW_DATA)
- ao_xmemcpy(&gps_data, &ao_gps_data, sizeof (ao_gps_data));
+ memcpy(&gps_data, &ao_gps_data, sizeof (ao_gps_data));
if (new & AO_GPS_NEW_TRACKING)
- ao_xmemcpy(&gps_tracking_data, &ao_gps_tracking_data, sizeof (ao_gps_tracking_data));
+ memcpy(&gps_tracking_data, &ao_gps_tracking_data, sizeof (ao_gps_tracking_data));
ao_gps_new = 0;
ao_mutex_put(&ao_gps_mutex);
ao_sleep(&ao_gps_new);
ao_mutex_get(&ao_gps_mutex);
if (new & AO_GPS_NEW_DATA)
- ao_xmemcpy(&gps_data, &ao_gps_data, sizeof (ao_gps_data));
+ memcpy(&gps_data, &ao_gps_data, sizeof (ao_gps_data));
if (new & AO_GPS_NEW_TRACKING)
- ao_xmemcpy(&gps_tracking_data, &ao_gps_tracking_data, sizeof (ao_gps_tracking_data));
+ memcpy(&gps_tracking_data, &ao_gps_tracking_data, sizeof (ao_gps_tracking_data));
ao_gps_new = 0;
ao_mutex_put(&ao_gps_mutex);
ao_sleep(&ao_gps_new);
ao_mutex_get(&ao_gps_mutex);
if (new & AO_GPS_NEW_DATA)
- ao_xmemcpy(&gps_data, &ao_gps_data, sizeof (ao_gps_data));
+ memcpy(&gps_data, &ao_gps_data, sizeof (ao_gps_data));
if (new & AO_GPS_NEW_TRACKING)
- ao_xmemcpy(&gps_tracking_data, &ao_gps_tracking_data, sizeof (ao_gps_tracking_data));
+ memcpy(&gps_tracking_data, &ao_gps_tracking_data, sizeof (ao_gps_tracking_data));
ao_gps_new = 0;
ao_mutex_put(&ao_gps_mutex);
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)
+#define memcpy(d,s,c) memcpy(d,s,c)
+#define memset(d,v,c) memset(d,v,c)
+#define memcmp(d,s,c) memcmp(d,s,c)
while (ao_log_running) {
/* Write samples to EEPROM */
while (ao_log_monitor_pos != ao_monitor_head) {
- ao_xmemcpy(&ao_log_single_write_data.telemetry,
+ memcpy(&ao_log_single_write_data.telemetry,
&ao_monitor_ring[ao_log_monitor_pos],
AO_LOG_SINGLE_SIZE);
ao_log_single_write();
state = recv_orig.telemetry_orig.flight_state;
rssi = (int16_t) AO_RSSI_FROM_RADIO(recv_orig.rssi);
- ao_xmemcpy(callsign, recv_orig.telemetry_orig.callsign, AO_MAX_CALLSIGN);
+ memcpy(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 (len > AO_CMAC_MAX_LEN)
return AO_RADIO_CMAC_LEN_ERROR;
ao_mutex_get(&ao_radio_cmac_mutex);
- ao_xmemcpy(cmac_data, packet, len);
+ memcpy(cmac_data, packet, len);
#if AO_LED_TX
ao_led_on(AO_LED_TX);
#endif
ao_led_off(AO_LED_RX);
#endif
if (i == AO_RADIO_CMAC_OK)
- ao_xmemcpy(packet, cmac_data, len);
+ memcpy(packet, cmac_data, len);
ao_mutex_put(&ao_radio_cmac_mutex);
return i;
}
#endif
telemetry.configuration.flight_log_max = ao_config.flight_log_max >> 10;
- ao_xmemcpy (telemetry.configuration.callsign,
- ao_config.callsign,
- AO_MAX_CALLSIGN);
- ao_xmemcpy (telemetry.configuration.version,
- ao_version,
- AO_MAX_VERSION);
+ memcpy (telemetry.configuration.callsign,
+ ao_config.callsign,
+ AO_MAX_CALLSIGN);
+ memcpy (telemetry.configuration.version,
+ ao_version,
+ AO_MAX_VERSION);
ao_telemetry_config_cur = ao_telemetry_config_max;
ao_telemetry_send();
}
static int8_t ao_telemetry_loc_cur;
static int8_t ao_telemetry_sat_cur;
+static inline void *
+telemetry_bits(struct ao_telemetry_location *l)
+{
+ return ((uint8_t *) l) + offsetof(struct ao_telemetry_location, flags);
+}
+
+static inline int
+telemetry_size(void)
+{
+ return sizeof(struct ao_telemetry_location) - offsetof(struct ao_telemetry_location, flags);
+}
+
static void
ao_send_location(void)
{
{
telemetry.generic.type = AO_TELEMETRY_LOCATION;
ao_mutex_get(&ao_gps_mutex);
- ao_xmemcpy(&telemetry.location.flags,
- &ao_gps_data.flags,
- 27);
+ memcpy(telemetry_bits(&telemetry.location),
+ telemetry_bits(&ao_gps_data),
+ telemetry_size());
telemetry.location.tick = ao_gps_tick;
ao_mutex_put(&ao_gps_mutex);
ao_telemetry_loc_cur = ao_telemetry_gps_max;
telemetry.generic.type = AO_TELEMETRY_SATELLITE;
ao_mutex_get(&ao_gps_mutex);
telemetry.satellite.channels = ao_gps_tracking_data.channels;
- ao_xmemcpy(&telemetry.satellite.sats,
+ memcpy(&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);
- ao_xmemcpy(&telemetry.companion.companion_data,
+ memcpy(&telemetry.companion.companion_data,
ao_companion_data,
ao_companion_setup.channels * 2);
ao_mutex_put(&ao_companion_mutex);
case AO_TELEMETRY_SENSOR_TELEMETRUM:
case AO_TELEMETRY_SENSOR_TELEMINI:
case AO_TELEMETRY_SENSOR_TELENANO:
- ao_xmemcpy(&ao_tel_sensor, &ao_monitor_ring[monitor], sizeof (ao_tel_sensor));
+ memcpy(&ao_tel_sensor, &ao_monitor_ring[monitor], sizeof (ao_tel_sensor));
if (ao_tel_sensor.state < ao_flight_boost) {
ao_tel_max_speed = 0;
ao_tel_max_height = 0;
ao_telem_progress = (ao_telem_progress + 1) & 0x3;
break;
case AO_TELEMETRY_LOCATION:
- ao_xmemcpy(&ao_tel_location, &ao_monitor_ring[monitor], sizeof (ao_tel_location));
+ memcpy(&ao_tel_location, &ao_monitor_ring[monitor], sizeof (ao_tel_location));
break;
case AO_TELEMETRY_CONFIGURATION:
- ao_xmemcpy(&ao_tel_config, &ao_monitor_ring[monitor], sizeof (ao_tel_config));
+ memcpy(&ao_tel_config, &ao_monitor_ring[monitor], sizeof (ao_tel_config));
}
}
}
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)
-
#define AO_NEED_ALTITUDE_TO_PRES 1
#if TELEMEGA || TELEMETRUM_V2 || EASYMINI
#include "ao_convert_pa.c"
struct ao_config ao_config;
-#define x (x)
-
-
extern int16_t ao_ground_accel, ao_flight_accel;
extern int16_t ao_accel_2g;