projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos: More _asm -> __asm changes
[fw/altos]
/
src
/
cc1111
/
ao_arch.h
diff --git
a/src/cc1111/ao_arch.h
b/src/cc1111/ao_arch.h
index 02e36189a46db634695f24432db10d12c4d04544..e6c27a1e23d60371bd5afe72dde68d1bd6752420 100644
(file)
--- a/
src/cc1111/ao_arch.h
+++ b/
src/cc1111/ao_arch.h
@@
-27,6
+27,12
@@
/* Convert a __data pointer into an __xdata pointer */
#define DATA_TO_XDATA(a) ((void __xdata *) ((uint8_t) (a) | 0xff00))
/* 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
*/
/* Stack runs from above the allocated __data space to 0xfe, which avoids
* writing to 0xff as that triggers the stack overflow indicator
*/
@@
-39,7
+45,7
@@
ao_delay(AO_SEC_TO_TICKS(2)); \
} while (0)
ao_delay(AO_SEC_TO_TICKS(2)); \
} while (0)
-#define ao_arch_nop() _
asm nop
_endasm
+#define ao_arch_nop() _
_asm nop _
_endasm
#define ao_arch_interrupt(n) __interrupt n
#define ao_arch_naked_declare __naked
#define ao_arch_interrupt(n) __interrupt n
#define ao_arch_naked_declare __naked
@@
-100,7
+106,7
@@
extern __code __at (0x00a6) uint32_t ao_radio_cal;
/* Save current context */
#define ao_arch_save_regs() \
/* Save current context */
#define ao_arch_save_regs() \
- _
asm
\
+ _
_asm
\
/* Push ACC first, as when restoring the context it must be restored \
* last (it is used to set the IE register). */ \
push ACC \
/* Push ACC first, as when restoring the context it must be restored \
* last (it is used to set the IE register). */ \
push ACC \
@@
-119,11
+125,11
@@
extern __code __at (0x00a6) uint32_t ao_radio_cal;
push ar0 \
push ar1 \
push PSW \
push ar0 \
push ar1 \
push PSW \
- _
endasm;
\
+ _
_endasm;
\
PSW = 0; \
PSW = 0; \
- _
asm
\
+ _
_asm
\
push _bp \
push _bp \
- _endasm
+ _
_
endasm
#define ao_arch_save_stack() { \
uint8_t stack_len; \
#define ao_arch_save_stack() { \
uint8_t stack_len; \
@@
-160,7
+166,7
@@
extern __code __at (0x00a6) uint32_t ao_radio_cal;
*stack_ptr++ = *save_ptr++; \
while (--stack_len); \
\
*stack_ptr++ = *save_ptr++; \
while (--stack_len); \
\
- _
asm
\
+ _
_asm
\
pop _bp \
pop PSW \
pop ar1 \
pop _bp \
pop PSW \
pop ar1 \
@@
-187,7
+193,7
@@
extern __code __at (0x00a6) uint32_t ao_radio_cal;
/* Finally pop off the ACC, which was the first register saved. */ \
pop ACC \
ret \
/* Finally pop off the ACC, which was the first register saved. */ \
pop ACC \
ret \
- _
endasm;
\
+ _
_endasm;
\
}
#define ao_arch_critical(b) __critical { b }
}
#define ao_arch_critical(b) __critical { b }
@@
-204,21
+210,45
@@
struct ao_adc {
#define AO_ADC_RING 32
#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;
+
+void
+ao_button_clear(void) __critical;
+
/* ao_string.c */
void
/* ao_string.c */
void
-_ao_xmemcpy(__xdata
uint8_t *dst, __xdata uint8_t
*src, uint8_t count);
+_ao_xmemcpy(__xdata
void *dst, __xdata void
*src, uint8_t count);
-#define ao_xmemcpy(d,s,c) _ao_xmemcpy(
(__xdata uint8_t *) (d), (__xdata uint8_t *) (s), (c)
)
+#define ao_xmemcpy(d,s,c) _ao_xmemcpy(
d,s,c
)
void
void
-_ao_xmemset(__xdata
uint8_t
*dst, uint8_t value, uint8_t count);
+_ao_xmemset(__xdata
void
*dst, uint8_t value, uint8_t count);
-#define ao_xmemset(d,v,c) _ao_xmemset(
(__xdata uint8_t *) (d), (v), (c)
)
+#define ao_xmemset(d,v,c) _ao_xmemset(
d,v,c
)
int8_t
int8_t
-_ao_xmemcmp(__xdata
uint8_t *a, __xdata uint8_t
*b, uint8_t count);
+_ao_xmemcmp(__xdata
void *a, __xdata void
*b, uint8_t count);
-#define ao_xmemcmp(d,s,c) _ao_xmemcmp((
__xdata uint8_t *) (d), (__xdata uint8_t *)
(s), (c))
+#define ao_xmemcmp(d,s,c) _ao_xmemcmp((
d),
(s), (c))
#endif /* _AO_ARCH_H_ */
#endif /* _AO_ARCH_H_ */