X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fstmf0%2Fao_arch_funcs.h;h=9233f0440eb9d8c6f49c62dee60281f9dfd8e273;hb=d31fda73fef37cf6a9e449c99f3197b713b93acb;hp=96c033f9712ce379f481c43d4fe621e52f663e2d;hpb=1f56dc30a31e3d5c833f73ec9cd31f548a80e154;p=fw%2Faltos diff --git a/src/stmf0/ao_arch_funcs.h b/src/stmf0/ao_arch_funcs.h index 96c033f9..9233f044 100644 --- a/src/stmf0/ao_arch_funcs.h +++ b/src/stmf0/ao_arch_funcs.h @@ -168,8 +168,8 @@ ao_spi_try_get_mask(struct stm_gpio *reg, uint16_t mask, uint8_t bus, uint32_t s ao_spi_put(bus); \ } while (0) -#define ao_spi_get_bit(reg,bit,pin,bus,speed) ao_spi_get_mask(reg,(1<stack + AO_STACK_SIZE); + uint32_t *sp = &task->stack32[AO_STACK_SIZE >> 2]; uint32_t a = (uint32_t) start; int i; @@ -407,7 +407,7 @@ ao_arch_init_stack(struct ao_task *task, void *start) /* PRIMASK with interrupts enabled */ ARM_PUSH32(sp, 0); - task->sp = sp; + task->sp32 = sp; } static inline void ao_arch_save_regs(void) { @@ -426,17 +426,14 @@ static inline void ao_arch_save_regs(void) { static inline void ao_arch_save_stack(void) { uint32_t *sp; asm("mov %0,sp" : "=&r" (sp) ); - ao_cur_task->sp = (sp); - if ((uint8_t *) sp < &ao_cur_task->stack[0]) + ao_cur_task->sp32 = (sp); + if (sp < &ao_cur_task->stack32[0]) ao_panic (AO_PANIC_STACK); } static inline void ao_arch_restore_stack(void) { - uint32_t sp; - sp = (uint32_t) ao_cur_task->sp; - /* Switch stacks */ - asm("mov sp, %0" : : "r" (sp) ); + asm("mov sp, %0" : : "r" (ao_cur_task->sp32) ); /* Restore PRIMASK */ asm("pop {r0}"); @@ -503,4 +500,9 @@ uint8_t ao_usb_write2(uint16_t len); #endif /* AO_USB_DIRECTIO */ +void start(void); + +void +ao_debug_out(char c); + #endif /* _AO_ARCH_FUNCS_H_ */