34 #if defined(PIOS_INCLUDE_SYS)
37 void NVIC_Configuration(
void);
38 void SysTick_Handler(
void);
41 #define MEM8(addr) (*((volatile uint8_t *)(addr)))
42 #define MEM16(addr) (*((volatile uint16_t *)(addr)))
43 #define MEM32(addr) (*((volatile uint32_t *)(addr)))
54 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE |
55 RCC_APB2Periph_AFIO | RCC_APB2Periph_SPI1, ENABLE);
57 RCC_APB1PeriphClockCmd(RCC_APB1Periph_SPI2 | RCC_APB1Periph_SPI3, ENABLE);
59 #if (PIOS_USB_ENABLED)
61 GPIO_InitTypeDef GPIO_InitStructure;
62 GPIO_StructInit(&GPIO_InitStructure);
63 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
89 #if defined(PIOS_LED_HEARTBEAT)
92 #if defined(PIOS_LED_ALARM)
96 RCC_APB2PeriphResetCmd(0xffffffff, DISABLE);
97 RCC_APB1PeriphResetCmd(0xffffffff, DISABLE);
118 uint8_t b = MEM8(0x1ffff7e8 + i);
139 uint8_t b = MEM8(0x1ffff7e8 + (i / 2));
144 str[
i] = ((b > 9) ? (
'A' - 10) :
'0') + b;
152 static inline size_t unused_mem(uint32_t *top, uint32_t *bot, uint32_t pattern)
155 for (; p < top && *p == pattern; p++);
156 return (p - bot) *
sizeof(uint32_t);
159 #ifdef PIOS_INCLUDE_CHIBIOS
161 #if !defined(CRT0_STACKS_FILL_PATTERN)
162 #define CRT0_STACKS_FILL_PATTERN 0x55555555
165 extern uint32_t __main_stack_base__;
166 extern uint32_t __main_stack_end__;
167 extern uint32_t __process_stack_base__;
168 extern uint32_t __process_stack_end__;
172 return unused_mem(&__main_stack_end__, &__main_stack_base__,
173 CRT0_STACKS_FILL_PATTERN);
178 return unused_mem(&__process_stack_end__, &__process_stack_base__,
179 CRT0_STACKS_FILL_PATTERN);
185 extern uint32_t _irq_stack_end;
186 extern uint32_t _irq_stack_top;
190 return unused_mem(&_irq_stack_top, &_irq_stack_end, 0xa5a5);
203 void NVIC_Configuration(
void)
206 extern void *pios_isr_vector_table_base;
207 NVIC_SetVectorTable((uint32_t)&pios_isr_vector_table_base, 0x0);
210 NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
213 SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
216 #ifdef USE_FULL_ASSERT
224 void assert_failed(uint8_t * file, uint32_t line)
230 #if defined(PIOS_LED_HEARTBEAT)
233 #if defined(PIOS_LED_ALARM)
239 #if defined(PIOS_LED_HEARTBEAT)
242 #if defined(PIOS_LED_ALARM)
245 for (
int i = 0; i < 1000000; i++) ;
Main PiOS header to include all the compiled in PiOS options.
#define PIOS_SYS_SERIAL_NUM_BINARY_LEN
void PIOS_ANNUNC_Off(uint32_t annunc_id)
void SystemInit(void)
Setup the microcontroller system Initialize the Embedded Flash Interface, the PLL and update the Syst...
#define PIOS_SYS_SERIAL_NUM_ASCII_LEN
void PIOS_ANNUNC_On(uint32_t annunc_id)
int32_t PIOS_SYS_Reset(void)
size_t PIOS_SYS_OsStackUnused(void)
int32_t PIOS_IRQ_Disable(void)
int32_t PIOS_SYS_SerialNumberGet(char str[PIOS_SYS_SERIAL_NUM_ASCII_LEN+1])
void PIOS_ANNUNC_Toggle(uint32_t annunc_id)
#define PIOS_USB_DETECT_GPIO_PORT
size_t PIOS_SYS_IrqStackUnused(void)
#define PIOS_USB_DETECT_GPIO_PIN
#define PIOS_LED_HEARTBEAT
int32_t PIOS_SYS_SerialNumberGetBinary(uint8_t array[PIOS_SYS_SERIAL_NUM_BINARY_LEN])