altos: Remove *_TO_DATA macros
authorKeith Packard <keithp@keithp.com>
Thu, 16 Aug 2018 00:34:20 +0000 (17:34 -0700)
committerKeith Packard <keithp@keithp.com>
Sat, 13 Oct 2018 15:22:50 +0000 (08:22 -0700)
Now that we don't support 8051, we don't need these

Signed-off-by: Keith Packard <keithp@keithp.com>
21 files changed:
src/drivers/ao_companion.c
src/drivers/ao_gps_skytraq.c
src/drivers/ao_ms5607.c
src/drivers/ao_packet.c
src/drivers/ao_pad.c
src/kernel/ao.h
src/kernel/ao_balloon.c
src/kernel/ao_config.c
src/kernel/ao_data.h
src/kernel/ao_flight.c
src/kernel/ao_flight_nano.c
src/kernel/ao_forward.c
src/kernel/ao_host.h
src/kernel/ao_log_telem.c
src/kernel/ao_log_tiny.c
src/kernel/ao_monitor.c
src/kernel/ao_report.c
src/kernel/ao_sample.c
src/kernel/ao_telemetry.c
src/product/ao_terraui.c
src/test/ao_flight_test.c

index f82558a..598b581 100644 (file)
@@ -107,7 +107,7 @@ ao_companion(void)
                    break;
        }
        while (ao_companion_running) {
-               if (ao_sleep_for(DATA_TO_XDATA(&ao_flight_state), ao_companion_setup.update_period))
+               if (ao_sleep_for(&ao_flight_state, ao_companion_setup.update_period))
                        ao_companion_get_data();
                else
                        ao_companion_notify();
index c483382..3ecae43 100644 (file)
@@ -298,7 +298,7 @@ ao_nmea_gga(void)
                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, PDATA_TO_XDATA(&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_new);
        }
@@ -357,7 +357,7 @@ ao_nmea_gsv(void)
        else if (done) {
                ao_mutex_get(&ao_gps_mutex);
                ao_gps_new |= AO_GPS_NEW_TRACKING;
-               ao_xmemcpy(&ao_gps_tracking_data, PDATA_TO_XDATA(&ao_gps_tracking_next), sizeof(ao_gps_tracking_data));
+               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_new);
        }
index 53ed992..4bfc17d 100644 (file)
@@ -45,7 +45,7 @@ ao_ms5607_reset(void) {
 
        cmd = AO_MS5607_RESET;
        ao_ms5607_start();
-       ao_spi_send(DATA_TO_XDATA(&cmd), 1, AO_MS5607_SPI_INDEX);
+       ao_spi_send(&cmd, 1, AO_MS5607_SPI_INDEX);
        ao_delay(AO_MS_TO_TICKS(10));
        ao_ms5607_stop();
 }
