Skip to content

Instantly share code, notes, and snippets.

@shima-529
Created September 26, 2019 14:08
Show Gist options
  • Save shima-529/779bc74d3daf0b6a5c329a8054e9a93d to your computer and use it in GitHub Desktop.
Save shima-529/779bc74d3daf0b6a5c329a8054e9a93d to your computer and use it in GitHub Desktop.
#define RCU_BASE 0x40021000
struct _st_rcu {
int CTL;
int CFG0;
int INT;
int APB2RST;
int APB1RST;
int AHBEN;
int APB2EN;
int APB1EN;
int BDCTL;
int RSTSCK;
int AHBRST;
int CFG1;
const int RSV0;
int DSV;
};
#define RCU ((volatile struct _st_rcu *)RCU_BASE)
#define bit(n) (1 << (n))
#define RCU_AHBEN_DMA0EN_Pos 0
#define RCU_AHBEN_DMA1EN_Pos 1
#define RCU_AHBEN_SRAMSPEN_Pos 2
#define RCU_AHBEN_FMCSPEN_Pos 4
#define RCU_AHBEN_CRCEN_Pos 6
#define RCU_AHBEN_EXMCEN_Pos 8
#define RCU_AHBEN_USBFSEN_Pos 12
#define RCU_AHBEN_DMA0EN_Msk bit(0)
#define RCU_AHBEN_DMA1EN_Msk bit(1)
#define RCU_AHBEN_SRAMSPEN_Msk bit(2)
#define RCU_AHBEN_FMCSPEN_Msk bit(4)
#define RCU_AHBEN_CRCEN_Msk bit(6)
#define RCU_AHBEN_EXMCEN_Msk bit(8)
#define RCU_AHBEN_USBFSEN_Msk bit(12)
#define RCU_APB2EN_AFEN_Pos 0
#define RCU_APB2EN_PAEN_Pos 2
#define RCU_APB2EN_PBEN_Pos 3
#define RCU_APB2EN_PCEN_Pos 4
#define RCU_APB2EN_PDEN_Pos 5
#define RCU_APB2EN_PEEN_Pos 6
#define RCU_APB2EN_ADC0EN_Pos 9
#define RCU_APB2EN_AND1EN_Pos 10
#define RCU_APB2EN_TIMER0EN_Pos 11
#define RCU_APB2EN_SPI0EN_Pos 12
#define RCU_APB2EN_USART0EN_Pos 14
#define RCU_APB2EN_AFEN bit(0)
#define RCU_APB2EN_PAEN bit(2)
#define RCU_APB2EN_PBEN bit(3)
#define RCU_APB2EN_PCEN bit(4)
#define RCU_APB2EN_PDEN bit(5)
#define RCU_APB2EN_PEEN bit(6)
#define RCU_APB2EN_ADC0EN bit(9)
#define RCU_APB2EN_AND1EN bit(10)
#define RCU_APB2EN_TIMER0EN bit(11)
#define RCU_APB2EN_SPI0EN bit(12)
#define RCU_APB2EN_USART0EN bit(14)
#define RCU_APB1EN_TIMER1EN_Pos 0
#define RCU_APB1EN_TIMER2EN_Pos 1
#define RCU_APB1EN_TIMER3EN_Pos 2
#define RCU_APB1EN_TIMER4EN_Pos 3
#define RCU_APB1EN_TIMER5EN_Pos 3
#define RCU_APB1EN_TIMER6EN_Pos 4
#define RCU_APB1EN_WWDGTEN_Pos 11
#define RCU_APB1EN_SPI1EN_Pos 14
#define RCU_APB1EN_SPI2EN_Pos 15
#define RCU_APB1EN_USART1EN_Pos 17
#define RCU_APB1EN_USART2EN_Pos 18
#define RCU_APB1EN_USART3EN_Pos 19
#define RCU_APB1EN_USART4EN_Pos 20
#define RCU_APB1EN_I2C0EN_Pos 21
#define RCU_APB1EN_I3C0EN_Pos 22
#define RCU_APB1EN_CAN0EN_Pos 25
#define RCU_APB1EN_CAN1EN_Pos 26
#define RCU_APB1EN_BKPIEN_Pos 27
#define RCU_APB1EN_PMUEN_Pos 28
#define RCU_APB1EN_DACEN_Pos 29
#define RCU_APB1EN_TIMER1EN_Msk bit(0)
#define RCU_APB1EN_TIMER2EN_Msk bit(1)
#define RCU_APB1EN_TIMER3EN_Msk bit(2)
#define RCU_APB1EN_TIMER4EN_Msk bit(3)
#define RCU_APB1EN_TIMER5EN_Msk bit(3)
#define RCU_APB1EN_TIMER6EN_Msk bit(4)
#define RCU_APB1EN_WWDGTEN_Msk bit(11)
#define RCU_APB1EN_SPI1EN_Msk bit(14)
#define RCU_APB1EN_SPI2EN_Msk bit(15)
#define RCU_APB1EN_USART1EN_Msk bit(17)
#define RCU_APB1EN_USART2EN_Msk bit(18)
#define RCU_APB1EN_USART3EN_Msk bit(19)
#define RCU_APB1EN_USART4EN_Msk bit(20)
#define RCU_APB1EN_I2C0EN_Msk bit(21)
#define RCU_APB1EN_I3C0EN_Msk bit(22)
#define RCU_APB1EN_CAN0EN_Msk bit(25)
#define RCU_APB1EN_CAN1EN_Msk bit(26)
#define RCU_APB1EN_BKPIEN_Msk bit(27)
#define RCU_APB1EN_PMUEN_Msk bit(28)
#define RCU_APB1EN_DACEN_Msk bit(29)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment