memmap.inc 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /* This file is the part of the Lightweight USB device Stack for STM32 microcontrollers
  2. *
  3. * Copyright ©2016 Dmitry Filimonchuk <dmitrystu[at]gmail[dot]com>
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. #if defined(STM32L052xx) || defined(STM32L053xx) || \
  16. defined(STM32L062xx) || defined(STM32L063xx) || \
  17. defined(STM32L072xx) || defined(STM32L073xx) || \
  18. defined(STM32L082xx) || defined(STM32L083xx) || \
  19. defined(STM32L432xx) || defined(STM32L433xx) || \
  20. defined(STM32L442xx) || defined(STM32L443xx) || \
  21. defined(STM32L452xx) || defined(STM32L462xx) || \
  22. defined(STM32F042x6) || defined(STM32F048xx) || \
  23. defined(STM32F070x6) || defined(STM32F070xB) || \
  24. defined(STM32F072xB) || defined(STM32F078xx) \
  25. #define USB_EPBASE 0x40005C00
  26. #define USB_REGBASE 0x40005C40
  27. #define USB_CNTR 0x00
  28. #define USB_ISTR 0x04
  29. #define USB_FNR 0x08
  30. #define USB_DADDR 0x0C
  31. #define USB_BTABLE 0x10
  32. #define USB_BCDR 0x18
  33. #define USB_PMABASE 0x40006000
  34. #define RCC_BASE 0x40021000
  35. #if defined(STM32F042x6) || defined(STM32F048xx) || \
  36. defined(STM32F070x6) || defined(STM32F070xB) || \
  37. defined(STM32F072xB) || defined(STM32F078xx)
  38. #define RCC_APB1RSTR 0x10
  39. #define RCC_APB1ENR 0x1C
  40. #define UID_BASE 0x1FFFF7AC
  41. #else
  42. #define RCC_APB1RSTR 0x28
  43. #define RCC_APB1ENR 0x38
  44. #define UID_BASE 0x1FF80050
  45. #endif
  46. #elif defined(STM32L1)
  47. /* common definitions for STM31L100xx STM32L151xx STM32L152xx STM32L162xx */
  48. #define USB_EPBASE 0x40005C00
  49. #define USB_REGBASE 0x40005C40
  50. #define USB_CNTR 0x00
  51. #define USB_ISTR 0x04
  52. #define USB_FNR 0x08
  53. #define USB_DADDR 0x0C
  54. #define USB_BTABLE 0x10
  55. #define USB_PMABASE 0x40006000
  56. #define SYSCFG_BASE 0x40010000
  57. #define SYSCFG_PMC 0x04
  58. #define RCC_BASE 0x40023800
  59. #define RCC_APB1ENR 0x24
  60. #define RCC_APB1RSTR 0x18
  61. #define RCC_APB2ENR 0x20
  62. #if defined(STM32L100xB) || defined(STM32L100xBA) || \
  63. defined(STM32L151xB) || defined(STM32L151xBA)
  64. /* Cat.1 and Cat.2 devices */
  65. #define UID_BASE 0x1FF80050
  66. #else
  67. #define UID_BASE 0x1FF800D0
  68. #endif
  69. #elif defined(STM32F102x6) || defined(STM32F102xB) || \
  70. defined(STM32F103x6) || defined(STM32F103xB) || \
  71. defined(STM32F103xE) || defined(STM32F103xG)
  72. #define USB_EPBASE 0x40005C00
  73. #define USB_REGBASE 0x40005C40
  74. #define USB_CNTR 0x00
  75. #define USB_ISTR 0x04
  76. #define USB_FNR 0x08
  77. #define USB_DADDR 0x0C
  78. #define USB_BTABLE 0x10
  79. #define USB_PMABASE 0x40006000
  80. #define RCC_BASE 0x40021000
  81. #define RCC_APB1RSTR 0x10
  82. #define RCC_APB2ENR 0x18
  83. #define RCC_APB1ENR 0x1C
  84. #define RCC_GPIOAEN 0x02
  85. #define RCC_GPIOBEN 0x03
  86. #define RCC_GPIOCEN 0x04
  87. #define RCC_GPIODEN 0x05
  88. #define RCC_GPIOEEN 0x06
  89. #define RCC_GPIOFEN 0x07
  90. #define UID_BASE 0x1FFFF7E8
  91. #define GPIOA 0x40010800
  92. #define GPIOB 0x40010C00
  93. #define GPIOC 0x40011000
  94. #define GPIOD 0x40011400
  95. #define GPIOE 0x40011800
  96. #define GPIOF 0x40011C00
  97. #define GPIOG 0x40012000
  98. #define GPIO_CRL 0x00
  99. #define GPIO_CRH 0x04
  100. #define GPIO_IDR 0x08
  101. #define GPIO_BSRR 0x10
  102. #elif defined(STM32F303x8) || defined(STM32F303xC) || \
  103. defined(STM32F303xE)
  104. #define USB_EPBASE 0x40005C00
  105. #define USB_REGBASE 0x40005C40
  106. #define USB_CNTR 0x00
  107. #define USB_ISTR 0x04
  108. #define USB_FNR 0x08
  109. #define USB_DADDR 0x0C
  110. #define USB_BTABLE 0x10
  111. #define USB_PMABASE 0x40006000
  112. #define RCC_BASE 0x40021000
  113. #define RCC_APB1ENR 0x1C
  114. #define RCC_APB1RSTR 0x10
  115. #define RCC_AHBENR 0x14
  116. #define RCC_GPIOAEN 0x11
  117. #define RCC_GPIOBEN 0x12
  118. #define RCC_GPIOCEN 0x13
  119. #define RCC_GPIODEN 0x14
  120. #define RCC_GPIOEEN 0x15
  121. #define RCC_GPIOFEN 0x16
  122. #define RCC_GPIOGEN 0x17
  123. #define RCC_GPIOHEN 0x10
  124. #define UID_BASE 0x1FFFF7AC
  125. #define GPIOA 0x48000000
  126. #define GPIOB 0x48000400
  127. #define GPIOC 0x48000800
  128. #define GPIOD 0x48000C00
  129. #define GPIOE 0x48001000
  130. #define GPIOF 0x48001400
  131. #define GPIO_MODER 0x00
  132. #define GPIO_BSRR 0x18
  133. #else
  134. #error Unsupported MCU
  135. #endif