1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13:
14:
15: 16: 17: 18: 19:
20:
21: #ifndef __DEV_SER_STM32L4_H__
22: #define __DEV_SER_STM32L4_H__
23:
24: #define DEV_SER_UNITNM (3)
25: #define DEV_SER_UNIT0 (0)
26: #define DEV_SER_UNIT1 (1)
27: #define DEV_SER_UNIT2 (2)
28:
29: 30: 31:
32:
33:
34: #define USART1_BASE (0x40013800UL)
35: #define USART2_BASE (0x40004400UL)
36: #define USART3_BASE (0x40004800UL)
37:
38:
39: #define USARTx_CR1 (0x0000)
40: #define USARTx_CR2 (0x0004)
41: #define USARTx_CR3 (0x0008)
42: #define USARTx_BRR (0x000C)
43: #define USARTx_GTPR (0x0010)
44: #define USARTx_RTOR (0x0014)
45: #define USARTx_RQR (0x0018)
46: #define USARTx_ISR (0x001C)
47: #define USARTx_ICR (0x0020)
48: #define USARTx_RDR (0x0024)
49: #define USARTx_TDR (0x0028)
50:
51:
52: #define USART_CR1_UE (1<<0)
53: #define USART_CR1_UESM (1<<1)
54: #define USART_CR1_RE (1<<2)
55: #define USART_CR1_TE (1<<3)
56: #define USART_CR1_IDLEIE (1<<4)
57: #define USART_CR1_RXNEIE (1<<5)
58: #define USART_CR1_TCIE (1<<6)
59: #define USART_CR1_TXEIE (1<<7)
60: #define USART_CR1_PEIE (1<<8)
61: #define USART_CR1_PS (1<<9)
62: #define USART_CR1_PCE (1<<10)
63: #define USART_CR1_WAKE (1<<11)
64: #define USART_CR1_M0 (1<<12)
65: #define USART_CR1_MME (1<<13)
66: #define USART_CR1_CMIE (1<<14)
67: #define USART_CR1_OVER8 (1<<15)
68: #define USART_CR1_RTOIE (1<<26)
69: #define USART_CR1_EOBIE (1<<27)
70: #define USART_CR1_M1 (1<<28)
71:
72: #define USART_CR2_STOP (3<<12)
73:
74: #define USART_CR3_RTSE (1<<8)
75: #define USART_CR3_CTSE (1<<9)
76:
77: #define USART_RQR_SBKRQ (1<<1)
78:
79: #define USART_ISR_PE (1<<0)
80: #define USART_ISR_FE (1<<1)
81: #define USART_ISR_NF (1<<2)
82: #define USART_ISR_ORE (1<<3)
83: #define USART_ISR_IDLE (1<<4)
84: #define USART_ISR_RXNE (1<<5)
85: #define USART_ISR_TC (1<<6)
86: #define USART_ISR_TXE (1<<7)
87: #define USART_ISR_LBDF (1<<8)
88: #define USART_ISR_CTSIF (1<<9)
89: #define USART_ISR_CTS (1<<10)
90: #define USART_ISR_RTOF (1<<11)
91: #define USART_ISR_EOBF (1<<12)
92: #define USART_ISR_ABRE (1<<14)
93: #define USART_ISR_ABRF (1<<15)
94: #define USART_ISR_BUSY (1<<16)
95: #define USART_ISR_CMF (1<<17)
96: #define USART_ISR_SBKF (1<<18)
97: #define USART_ISR_RWU (1<<6)
98: #define USART_ISR_WUF (1<<6)
99: #define USART_ISR_TEACK (1<<6)
100: #define USART_ISR_REACK (1<<6)
101: #define USART_ISR_ERR (USART_ISR_PE|USART_ISR_FE|USART_ISR_NF|USART_ISR_ORE)
102:
103: #define USART_ICR_PECF (1<<0)
104: #define USART_ICR_FECF (1<<1)
105: #define USART_ICR_NCF (1<<2)
106: #define USART_ICR_ORECF (1<<3)
107: #define USART_ICR_IDLECF (1<<4)
108: #define USART_ICR_TCCF (1<<6)
109: #define USART_ICR_TCBGTCF (1<<7)
110: #define USART_ICR_LBDCF (1<<8)
111: #define USART_ICR_CTSCF (1<<9)
112: #define USART_ICR_RTOCF (1<<11)
113: #define USART_ICR_EOBCF (1<<12)
114: #define USART_ICR_CMCF (1<<17)
115: #define USART_ICR_WUCF (1<<20)
116: #define USART_ICR_ALL (0x00121BDF)
117:
118:
119: #define USART_CR1_DEBUG 0x0000000D
120: #define USART_CR2_DEBUG 0
121: #define USART_CR3_DEBUG 0
122:
123:
124:
125: #define INTNO_USART1 37
126: #define INTNO_USART2 38
127: #define INTNO_USART3 39
128:
129: #endif