summaryrefslogtreecommitdiff
path: root/prototype/fw/include/global.h
blob: d0c56d79a7e859cac29b0f0c98306cd385f24136 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#ifndef __GLOBAL_H__
#define __GLOBAL_H__

#include <stdbool.h>
#include <stdint.h>
#include <assert.h>
#include <string.h>

/* The IRQ header must be included before stm32_device.h since ST defines a bunch of messy macros there. */
#include <generated/stm32_irqs.h> /* Header generated from stm32***_startup.s in Makefile */

#include <generated/stm32_device.h>

#define APB1_PRESC (1<<(APBPrescTable[(RCC->CFGR & RCC_CFGR_PPRE1_Msk) >> RCC_CFGR_PPRE1_Pos]))
#define APB2_PRESC (1<<(APBPrescTable[(RCC->CFGR & RCC_CFGR_PPRE2_Msk) >> RCC_CFGR_PPRE2_Pos]))
#define AHB_PRESC  (1<<(AHBPrescTable[(RCC->CFGR & RCC_CFGR_HPRE_Msk) >> RCC_CFGR_HPRE_Pos]))

#endif /* __GLOBAL_H__ */