altos: Make ao_xmem funcs require __xdata void * instead of casting
[fw/altos] / src / core / ao.h
index 8b978272349607e8c9dc493fcd29cfa1d81fe9c3..cbe2f8dc34a222c82c668262912794b3f6838eb2 100644 (file)
 #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
 
 /* An AltOS task */
 struct ao_task {
@@ -974,18 +980,33 @@ ao_spi_init(void);
  * ao_spi_slave.c
  */
 
+uint8_t
+ao_spi_slave_recv(uint8_t *buf, uint8_t len);
+
 void
-ao_spi_slave_debug(void);
+ao_spi_slave_send(uint8_t *buf, uint8_t len);
 
 void
 ao_spi_slave_init(void);
 
+/* This must be defined by the product; it will get called when chip
+ * select goes low, at which point it should use ao_spi_read and
+ * ao_spi_write to deal with the request
+ */
+
+void
+ao_spi_slave(void);
+
 /*
  * ao_telemetry.c
  */
 #define AO_MAX_CALLSIGN                        8
 #define AO_MAX_VERSION                 8
+#if LEGACY_MONITOR
 #define AO_MAX_TELEMETRY               128
+#else
+#define AO_MAX_TELEMETRY               32
+#endif
 
 struct ao_telemetry_generic {
        uint16_t        serial;         /* 0 */
@@ -1145,6 +1166,12 @@ union ao_telemetry_all {
        struct ao_telemetry_baro                baro;
 };
 
+struct ao_telemetry_all_recv {
+       union ao_telemetry_all          telemetry;
+       int8_t                          rssi;
+       uint8_t                         status;
+};
+
 /*
  * ao_gps.c
  */
@@ -1330,8 +1357,18 @@ ao_radio_recv(__xdata void *data, uint8_t size) __reentrant;
 void
 ao_radio_recv_abort(void);
 
+/*
+ * Compute the packet length as follows:
+ *
+ * 2000 bps (for a 1kHz tone)
+ * so, for 'ms' milliseconds, we need
+ * 2 * ms bits, or ms / 4 bytes
+ */
+
+#define AO_MS_TO_RDF_LEN(ms) ((ms) > 255 * 4 ? 255 : ((ms) >> 2))
+
 void
-ao_radio_rdf(int ms);
+ao_radio_rdf(uint8_t pkt_len);
 
 void
 ao_radio_rdf_abort(void);
@@ -1351,15 +1388,17 @@ extern const char const * const ao_state_names[];
 #define AO_MONITOR_RING        8
 
 union ao_monitor {
-               struct ao_telemetry_raw_recv    raw;
-               struct ao_telemetry_orig_recv   orig;
-               struct ao_telemetry_tiny_recv   tiny;
+       struct ao_telemetry_raw_recv    raw;
+       struct ao_telemetry_all_recv    all;
+       struct ao_telemetry_orig_recv   orig;
+       struct ao_telemetry_tiny_recv   tiny;
 };
 
 extern __xdata union ao_monitor ao_monitor_ring[AO_MONITOR_RING];
 
 #define ao_monitor_ring_next(n)        (((n) + 1) & (AO_MONITOR_RING - 1))
 
+extern __data uint8_t ao_monitoring;
 extern __data uint8_t ao_monitor_head;
 
 void
@@ -1435,6 +1474,8 @@ extern __xdata struct ao_ignition ao_ignition[2];
 enum ao_igniter_status
 ao_igniter_status(enum ao_igniter igniter);
 
+extern __pdata uint8_t ao_igniter_present;
+
 void
 ao_ignite_set_pins(void);
 
@@ -1643,9 +1684,37 @@ ao_companion_init(void);
 
 /* ao_lcd.c */
   
+void
+ao_lcd_putchar(uint8_t data);
+
+void
+ao_lcd_putstring(char *string);
+
+void
+ao_lcd_contrast_set(uint8_t contrast);
+
+void
+ao_lcd_clear(void);
+
+#define AO_LCD_ADDR(row,col)   ((row << 6) | (col))
+
+void
+ao_lcd_goto(uint8_t addr);
+
+void
+ao_lcd_start(void);
+
 void
 ao_lcd_init(void);
 
+/* ao_lcd_port.c */
+
+void
+ao_lcd_port_put_nibble(uint8_t rs, uint8_t data);
+
+void
+ao_lcd_port_init(void);
+
 /* ao_aes.c */
 
 __xdata uint8_t ao_aes_mutex;
@@ -1787,4 +1856,45 @@ ao_log_single_init(void);
 void
 ao_log_single(void);
 
+/*
+ * ao_pyro_slave.c
+ */
+
+#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
+ */
+
+void
+ao_terraui_init(void);
+
+/*
+ * ao_battery.c
+ */
+
+#ifdef BATTERY_PIN
+void
+ao_battery_isr(void) ao_arch_interrupt(1);
+
+uint16_t
+ao_battery_get(void);
+
+void
+ao_battery_init(void);
+#endif /* BATTERY_PIN */
+
+/*
+ * ao_sqrt.c
+ */
+
+uint32_t
+ao_sqrt(uint32_t op);
+
 #endif /* _AO_H_ */