uart small ping pong receive, update of register functions
[cortex-from-scratch] / include / mmap.h
1 /* 
2  * Example memory map for the Cortex-A3
3  * Implementations vary among manufacturers. This one is
4  * a STM32F013RC6. Addresses of peripherals vary amongst 
5  * manufacturers of boards with similar chips
6  * 
7  * */
8
9 #define BSS_BASE ((volatile uint32_t *)(0x20000800)) //TODO: .data flexible siz
10 #define TOTAL_MEM_SIZE 64000;
11
12 /* SYSTEM INFO AND DEBUG */
13 #define MCU_ID ((volatile uint32_t*)( 0xE000ED00)) 
14 #define FLASH_MEM ((volatile uint32_t*)( 0x1FFFF000)) 
15
16 /* SYSTEM CONTROL BLOCK REGISTER */
17 #define SCB_VTOR ((volatile uint32_t *)( 0xE000ED08)) // VECTOR TABLE
18
19 /* NESTED VECTOR INTERRUPT CONTROL REGISTER */
20 #define NVIC_ISER0 ((volatile uint32_t*)( 0xE000E100)) // interrupt set enable register
21 #define NVIC_ISER1 ((volatile uint32_t*)( 0xE000E104)) // interrupt set enable register
22
23 /* SYSTICK REGISTER */
24 #define STK_CTRL ((volatile uint32_t *)(0xE000E010))
25 #define STK_RELOAD ((volatile uint32_t *)(0xE000E014))
26
27 /* CLOCK REGISTER */
28 #define RCC_CR ((volatile uint32_t *)(0x40021000))
29 #define RCC_CFGR ((volatile uint32_t *)(RCC_CR + 0x04))
30
31 /* SYSTEM CONTROL REGISTER */
32 #define SYSCTRL_RCC ((volatile unsigned long *)(0x40021000))
33 #define RCC_APB2ENR ((volatile uint32_t *)(0x40021018)) // register to enable USART1
34
35 #define SYSCTRL_RIS ((volatile unsigned long *)(0x400FE050))
36 #define SYSCTRL_RCGC1 ((volatile unsigned long *)(0x400FE104))
37 #define SYSCTRL_RCGC2 ((volatile unsigned long *)(0x400FE108))
38 #define GPIOPA_AFSEL ((volatile unsigned long *)(0x40004420))
39
40 #define GPIOA_CRH ((volatile unsigned long *)(0x40010804))
41
42 #define AFIO_EVCR ((volatile uint32_t *)(0x40010000))
43 //#define AFIO_EXTICR1 ((volatile uint32_t *)(AFIO_EVCR + 0x08))
44
45 /* EXTERNAL INTERRUPTS */
46 #define EXTI_IMR ((volatile uint32_t *)(0x40010400))
47 #define EXTI_RTSR ((volatile uint32_t *)  (EXTI_IMR + 0x08))
48 //#define EXTI_FTSR ((volatile uint32_t *)  (EXTI_IMR + 0x04))
49
50 /* UART1 REGISTERS */
51 #define USART1_BASE ((volatile uint32_t) (0x40013800))
52 #define USART1_SR ((volatile uint32_t *) (USART1_BASE))
53 #define USART1_DR ((volatile uint32_t *)  (USART1_BASE + 0x04))
54 #define USART1_BRR ((volatile uint32_t *) (USART1_BASE + 0x08))
55 #define USART1_CR1 ((volatile uint32_t *) (USART1_BASE + 0x0C))
56 #define USART1_CR2 ((volatile uint32_t *) (USART1_BASE + 0x10))
57 #define USART1_CR3 ((volatile uint32_t *) (USART1_BASE + 0x14))