X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=src%2Fstm32f4%2Fao_arch.h;h=73dc3e9359e57f107c63c281028784c3496e6fdb;hp=805d756d12f4ab4c529a6b17709d69ce1824ce7f;hb=015d3055a52532070e96469907683c3aa3eda44e;hpb=b7a21bf6a086748b4907c0577eaa114445995783 diff --git a/src/stm32f4/ao_arch.h b/src/stm32f4/ao_arch.h index 805d756d..73dc3e93 100644 --- a/src/stm32f4/ao_arch.h +++ b/src/stm32f4/ao_arch.h @@ -19,19 +19,28 @@ #include #ifndef AO_STACK_SIZE -#define AO_STACK_SIZE 512 +#define AO_STACK_SIZE 2048 #endif +#ifndef HAS_TASK_QUEUE +#define HAS_TASK_QUEUE 1 +#endif + +#define AO_STACK_ALIGNMENT __attribute__ ((aligned(8))) + #define AO_PORT_TYPE uint16_t +#define ao_arch_reboot() \ + (stm_scb.aircr = ((STM_SCB_AIRCR_VECTKEY_KEY << STM_SCB_AIRCR_VECTKEY) | \ + (1 << STM_SCB_AIRCR_SYSRESETREQ))) + #define ao_arch_nop() asm("nop") +#define AO_ROMCONFIG_SYMBOL __attribute__((section(".romconfig"))) const + #define ao_arch_task_members\ uint32_t *sp; /* saved stack pointer */ -#define ao_arch_block_interrupts() asm("cpsid i") -#define ao_arch_release_interrupts() asm("cpsie i") - #define ao_arch_naked_declare __attribute__((naked)) #define ao_arch_naked_define @@ -101,4 +110,32 @@ #define AO_SYSTICK (AO_HCLK) #define AO_PANIC_DELAY_SCALE (AO_SYSCLK / 12000000) +/* The stm32f413 implements only 4 bits of the priority fields? */ + +#if AO_NONMASK_INTERRUPT +#define AO_STM_NVIC_NONMASK_PRIORITY 0x00 + +/* Set the basepri register to this value to mask all + * non-maskable priorities + */ +#define AO_STM_NVIC_BASEPRI_MASK 0x10 +#endif + +#define AO_STM_NVIC_HIGH_PRIORITY 0x40 +#define AO_STM_NVIC_MED_PRIORITY 0x80 +#define AO_STM_NVIC_LOW_PRIORITY 0xC0 +#define AO_STM_NVIC_CLOCK_PRIORITY 0xf0 + +#define AO_GPIO_MODE_PULL_NONE 0 +#define AO_GPIO_MODE_PULL_UP 4 +#define AO_GPIO_MODE_PULL_DOWN 8 + +/* usart stuff */ + +#define AO_SERIAL_SPEED_4800 4800 +#define AO_SERIAL_SPEED_9600 9600 +#define AO_SERIAL_SPEED_19200 19200 +#define AO_SERIAL_SPEED_57600 57600 +#define AO_SERIAL_SPEED_115200 115200 + #endif /* _AO_ARCH_H_ */