@@ -106,7 +106,7 @@ ao_ms5607_prom_read(__xdata struct ao_ms5607_prom *prom)
        for (addr = 0; addr < 8; addr++) {
                uint8_t cmd = AO_MS5607_PROM_READ(addr);
                ao_ms5607_start();
-               ao_spi_send(DATA_TO_XDATA(&cmd), 1, AO_MS5607_SPI_INDEX);
+               ao_spi_send(&cmd, 1, AO_MS5607_SPI_INDEX);
                ao_spi_recv(r, 2, AO_MS5607_SPI_INDEX);
                ao_ms5607_stop();
                r++;
@@ -156,7 +156,7 @@ ao_ms5607_get_sample(uint8_t cmd) {
        ao_ms5607_done = 0;
 
        ao_ms5607_start();
-       ao_spi_send(DATA_TO_XDATA(&cmd), 1, AO_MS5607_SPI_INDEX);
+       ao_spi_send(&cmd, 1, AO_MS5607_SPI_INDEX);
 
        ao_exti_enable(AO_MS5607_MISO_PORT, AO_MS5607_MISO_PIN);
 
index 008af5d..1c93192 100644 (file)
@@ -91,7 +91,7 @@ ao_packet_recv(uint16_t timeout)
        if (ao_xmemcmp(ao_rx_packet.packet.callsign,
                       ao_config.callsign,
                       AO_MAX_CALLSIGN) != 0 &&
-           ao_xmemcmp(ao_config.callsign, CODE_TO_XDATA("N0CALL"), 7) != 0)
+           ao_xmemcmp(ao_config.callsign, "N0CALL", 7) != 0)
                return 0;
 
        /* SYN packets carry no data */
index c6efc31..208841f 100644 (file)
@@ -203,7 +203,7 @@ ao_pad_monitor(void)
 
                ao_arch_critical(
                        while (sample == ao_data_head)
-                               ao_sleep((void *) DATA_TO_XDATA(&ao_data_head));
+                               ao_sleep((void *) &ao_data_head);
                        );
 
 
index 204eaae..520f6ef 100644 (file)
@@ -38,17 +38,6 @@ extern char ao_getchar(void);
 #define TRUE 1
 #define FALSE 0
 
-/* Convert a __data pointer into an __xdata pointer */
-#ifndef DATA_TO_XDATA
-#define DATA_TO_XDATA(a)       (a)
-#endif
-#ifndef PDATA_TO_XDATA
-#define PDATA_TO_XDATA(a)      (a)
-#endif
-#ifndef CODE_TO_XDATA
-#define CODE_TO_XDATA(a)       (a)
-#endif
-
 #ifndef HAS_TASK
 #define HAS_TASK       1
 #endif
index 47b69e2..d0f80a5 100644 (file)
@@ -96,7 +96,7 @@ ao_flight(void)
                                ao_led_off(AO_LED_RED);
                        }
                        /* wakeup threads due to state change */
-                       ao_wakeup(DATA_TO_XDATA(&ao_flight_state));
+                       ao_wakeup(&ao_flight_state);
 
                        break;
                case ao_flight_pad:
@@ -118,7 +118,7 @@ ao_flight(void)
                                ao_wakeup(&ao_gps_new);
 #endif
 
-                               ao_wakeup(DATA_TO_XDATA(&ao_flight_state));
+                               ao_wakeup(&ao_flight_state);
                        }
                        break;
                default:
index 86d4838..10a6711 100644 (file)
@@ -135,7 +135,7 @@ _ao_config_get(void)
                /* 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, CODE_TO_XDATA(AO_CONFIG_DEFAULT_CALLSIGN),
+               ao_xmemcpy(&ao_config.callsign, AO_CONFIG_DEFAULT_CALLSIGN,
                       sizeof(AO_CONFIG_DEFAULT_CALLSIGN) - 1);
                ao_config._legacy_radio_channel = 0;
        }
@@ -246,7 +246,7 @@ _ao_config_get(void)
 #if HAS_RADIO_RATE
                ao_config.radio_rate = AO_CONFIG_DEFAULT_RADIO_RATE;
 #endif
-               ao_xmemcpy(&ao_config.callsign, CODE_TO_XDATA(AO_CONFIG_DEFAULT_CALLSIGN),
+               ao_xmemcpy(&ao_config.callsign, AO_CONFIG_DEFAULT_CALLSIGN,
                       sizeof(AO_CONFIG_DEFAULT_CALLSIGN) - 1);
        }
 #endif
@@ -421,7 +421,7 @@ ao_config_accel_calibrate_auto(char *orientation) __reentrant
        accel_total = 0;
        cal_data_ring = ao_sample_data;
        while (i) {
-               ao_sleep(DATA_TO_XDATA(&ao_sample_data));
+               ao_sleep(&ao_sample_data);
                while (i && cal_data_ring != ao_sample_data) {
                        accel_total += (int32_t) ao_data_accel(&ao_data_ring[cal_data_ring]);
 #if HAS_GYRO
index 88d0e91..30616ef 100644 (file)
@@ -113,9 +113,7 @@ extern volatile __data uint8_t              ao_data_count;
  * Wait until it is time to write a sensor sample; this is
  * signaled by the timer tick
  */
-#define AO_DATA_WAIT() do {                            \
-               ao_sleep(DATA_TO_XDATA ((void *) &ao_data_count));      \
-       } while (0)
+#define AO_DATA_WAIT()                 ao_sleep((void *) &ao_data_count)
 
 #endif /* AO_DATA_RING */
 
