altos: Make ao_xmem funcs require __xdata void * instead of casting
[fw/altos] / src / cc1111 / ao_arch.h
index c49728197d0d4a2439f427dbebbdb4e063b5a8bb..001165fafd9bae0b592a4be9f1da975ce8f6e9eb 100644 (file)
 /* Convert a __data pointer into an __xdata pointer */
 #define DATA_TO_XDATA(a)       ((void __xdata *) ((uint8_t) (a) | 0xff00))
 
+/* Code and xdata use the same address space */
+#define CODE_TO_XDATA(a)       ((__xdata void *) ((uint16_t) (a)))
+
+/* Pdata lives at the start of xdata */
+#define PDATA_TO_XDATA(a)      ((void __xdata *) ((uint8_t) (a) | 0xf000))
+
 /* Stack runs from above the allocated __data space to 0xfe, which avoids
  * writing to 0xff as that triggers the stack overflow indicator
  */
@@ -192,4 +198,54 @@ extern __code __at (0x00a6) uint32_t ao_radio_cal;
 
 #define ao_arch_critical(b) __critical { b }
 
+struct ao_adc {
+       uint16_t        tick;           /* tick when the sample was read */
+       int16_t         accel;          /* accelerometer */
+       int16_t         pres;           /* pressure sensor */
+       int16_t         temp;           /* temperature sensor */
+       int16_t         v_batt;         /* battery voltage */
+       int16_t         sense_d;        /* drogue continuity sense */
+       int16_t         sense_m;        /* main continuity sense */
+};
+
+#define AO_ADC_RING    32
+
+/* ao_button.c */
+#ifdef HAS_BUTTON
+void
+ao_p0_isr(void) ao_arch_interrupt(13);
+
+void
+ao_p1_isr(void) ao_arch_interrupt(15);
+
+void
+ao_p2_isr(void);
+
+#define HAS_P2_ISR     1
+
+#endif
+
+void
+ao_button_init(void);
+
+char
+ao_button_get(void) __critical;
+
+/* ao_string.c */
+
+void
+_ao_xmemcpy(__xdata void *dst, __xdata void *src, uint8_t count);
+
+#define ao_xmemcpy(d,s,c) _ao_xmemcpy(d,s,c)
+
+void
+_ao_xmemset(__xdata void *dst, uint8_t value, uint8_t count);
+
+#define ao_xmemset(d,v,c) _ao_xmemset(d,v,c)
+
+int8_t
+_ao_xmemcmp(__xdata void *a, __xdata void *b, uint8_t count);
+
+#define ao_xmemcmp(d,s,c) _ao_xmemcmp((d), (s), (c))
+
 #endif /* _AO_ARCH_H_ */