altos: Write xdata versions of memory functions
[fw/altos] / src / core / ao_monitor.c
index 382af8a2a2b101426aaea54d3af82eb0a74fc3f7..1a8bb52a29fdb1467ad8799c0008f18c52867adf 100644 (file)
@@ -22,7 +22,7 @@
 #error Must define HAS_MONITOR to 1
 #endif
 
-__xdata uint8_t ao_monitoring;
+__data uint8_t ao_monitoring;
 __pdata uint8_t ao_monitor_led;
 
 __xdata union ao_monitor ao_monitor_ring[AO_MONITOR_RING];
@@ -37,7 +37,7 @@ ao_monitor_get(void)
        for (;;) {
                switch (ao_monitoring) {
                case 0:
-                       ao_sleep(&ao_monitoring);
+                       ao_sleep(DATA_TO_XDATA(&ao_monitoring));
                        continue;
                case AO_MONITORING_ORIG:
                        size = sizeof (struct ao_telemetry_orig_recv);
@@ -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;
-                       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) {
@@ -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;
-                       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) {
@@ -262,7 +262,7 @@ ao_set_monitor(uint8_t monitoring)
        if (ao_monitoring)
                ao_radio_recv_abort();
        ao_monitoring = monitoring;
-       ao_wakeup(&ao_monitoring);
+       ao_wakeup(DATA_TO_XDATA(&ao_monitoring));
 }
 
 static void