index c2700d2..170396f 100644 (file)
@@ -175,7 +175,7 @@ ao_flight(void)
 #endif
                        }
                        /* wakeup threads due to state change */
-                       ao_wakeup(DATA_TO_XDATA(&ao_flight_state));
+                       ao_wakeup(&ao_flight_state);
 
                        break;
                case ao_flight_pad:
@@ -219,7 +219,7 @@ ao_flight(void)
                                ao_wakeup(&ao_gps_new);
 #endif
 
-                               ao_wakeup(DATA_TO_XDATA(&ao_flight_state));
+                               ao_wakeup(&ao_flight_state);
                        }
                        break;
                case ao_flight_boost:
@@ -244,7 +244,7 @@ ao_flight(void)
                                ao_flight_state = ao_flight_coast;
 #endif
                                ++ao_motor_number;
-                               ao_wakeup(DATA_TO_XDATA(&ao_flight_state));
+                               ao_wakeup(&ao_flight_state);
                        }
                        break;
 #if HAS_ACCEL
@@ -257,7 +257,7 @@ ao_flight(void)
                        if (ao_speed < AO_MS_TO_SPEED(AO_MAX_BARO_SPEED))
                        {
                                ao_flight_state = ao_flight_coast;
-                               ao_wakeup(DATA_TO_XDATA(&ao_flight_state));
+                               ao_wakeup(&ao_flight_state);
                        } else
                                goto check_re_boost;
                        break;
@@ -306,7 +306,7 @@ ao_flight(void)
 
                                /* and enter drogue state */
                                ao_flight_state = ao_flight_drogue;
-                               ao_wakeup(DATA_TO_XDATA(&ao_flight_state));
+                               ao_wakeup(&ao_flight_state);
                        }
 #if HAS_ACCEL
                        else {
@@ -315,7 +315,7 @@ ao_flight(void)
                                if (ao_coast_avg_accel > AO_MSS_TO_ACCEL(20)) {
                                        ao_boost_tick = ao_sample_tick;
                                        ao_flight_state = ao_flight_boost;
-                                       ao_wakeup(DATA_TO_XDATA(&ao_flight_state));
+                                       ao_wakeup(&ao_flight_state);
                                }
                        }
 #endif
@@ -352,7 +352,7 @@ ao_flight(void)
                                ao_interval_min_height = ao_interval_max_height = ao_avg_height;
 
                                ao_flight_state = ao_flight_main;
-                               ao_wakeup(DATA_TO_XDATA(&ao_flight_state));
+                               ao_wakeup(&ao_flight_state);
                        }
                        break;
 
@@ -379,7 +379,7 @@ ao_flight(void)
                                        ao_timer_set_adc_interval(0);
 #endif
 
-                                       ao_wakeup(DATA_TO_XDATA(&ao_flight_state));
+                                       ao_wakeup(&ao_flight_state);
                                }
                                ao_interval_min_height = ao_interval_max_height = ao_avg_height;
                                ao_interval_end = ao_sample_tick + AO_INTERVAL_TICKS;
index d849dc6..797ea34 100644 (file)
@@ -70,7 +70,7 @@ ao_flight_nano(void)
                        ao_led_off(AO_LED_RED);
 
                        /* wakeup threads due to state change */
-                       ao_wakeup(DATA_TO_XDATA(&ao_flight_state));
+                       ao_wakeup(&ao_flight_state);
                        break;
                case ao_flight_pad:
                        if (ao_height> AO_M_TO_HEIGHT(20)) {
@@ -80,7 +80,7 @@ ao_flight_nano(void)
                                /* start logging data */
                                ao_log_start();
 
-                               ao_wakeup(DATA_TO_XDATA(&ao_flight_state));
+                               ao_wakeup(&ao_flight_state);
                        }
                        break;
                case ao_flight_drogue:
@@ -101,7 +101,7 @@ ao_flight_nano(void)
 
                                        /* turn off the ADC capture */
                                        ao_timer_set_adc_interval(0);
