altosui: Add ascent, descent and landed tabs
[fw/altos] / src / ao_log.c
index 44ce90e0a943c88eb734e8d0eb52518198ffbedd..18bdb8c8d4f63cdca7b370d6c40cf0445322ffa7 100644 (file)
@@ -23,7 +23,7 @@ static __xdata uint8_t        ao_log_running;
 static __xdata uint8_t ao_log_mutex;
 
 static uint8_t
-ao_log_csum(uint8_t *b)
+ao_log_csum(__xdata uint8_t *b) __reentrant
 {
        uint8_t sum = 0x5a;
        uint8_t i;
@@ -33,14 +33,16 @@ ao_log_csum(uint8_t *b)
        return -sum;
 }
 
-void
-ao_log_data(struct ao_log_record *log)
+uint8_t
+ao_log_data(__xdata struct ao_log_record *log) __reentrant
 {
+       uint8_t wrote = 0;
        /* set checksum */
        log->csum = 0;
-       log->csum = ao_log_csum((uint8_t *) log);
+       log->csum = ao_log_csum((__xdata uint8_t *) log);
        ao_mutex_get(&ao_log_mutex); {
                if (ao_log_running) {
+                       wrote = 1;
                        ao_ee_write(ao_log_current_pos,
                                    (uint8_t *) log,
                                    sizeof (struct ao_log_record));
@@ -51,6 +53,7 @@ ao_log_data(struct ao_log_record *log)
                                ao_log_running = 0;
                }
        } ao_mutex_put(&ao_log_mutex);
+       return wrote;
 }
 
 void