-                                       ao_wakeup(DATA_TO_XDATA(&ao_flight_state));
+                                       ao_wakeup(&ao_flight_state);
                                }
                                ao_interval_min_height = ao_interval_max_height = ao_height;
                                ao_interval_end = ao_sample_tick + AO_INTERVAL_TICKS;
index 721b52d..b1ab3f5 100644 (file)
@@ -27,7 +27,7 @@ ao_monitor_forward(void)
 
        for (;;) {
                while (ao_monitoring)
-                       ao_sleep(DATA_TO_XDATA(&ao_monitoring));
+                       ao_sleep(&ao_monitoring);
 
                if (!ao_radio_recv(&packet, sizeof(packet), 0))
                        continue;
index 50583f5..638dba9 100644 (file)
@@ -47,9 +47,9 @@ struct ao_adc {
 #define __code
 #define __reentrant
 
-#define DATA_TO_XDATA(a)       (a)
-#define PDATA_TO_XDATA(a)      (a)
-#define CODE_TO_XDATA(a)       (a)
+#define a      (a)
+#define a      (a)
+#define a      (a)
 
 enum ao_flight_state {
        ao_flight_startup = 0,
index 1305a84..8969e02 100644 (file)
@@ -50,7 +50,7 @@ ao_log_telem_track() {
                                ao_flight_state = ao_log_single_write_data.telemetry.sensor.state;
                                if (ao_flight_state == ao_flight_pad)
                                        ao_max_height = 0;
-                               ao_wakeup(DATA_TO_XDATA(&ao_flight_state));
+                               ao_wakeup(&ao_flight_state);
                        }
                }
        }
@@ -111,7 +111,7 @@ ao_log_single(void)
                                ao_log_telem_track();
                        }
                        /* Wait for more telemetry data to arrive */
-                       ao_sleep(DATA_TO_XDATA(&ao_monitor_head));
+                       ao_sleep(&ao_monitor_head);
                }
        }
 }
index 0b8e39d..046b7b2 100644 (file)
@@ -41,7 +41,7 @@ static void ao_log_tiny_data(uint16_t d)
        if (ao_log_current_pos >= ao_log_end_pos && ao_log_running)
                ao_log_stop();
        if (ao_log_running) {
-               ao_storage_write(ao_log_current_pos, DATA_TO_XDATA(&d), 2);
+               ao_storage_write(ao_log_current_pos, &d, 2);
                ao_log_current_pos += 2;
        }
 }
@@ -102,7 +102,7 @@ ao_log(void)
                /*
                 * Add in pending sample data
                 */
-               ao_sleep(DATA_TO_XDATA(&ao_sample_data));
+               ao_sleep(&ao_sample_data);
                while (ao_log_data != ao_sample_data) {
                        sum += ao_data_pres(&ao_data_ring[ao_log_data]);
                        count++;
index 7cbee28..b9a39bf 100644 (file)
@@ -59,7 +59,7 @@ _ao_monitor_adjust(void)
                else
                        ao_monitoring = ao_internal_monitoring;
        }
-       ao_wakeup(DATA_TO_XDATA(&ao_monitoring));
+       ao_wakeup(&ao_monitoring);
 }
 
 void
@@ -70,7 +70,7 @@ ao_monitor_get(void)
        for (;;) {
                switch (ao_monitoring) {
                case 0:
-                       ao_sleep(DATA_TO_XDATA(&ao_monitoring));
+                       ao_sleep(&ao_monitoring);
                        continue;
 #if LEGACY_MONITOR
                case AO_MONITORING_ORIG:
@@ -86,7 +86,7 @@ ao_monitor_get(void)
                if (!ao_radio_recv(&ao_monitor_ring[ao_monitor_head], size + 2, 0))
                        continue;
                ao_monitor_head = ao_monitor_ring_next(ao_monitor_head);
-               ao_wakeup(DATA_TO_XDATA(&ao_monitor_head));
+               ao_wakeup(&ao_monitor_head);
        }
 }
 
@@ -100,7 +100,7 @@ ao_monitor_blink(void)
        uint8_t         *recv;
 #endif
        for (;;) {
-               ao_sleep(DATA_TO_XDATA(&ao_monitor_head));
+               ao_sleep(&ao_monitor_head);
 #ifdef AO_MONITOR_BAD
                recv = (uint8_t *) &ao_monitor_ring[ao_monitor_ring_prev(ao_monitor_head)];
                if (ao_monitoring && !(recv[ao_monitoring + 1] & AO_RADIO_STATUS_CRC_OK))
@@ -142,9 +142,9 @@ ao_monitor_put(void)
        ao_monitor_tail = ao_monitor_head;
        for (;;) {
                while (!ao_external_monitoring)
-                       ao_sleep(DATA_TO_XDATA(&ao_external_monitoring));
+                       ao_sleep(&ao_external_monitoring);
                while (ao_monitor_tail == ao_monitor_head && ao_external_monitoring)
-                       ao_sleep(DATA_TO_XDATA(&ao_monitor_head));
+                       ao_sleep(&ao_monitor_head);
                if (!ao_external_monitoring)
                        continue;
                m = &ao_monitor_ring[ao_monitor_tail];
@@ -298,8 +298,8 @@ set_monitor(void)
 {
        ao_cmd_hex();
        ao_external_monitoring = ao_cmd_lex_i;
-       ao_wakeup(DATA_TO_XDATA(&ao_external_monitoring));
-       ao_wakeup(DATA_TO_XDATA(&ao_monitor_head));
+       ao_wakeup(&ao_external_monitoring);
+       ao_wakeup(&ao_monitor_head);
        _ao_monitor_adjust();
 }
 
index af48b39..73f87cd 100644 (file)
@@ -183,7 +183,7 @@ ao_report_battery(void)
                ao_data_get(&packet);
                if (packet.adc.v_batt != 0)
                        break;
-               ao_sleep(DATA_TO_XDATA(&ao_sample_data));
+               ao_sleep(&ao_sample_data);
        }
        ao_report_number(ao_battery_decivolt(packet.adc.v_batt));
 }
@@ -281,7 +281,7 @@ ao_report(void)
                }
 #endif
                while (ao_report_state == ao_flight_state)
-                       ao_sleep(DATA_TO_XDATA(&ao_flight_state));
+                       ao_sleep(&ao_flight_state);
        }
 }
 
index f8012e3..9f5082b 100644 (file)
@@ -321,8 +321,8 @@ static gyro_t inline ao_gyro(void) {
 uint8_t
 ao_sample(void)
 {
-       ao_wakeup(DATA_TO_XDATA(&ao_sample_data));
-       ao_sleep((void *) DATA_TO_XDATA(&ao_data_head));
+       ao_wakeup(&ao_sample_data);
+       ao_sleep((void *) &ao_data_head);
        while (ao_sample_data != ao_data_head) {
                __xdata struct ao_data *ao_data;
 
index 9ed612c..8ff28fd 100644 (file)
@@ -337,7 +337,7 @@ ao_send_configuration(void)
                            ao_config.callsign,
                            AO_MAX_CALLSIGN);
                ao_xmemcpy (telemetry.configuration.version,
-                           CODE_TO_XDATA(ao_version),
+                           ao_version,
                            AO_MAX_VERSION);
                ao_telemetry_config_cur = ao_telemetry_config_max;
                ao_telemetry_send();
index c2bbc30..f8f23a0 100644 (file)
@@ -588,7 +588,7 @@ ao_terramonitor(void)
             monitor = ao_monitor_ring_next(monitor))
        {
                while (monitor == ao_monitor_head)
-                       ao_sleep(DATA_TO_XDATA(&ao_monitor_head));
+                       ao_sleep(&ao_monitor_head);
                if (ao_monitoring != sizeof (union ao_telemetry_all))
                        continue;
                if (!(ao_monitor_ring[monitor].all.status & PKT_APPEND_STATUS_1_CRC_OK))
index 746a681..0913e7b 100644 (file)
@@ -362,7 +362,7 @@ struct ao_ms5607_prom       ao_ms5607_prom;
 
 struct ao_config ao_config;
 
-#define DATA_TO_XDATA(x) (x)
+#define x (x)
 
 
 extern int16_t ao_ground_accel, ao_flight_accel;